Build images using buildx plugin and automatically push on main branch

This commit is contained in:
Andrejs Cunskis 2022-05-10 17:17:46 +03:00
parent 5a79c03924
commit fe331541d7
No known key found for this signature in database
GPG key ID: 87CB75083F227241
15 changed files with 213 additions and 357 deletions

View file

@ -1,25 +1,12 @@
# Run test job always
.test:
stage: test
rules:
- when: always
# Run build job only on a default branch when triggered manually
.deploy:
.build_and_push:
stage: deploy
needs: []
script:
- ./scripts/lib/custom-docker-build
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
PUSH_CUSTOM_IMAGE: "false"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
.test_custom:
extends: .test
script:
- ./scripts/custom-docker-build
rules:
- when: always
.build_and_deploy_custom:
extends: .deploy
script:
- ./scripts/custom-docker-build --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL"
- ./scripts/custom-docker-push
variables:
PUSH_CUSTOM_IMAGE: "true"