[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] gitlab-ci: Move variables outside script
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH 3/5] gitlab-ci: Move variables outside script |
Date: |
Wed, 31 May 2023 16:12:54 +0100 |
User-agent: |
Mutt/2.2.9 (2022-11-12) |
On Wed, May 31, 2023 at 04:08:22PM +0100, Camilla Conte wrote:
> Also split long line for clarity.
>
> Docs:
> https://docs.gitlab.com/ee/ci/variables/#use-cicd-variables-in-other-variables
> Signed-off-by: Camilla Conte <cconte@redhat.com>
> ---
> .gitlab-ci.d/container-template.yml | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/.gitlab-ci.d/container-template.yml
> b/.gitlab-ci.d/container-template.yml
> index fd7deb1c29..d146d1d197 100644
> --- a/.gitlab-ci.d/container-template.yml
> +++ b/.gitlab-ci.d/container-template.yml
> @@ -1,20 +1,27 @@
> .container_job_template:
> extends: .base_job_template
> - image: docker:stable
> stage: containers
> + image: docker:stable
> services:
> - docker:stable-dind
> + variables:
> + TAG: "$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
> + COMMON_TAG: "$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
> + DOCKERFILE: "$CI_PROJECT_DIR/tests/docker/dockerfiles/$NAME.docker"
> + BUILD_CONTEXT: "$CI_PROJECT_DIR"
> before_script:
> - - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
> - - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
> - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p
> "$CI_REGISTRY_PASSWORD"
> - until docker info; do sleep 1; done
> script:
> - echo "TAG:$TAG"
> - echo "COMMON_TAG:$COMMON_TAG"
> - - docker build --tag "$TAG" --cache-from "$TAG" --cache-from
> "$COMMON_TAG"
> + - >
This leading '>' seems redundant
> + docker build
> + --tag "$TAG"
> + --cache-from "$TAG"
> + --cache-from "$COMMON_TAG"
> --build-arg BUILDKIT_INLINE_CACHE=1
> - -f "tests/docker/dockerfiles/$NAME.docker" "."
> + -f "$DOCKERFILE" "$BUILD_CONTEXT"
This is a functional change as $BUILD_CONTEXT expands
to something different that '.'.
IOW, this should be a separate commit
> - docker push "$TAG"
> after_script:
> - docker logout
> --
> 2.40.1
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Improvements to Gitlab CI container builds, Camilla Conte, 2023/05/31
- [PATCH 3/5] gitlab-ci: Move variables outside script, Camilla Conte, 2023/05/31
- Re: [PATCH 3/5] gitlab-ci: Move variables outside script,
Daniel P . Berrangé <=
- [PATCH 2/5] gitlab-ci: Reference rules instead of extends, Camilla Conte, 2023/05/31
- [PATCH 5/5] gitlab-ci: Replace Docker with Kaniko, Camilla Conte, 2023/05/31
- [PATCH 4/5] gitlab-ci: Use container template for opensbi, Camilla Conte, 2023/05/31
- [PATCH 1/5] gitlab-ci: Remove unused Python package, Camilla Conte, 2023/05/31