diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14ca245..4bfaaa5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,20 +1,11 @@ + stages: # List of stages for jobs, and their order of execution - # - notify_start - lint - build - clean - notify variables: GIT_SSH_COMMAND: "ssh -i /home/gitlab-runner/.ssh/id_rsa -o IdentitiesOnly=yes" -# notify_start: -# stage: notify_start # Should be in a later stage than the job that might fail -# script: -# - column=':' -# - echo "${flow_id}" -# - curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=portainer build job started' -# - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp -# rules: -# - if: '$CI_COMMIT_MESSAGE =~ /build/' lint: stage: lint image: r.sectorq.eu/jaydee/builder-portainer:latest @@ -31,22 +22,16 @@ lint: - if: '$CI_COMMIT_MESSAGE =~ /lint/' build-job: # This job runs in the build stage, which runs first. stage: build - # image: r.sectorq.eu/jaydee/builder-portainer:latest - before_script: - - export PYTHONPATH=$PWD - - python3 -m pip install --break-system-packages flake8 black pylint tabulate prompt_toolkit hvac pyinstaller + image: r.sectorq.eu/jaydee/builder-portainer:latest script: - mkdir -p ~/.ssh - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - - ls -la - - python3 -m pip install --break-system-packages flake8 black pylint tabulate prompt_toolkit hvac pyinstaller - - pyinstaller --onefile --clean --hidden-import=portainer_api portainer.py - - strings dist/portainer | grep portainer_api || true - - scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/portainer jd@192.168.80.222:/myapps/bin/ || true + - pyinstaller --onefile portainer.py + #- scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/portainer jd@192.168.80.222:/myapps/bin/ || true - scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/portainer jd@192.168.77.12:/myapps/bin/ || true - scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/portainer jd@192.168.77.101:/myapps/bin/ || true - - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.* + - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp artifacts: paths: - dist/ @@ -62,14 +47,12 @@ clean-job: # This job runs in the build stage, which runs first. - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp rules: - if: '$CI_COMMIT_MESSAGE =~ /build/' - cleanup_on_failure_job: stage: clean # Should be in a later stage than the job that might fail when: on_failure # <-- This is the key keyword script: - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp - -notify_complete: +notify: stage: notify # Should be in a later stage than the job that might fail when: on_success # <-- This is the key keyword script: @@ -77,9 +60,7 @@ notify_complete: - echo "${flow_id}" - curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=portainer build job completed' - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp - rules: - - if: '$CI_COMMIT_MESSAGE =~ /build/' -notify_failed: +notify2: stage: notify # Should be in a later stage than the job that might fail when: on_failure # <-- This is the key keyword script: @@ -88,5 +69,4 @@ notify_failed: - curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=portainer build job failed' - rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp rules: - - if: '$CI_COMMIT_MESSAGE =~ /build/' - \ No newline at end of file + - if: '$CI_COMMIT_MESSAGE =~ /build/' \ No newline at end of file