Files
2026-04-30 14:55:20 +02:00

104 lines
4.5 KiB
YAML

stages: # List of stages for jobs, and their order of execution
- notify1
- lint
- build
- clean
- notify
variables:
GIT_SSH_COMMAND: "ssh -i /home/gitlab-runner/.ssh/id_rsa -o IdentitiesOnly=yes"
notify1:
stage: notify1 # Should be in a later stage than the job that might fail
when: on_success # <-- This is the key keyword
script:
- column=':'
- echo "${flow_id}"
- curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=ansible executor build job started'
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'
lint:
stage: lint
image: r.sectorq.eu/jaydee/builder:latest
before_script:
- export PATH="$PATH:/home/gitlab-runner/.local/bin"
# - echo "PATH is now: $PATH"
script:
- flake8 .
- black --check .
- pylint main.py
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
rules:
- 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:latest
script:
- rm -rf build dist *.spec
- pyinstaller --onefile --clean -n ansr main.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/ansr jd@192.168.77.12:/myapps/bin/ || true
- curl -F "file=@dist/ansr" https://myapps.sectorq.eu/
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
artifacts:
paths:
- dist/
expire_in: 1 week
# - column=":"
# - echo "${flow_id}"
# - curl -X POST https://kestra.sectorq.eu/api/v1/executions/webhook/jaydee/ansible-all/${flow_id} -d '{"tag":["proxmox"],"target":["servers"]}' -H "Content-Type${column} application/json"
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'
build-job-arm: # This job runs in the build stage, which runs first.
stage: build
image: r.sectorq.eu/jaydee/builder-arm:latest
script:
- rm -rf build dist *.spec
- pyinstaller --onefile --clean -n ansr_arm main.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/ansr_arm jd@192.168.77.12:/myapps/bin/ || true
- curl -F "file=@dist/ansr_arm" https://myapps.sectorq.eu/
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
artifacts:
paths:
- dist/
expire_in: 1 week
# - column=":"
# - echo "${flow_id}"
# - curl -X POST https://kestra.sectorq.eu/api/v1/executions/webhook/jaydee/ansible-all/${flow_id} -d '{"tag":["proxmox"],"target":["servers"]}' -H "Content-Type${column} application/json"
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build-all/'
clean-job: # This job runs in the build stage, which runs first.
stage: clean
script:
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.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/ansible_executor.tmp
notify:
stage: notify # Should be in a later stage than the job that might fail
when: on_success # <-- This is the key keyword
script:
- column=':'
- echo "${flow_id}"
- curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=ansible executor build job completed'
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'
notify2:
stage: notify # Should be in a later stage than the job that might fail
when: on_failure # <-- This is the key keyword
script:
- column=':'
- echo "${flow_id}"
- curl -XPOST http://192.168.77.101:8123/api/webhook/voice-notifications-tC_8YKxMJIAaQRV5riKuC7Zl --data-raw 'message=ansible executor build job failed'
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/ansible_executor.tmp
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'