From eec65870ca2a9dcf9e22e165ff37043a1f9721cb Mon Sep 17 00:00:00 2001 From: Nicolas Gelot Date: Wed, 26 Oct 2022 10:29:28 +0200 Subject: [PATCH] Build builder only when needed This will prevent a lot of unexpected libraries updates during the development step. --- .gitlab-ci.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54572a13..b58055ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,16 +27,21 @@ build-docker: image: docker:19 stage: prepare services: - - docker:19-dind + - docker:19-dind tags: - - generic_privileged + - generic_privileged variables: DOCKER_DRIVER: overlay2 script: - - docker pull $CONTAINER_IMAGE:$CONTAINER_TAG || true - - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.e.foundation - - docker build --cache-from $CONTAINER_IMAGE:$CONTAINER_TAG -t $CONTAINER_IMAGE:$CONTAINER_TAG . - - docker push $CONTAINER_IMAGE:$CONTAINER_TAG + - docker pull $CONTAINER_IMAGE:$CONTAINER_TAG || true + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.e.foundation + - docker build --cache-from $CONTAINER_IMAGE:$CONTAINER_TAG -t $CONTAINER_IMAGE:$CONTAINER_TAG . + - docker push $CONTAINER_IMAGE:$CONTAINER_TAG + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + changes: + - Dockerfile + when: manual build-aur-docker: # build AUR docker image @@ -46,16 +51,21 @@ build-aur-docker: image: docker:20 stage: prepare services: - - docker:20-dind + - docker:20-dind tags: - - generic_privileged + - generic_privileged variables: DOCKER_DRIVER: overlay2 script: - - docker pull $CONTAINER_IMAGE/aur:$CONTAINER_TAG || true - - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - - cd docker && docker build --cache-from $CONTAINER_IMAGE/aur:$CONTAINER_TAG -f Dockerfile.arch -t $CONTAINER_IMAGE/aur:$CONTAINER_TAG . - - docker push $CONTAINER_IMAGE/aur:$CONTAINER_TAG + - docker pull $CONTAINER_IMAGE/aur:$CONTAINER_TAG || true + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY + - cd docker && docker build --cache-from $CONTAINER_IMAGE/aur:$CONTAINER_TAG -f Dockerfile.arch -t $CONTAINER_IMAGE/aur:$CONTAINER_TAG . + - docker push $CONTAINER_IMAGE/aur:$CONTAINER_TAG + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + changes: + - Dockerfile.arch + when: manual build-snap: image: registry.gitlab.e.foundation/e/devices/easy-installer:stable @@ -116,7 +126,6 @@ build-macos: build-aur: image: $CONTAINER_IMAGE/aur:$CONTAINER_TAG stage: build - needs: ["build-aur-docker"] before_script: - mkdir dist && cp -a pkg/arch/. dist script: -- GitLab