diff options
Diffstat (limited to 'ci/gitlab/container-templates.yml')
-rw-r--r-- | ci/gitlab/container-templates.yml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ci/gitlab/container-templates.yml b/ci/gitlab/container-templates.yml new file mode 100644 index 0000000..a577028 --- /dev/null +++ b/ci/gitlab/container-templates.yml @@ -0,0 +1,44 @@ +# THIS FILE WAS AUTO-GENERATED +# +# $ lcitool manifest ci/manifest.yml +# +# https://gitlab.com/libvirt/libvirt-ci + + +# We want to publish containers with tag 'latest': +# +# - In upstream, for push to default branch with CI changes. +# - In upstream, on request, for scheduled/manual pipelines +# against default branch +# +# Note: never publish from merge requests since they have non-committed code +# +.container_job: + image: docker:stable + stage: containers + needs: [] + services: + - docker:dind + before_script: + - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest" + - docker info + - docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" + script: + - docker build --tag "$TAG" -f "ci/containers/$NAME.Dockerfile" ci/containers ; + - docker push "$TAG" + after_script: + - docker logout + rules: + # upstream: publish containers if there were CI changes on the default branch + - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: on_success + changes: + - ci/gitlab/container-templates.yml + - ci/containers/$NAME.Dockerfile + + # upstream: allow force re-publishing containers on default branch for web/api/scheduled pipelines + - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $RUN_CONTAINER_BUILDS == "1"' + when: on_success + + # upstream+forks: that's all folks + - when: never |