2022-05-26 06:36:47 +00:00
|
|
|
# THIS FILE WAS AUTO-GENERATED
|
|
|
|
#
|
|
|
|
# $ lcitool manifest ci/manifest.yml
|
|
|
|
#
|
|
|
|
# https://gitlab.com/libvirt/libvirt-ci
|
|
|
|
|
|
|
|
|
|
|
|
# For upstream
|
|
|
|
#
|
|
|
|
# - Push to default branch:
|
|
|
|
# -> rebuild if dockerfile changed, no cache
|
|
|
|
# - Otherwise
|
2022-07-11 11:47:02 +00:00
|
|
|
# -> rebuild if RUN_ALL_CONTAINERS=1, no cache,
|
2022-05-26 06:36:47 +00:00
|
|
|
# to pick up new published distro packages or
|
|
|
|
# recover from deleted tag
|
|
|
|
#
|
|
|
|
# For forks
|
|
|
|
# - Always rebuild, with cache
|
|
|
|
#
|
|
|
|
.container_job:
|
|
|
|
image: docker:stable
|
|
|
|
stage: containers
|
|
|
|
needs: []
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
before_script:
|
|
|
|
- export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
|
|
|
|
- export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt/ci-$NAME:latest"
|
|
|
|
- docker info
|
|
|
|
- docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
|
|
|
script:
|
|
|
|
- if test $CI_PROJECT_NAMESPACE = "libvirt";
|
|
|
|
then
|
|
|
|
docker build --tag "$TAG" -f "ci/containers/$NAME.Dockerfile" ci/containers ;
|
|
|
|
else
|
|
|
|
docker pull "$TAG" || docker pull "$COMMON_TAG" || true ;
|
|
|
|
docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" -f "ci/containers/$NAME.Dockerfile" ci/containers ;
|
|
|
|
fi
|
|
|
|
- docker push "$TAG"
|
|
|
|
after_script:
|
|
|
|
- docker logout
|
|
|
|
rules:
|
2022-07-11 11:47:02 +00:00
|
|
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
|
|
when: never
|
2022-05-26 06:36:47 +00:00
|
|
|
- if: '$CI_PROJECT_NAMESPACE == "libvirt" && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
|
|
when: on_success
|
|
|
|
changes:
|
|
|
|
- ci/gitlab/container-templates.yml
|
|
|
|
- ci/containers/$NAME.Dockerfile
|
2022-07-11 11:47:02 +00:00
|
|
|
- if: '$CI_PROJECT_NAMESPACE == "libvirt" && $RUN_ALL_CONTAINERS == "1"'
|
2022-05-26 06:36:47 +00:00
|
|
|
when: on_success
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE == "libvirt"'
|
|
|
|
when: never
|
2022-07-11 11:47:02 +00:00
|
|
|
- if: '$JOB_OPTIONAL'
|
2022-05-27 14:06:17 +00:00
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
2022-05-26 06:36:47 +00:00
|
|
|
- when: on_success
|