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
This commit is contained in:
Salvatore Testa 2023-12-25 13:14:23 -08:00
parent cf4d9148da
commit dca57abe16
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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