diff --git a/Installer.py b/Installer.py index ede1ddaa4395f411ec6e4113ff7d07dac5b67456..c4108470006ed0942b6fd877e551225f400678fd 100755 --- a/Installer.py +++ b/Installer.py @@ -100,13 +100,6 @@ def CLI(): "default": "utility/runtime", "help": "Path where utility files are located. Downscoped users need read access." }, - { - "flags": ["-rip", "--runner-install-path"], - "type": str, - "metavar": "<name>", - "default": "utility/runtime/bin", - "help": "The path where the runner is installed." - }, { "flags": ["-up", "--user-path"], "type": str, @@ -159,6 +152,13 @@ def CLI(): "default": "./install", "help": "The path where the runner is installed." }, + { + "flags": ["-rip", "--runner-install-path"], + "type": str, + "metavar": "<name>", + "default": "utility/runtime/bin", + "help": "The path where the runner is installed." + }, ] } @@ -261,18 +261,24 @@ def install(): set_utility_permissions(_runner_install_path, ['gitlab-runner']) set_utility_permissions(args.rt_utility_path) - -def add_registration(runner_path=''): +def runner_registration(runner_path=''): # Register Gitlab Runner if runner_path: runner_path += '/' os.system( f'{runner_path}gitlab-runner register --non-interactive --url "{args.registration_url}" --registration-token "{args.registration_token}"\ - --executor "custom" --description "{args.runner_name}" --tag-list "{args.tag_list}" --run-untagged="false" --locked="false" \ - --access-level="not_protected"\ - --custom-prepare-exec="{args.install_path}/main.sh" --custom-config-exec="{args.install_path}/main.sh"\ - --custom-run-exec="{args.install_path}/main.sh" --custom-cleanup-exec="{args.install_path}/main.sh"\ - --custom-prepare-args="prepare" --custom-config-args="config"\ - --custom-run-args="run" --custom-cleanup-args="cleanup"') + --executor "custom" --description "{args.runner_name}" --tag-list "{args.tag_list}" --run-untagged="false" --locked="false" \ + --access-level="not_protected"\ + --custom-prepare-exec="{args.install_path}/main.sh" --custom-config-exec="{args.install_path}/main.sh"\ + --custom-run-exec="{args.install_path}/main.sh" --custom-cleanup-exec="{args.install_path}/main.sh"\ + --custom-prepare-args="prepare" --custom-config-args="config"\ + --custom-run-args="run" --custom-cleanup-args="cleanup"') +def add_registration(runner_path=''): + from shutil import which + if which("gitlab-runner") is None: + runner_registration(args.runner_install_path) + else: + runner_registration(runner_path) + os.system(f"sed -i 's/concurrent = 1/concurrent = {args.concurrency}/g' $HOME/.gitlab-runner/config.toml")