Files
api_server/.gitlab-ci.yml
T
2026-03-12 22:19:02 +01:00

78 lines
2.2 KiB
YAML

stages: # List of stages for jobs, and their order of execution
- notify1
- build
- test
- scan
- push
- deploy
- security
- notify2
variables:
DOCKER_DRIVER: overlay2
IMAGE_NAME: r.sectorq.eu/jaydee/api-server:latest
GIT_STRATEGY: "fetch"
CS_IMAGE: r.sectorq.eu/jaydee/api-server:latest
SECURE_LOG_LEVEL: debug
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=A.P.I. server build job started'
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'
docker_build:
stage: build
image: docker:24
script:
- echo $IMAGE_NAME
- docker login -u "jaydee" -p "$CI_REGISTRY_PASSWORD" r.sectorq.eu
- docker build -t $IMAGE_NAME .
- docker tag $IMAGE_NAME $IMAGE_NAME
# - echo "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" > docker_images.txt
artifacts:
expire_in: 1 hour
paths:
- docker_images.txt
only:
- main
- develop
- merge_requests
include:
- template: Security/Container-Scanning.gitlab-ci.yml
container_scanning:
variables:
CS_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
GIT_STRATEGY: "fetch"
SECURE_LOG_LEVEL: debug
CS_DOCKERFILE_PATH: "python-builder/Dockerfile"
docker_push:
stage: push
image: docker:24
services:
- docker:24-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
script:
- docker login -u "jaydee" -p "$CI_REGISTRY_PASSWORD" r.sectorq.eu
- docker push $IMAGE_NAME
notify_finish:
stage: notify2 # 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=A.P.I. server build job finished'
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/portainer.tmp
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'