From dca57abe166d3a9ed73eb3e19dba6e3cf3a9aa39 Mon Sep 17 00:00:00 2001 From: Salvatore Testa Date: Mon, 25 Dec 2023 13:14:23 -0800 Subject: [PATCH] Use $CI_REGISTRY_IMAGE for the registry path GitLab will return an error if you have an upper case letter at the start of your username. ``` invalid reference format: repository name must be lowercase ``` The built-in `$CI_REGISTRY_IMAGE` variable does the right thing. Closes https://gitlab.com/veilid/veilid/-/issues/352 --- .gitlab-ci.yml | 4 ++-- Earthfile | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5319469a..a7b64b05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ stages: - chmod +x /usr/local/bin/earthly - earthly bootstrap - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY - - test "$CI_PROJECT_PATH" != "veilid/veilid" && project_args="--CI_PROJECT_PATH=$CI_PROJECT_PATH" + - test "$CI_PROJECT_PATH" != "veilid/veilid" && project_args="--CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE" # Create the build container if: # - no container in the registry @@ -34,7 +34,7 @@ build_cache: extends: .base stage: prepare script: - - if ! docker manifest inspect registry.gitlab.com/$CI_PROJECT_PATH/build-cache:latest > /dev/null || [[ "$CI_PIPELINE_SOURCE" == "schedule" ]] || [[ "$CI_PIPELINE_SOURCE" == "web" ]] ; then + - if ! docker manifest inspect $CI_REGISTRY_IMAGE/build-cache:latest > /dev/null || [[ "$CI_PIPELINE_SOURCE" == "schedule" ]] || [[ "$CI_PIPELINE_SOURCE" == "web" ]] ; then - *earthly_setup - earthly --use-inline-cache --save-inline-cache --strict --push -P +build-linux-cache $project_args - else diff --git a/Earthfile b/Earthfile index a7d173cc..85c56494 100644 --- a/Earthfile +++ b/Earthfile @@ -3,8 +3,8 @@ VERSION 0.7 ######################################################################################################################## ## ARGUMENTS ## -## CI_PROJECT_PATH - used so that forks can refer to themselves, e.g. to use the fork's own registry cache in the -## `+build-linux-cache` target, and defaulting to `veilid/veilid` if not specified +## CI_REGISTRY_IMAGE - used so that forks can refer to themselves, e.g. to use the fork's own registry cache in the +## `+build-linux-cache` target, and defaulting to `registry.gitlab.com/veilid/veilid` if not specified ## ## BASE - tells the build whether it should run in the default mode which runs the complete build, or run by starting ## with the remote `container` value which uses `build-cache:latest` as set up in the projects Container Registry @@ -96,8 +96,8 @@ build-linux-cache: RUN cargo chef cook --recipe-path recipe.json RUN echo $PROJECT_PATH SAVE ARTIFACT target - ARG CI_PROJECT_PATH=veilid/veilid - SAVE IMAGE --push registry.gitlab.com/$CI_PROJECT_PATH/build-cache:latest + ARG CI_REGISTRY_IMAGE=registry.gitlab.com/veilid/veilid + SAVE IMAGE --push $CI_REGISTRY_IMAGE/build-cache:latest code-linux: # This target will either use the full earthly cache of local use (+build-linux-cache), or will use a containerized @@ -106,8 +106,8 @@ code-linux: IF [ "$BASE" = "local" ] FROM +build-linux-cache ELSE - ARG CI_PROJECT_PATH=veilid/veilid - FROM registry.gitlab.com/$CI_PROJECT_PATH/build-cache:latest + ARG CI_REGISTRY_IMAGE=registry.gitlab.com/veilid/veilid + FROM $CI_REGISTRY_IMAGE/build-cache:latest # FROM registry.gitlab.com/veilid/build-cache:latest END COPY --dir .cargo files scripts veilid-cli veilid-core veilid-server veilid-tools veilid-flutter veilid-wasm Cargo.lock Cargo.toml /veilid