From 04f211205f4edd96f0cb94e2b24d83e71c58c796 Mon Sep 17 00:00:00 2001 From: isamauny Date: Fri, 9 Feb 2024 18:12:59 +0100 Subject: [PATCH] Add CICD option to script --- .42c/scripts/pixi-login.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.42c/scripts/pixi-login.py b/.42c/scripts/pixi-login.py index be08b14..d2d98dc 100644 --- a/.42c/scripts/pixi-login.py +++ b/.42c/scripts/pixi-login.py @@ -65,12 +65,16 @@ def main(): default=False, action="store_true", help="debug level") + parser.add_argument ('-c','--cicd', + required=True, + help="One of GITHUB/AZURE") parsed_cli = parser.parse_args() quiet = parsed_cli.quiet debug = parsed_cli.debug user = parsed_cli.user_name password = parsed_cli.user_pass + cicd_platform = parsed_cli.cicd user_token = obtain_token(user, password, target_url=parsed_cli.target, quiet=quiet, debug=debug) # Uncomment this for integration with Azure DevOps @@ -82,8 +86,13 @@ def main(): sys.exit(1) else: - subprocess.Popen(["echo", "##vso[task.setvariable variable=PIXI_TOKEN;isoutput=true]{0}".format(user_token)]) - + match cicd_platform: + case "GITHUB": + print(user_token) + case "AZURE": + subprocess.Popen(["echo", "##vso[task.setvariable variable=PIXI_TOKEN;isoutput=true]{0}".format(user_token)]) + case _: + print ("Unsupported CICD option") # -------------- Main Section ---------------------- if __name__ == '__main__':