From e8b89fdeaada7353998d3b92668873af9cb46b87 Mon Sep 17 00:00:00 2001 From: Kiran Patel <kiranpatel11@gmail.com> Date: Mon, 15 May 2023 04:50:59 +0000 Subject: [PATCH] fix: use $HOME for skopeo credentials for rootless use --- templates/gitlab-ci-docker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml index 285e6d9..90c4492 100644 --- a/templates/gitlab-ci-docker.yml +++ b/templates/gitlab-ci-docker.yml @@ -347,9 +347,9 @@ stages: fi # Create the configuration file for Skopeo - mkdir -p /skopeo/.docker - echo "${docker_snapshot_config_json}" > /skopeo/.docker/src-config.json - echo "${docker_release_config_json}" > /skopeo/.docker/dest-config.json + mkdir -p "$HOME/skopeo/.docker" + echo "${docker_snapshot_config_json}" > "$HOME/skopeo/.docker/src-config.json" + echo "${docker_release_config_json}" > "$HOME/skopeo/.docker/dest-config.json" log_info "Docker authentication configured for \\e[33;1m${docker_snapshot_registry_host}\\e[0m" } @@ -788,9 +788,9 @@ docker-publish: log_warn "\\e[93mYou should consider distinguishing snapshot and release images as they do not differ. Skipping publish phase as image has already been created by previous job.\\e[0m" exit 0 fi - skopeo copy --src-authfile /skopeo/.docker/src-config.json --dest-authfile /skopeo/.docker/dest-config.json ${DOCKER_PUBLISH_ARGS} docker://$DOCKER_SNAPSHOT_IMAGE docker://$DOCKER_RELEASE_IMAGE + skopeo copy --src-authfile $HOME/skopeo/.docker/src-config.json --dest-authfile $HOME/skopeo/.docker/dest-config.json ${DOCKER_PUBLISH_ARGS} docker://$DOCKER_SNAPSHOT_IMAGE docker://$DOCKER_RELEASE_IMAGE log_info "Well done your image is published and can be downloaded by doing: docker pull $DOCKER_RELEASE_IMAGE" - - docker_digest=$(skopeo inspect --authfile /skopeo/.docker/dest-config.json --format='{{ .Digest }}' "docker://$DOCKER_RELEASE_IMAGE") + - docker_digest=$(skopeo inspect --authfile $HOME/skopeo/.docker/dest-config.json --format='{{ .Digest }}' "docker://$DOCKER_RELEASE_IMAGE") - docker_repository=${DOCKER_RELEASE_IMAGE%:*} - docker_tag=${DOCKER_RELEASE_IMAGE##*:} - echo "docker_image=$DOCKER_RELEASE_IMAGE" > docker.env -- GitLab