Skip to content
Snippets Groups Projects
Verified Commit f50107dc authored by Andrei Gherzan's avatar Andrei Gherzan :penguin:
Browse files

ci: Deploy container images to OSTC docker registry

The EF infrastructure (GitLab) doesn't support image registry. This
moves the CI logic of building and deploying all the container images to
the OSTC instance while EF catches up[1].

[1] eclipsefdn/helpdesk#1108



Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
parent 163275e2
No related branches found
No related tags found
No related merge requests found
......@@ -297,10 +297,22 @@ lava-badge:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- test -n "$CI_ONIRO_REGISTRY" || (
echo "CI_ONIRO_REGISTRY not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_ONIRO_REGISTRY_IMAGE" || (
echo "CI_ONIRO_REGISTRY_IMAGE not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_ONIRO_REGISTRY_USER" || (
echo "CI_ONIRO_REGISTRY_USER not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_ONIRO_REGISTRY_TOKEN" || (
echo "CI_ONIRO_REGISTRY_TOKEN not provided. Docker registry deployment can not continue."
&& exit 1 )
- |
set -xe
mkdir -p /kaniko/.docker
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$CI_REGISTRY" "$(printf '%s:%s' "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64)" > /kaniko/.docker/config.json
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$CI_ONIRO_REGISTRY" "$(printf '%s:%s' "$CI_ONIRO_REGISTRY_USER" "$CI_ONIRO_REGISTRY_TOKEN" | base64)" > /kaniko/.docker/config.json
BUILD_DATE="$(date '+%FT%T%z' | sed -E -n 's/(\+[0-9]{2})([0-9]{2})$/\1:\2/p')" #rfc 3339 date
BUILD_TITLE=$(echo "$CI_PROJECT_TITLE" | tr " " "_")
IMAGE_LABELS="$(cat <<EOM
......@@ -317,7 +329,7 @@ lava-badge:
--label org.opencontainers.image.description=$BUILD_TITLE
--label org.opencontainers.image.documentation=$CI_PROJECT_URL
--label org.opencontainers.image.licenses=$CI_PROJECT_URL
--label org.opencontainers.image.ref.name=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
--label org.opencontainers.image.ref.name=$CI_ONIRO_REGISTRY:$CI_COMMIT_REF_NAME
--label org.opencontainers.image.revision=$CI_COMMIT_SHA
--label org.opencontainers.image.source=$CI_PROJECT_URL
--label org.opencontainers.image.title=$BUILD_TITLE
......@@ -340,8 +352,8 @@ lava-badge:
fi
FORMATTED_TAG_LIST="$(echo "$FORMATTED_TAG_LIST" | sed -e 's/--tag/--destination/g')"
echo "Building and shipping image to $CI_REGISTRY_IMAGE"
exec /kaniko/executor --context "$CI_PROJECT_DIR/.oniro-ci/containers/$CONTAINER_PATH" --dockerfile "$CI_PROJECT_DIR/.oniro-ci/containers/$CONTAINER_PATH/Dockerfile" --destination $CI_REGISTRY_IMAGE/$CONTAINER_PATH $IMAGE_LABELS
echo "Building and shipping image to $CI_ONIRO_REGISTRY"
exec /kaniko/executor --context "$CI_PROJECT_DIR/.oniro-ci/containers/$CONTAINER_PATH" --dockerfile "$CI_PROJECT_DIR/.oniro-ci/containers/$CONTAINER_PATH/Dockerfile" --destination $CI_ONIRO_REGISTRY_IMAGE/$CONTAINER_PATH $IMAGE_LABELS
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment