Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Docker
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
to be continuous...
Docker
Commits
e213a9e2
Commit
e213a9e2
authored
1 year ago
by
Boris Barnier
Committed by
Kiran Patel
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(kaniko): fix $HOME variable
parent
cd60d14b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/gitlab-ci-docker.yml
+15
-11
15 additions, 11 deletions
templates/gitlab-ci-docker.yml
with
15 additions
and
11 deletions
templates/gitlab-ci-docker.yml
+
15
−
11
View file @
e213a9e2
...
...
@@ -338,18 +338,19 @@ stages:
docker_release_config_json=$(echo -n "{\"auths\":{\"$docker_release_registry_host\":{\"auth\":\"$docker_release_authent_token\"},\"HttpHeaders\":{\"User-Agent\":\"$USER_AGENT\"}}}")
# Create the configuration file for Docker and Kaniko
mkdir -p "$HOME/.docker"
BUILDTOOL_HOME=${BUILDTOOL_HOME:-$HOME}
mkdir -p "$BUILDTOOL_HOME/.docker"
if [ -f "${DOCKER_CONFIG_FILE}" ]
then
awkenvsubst < "${DOCKER_CONFIG_FILE}" > "$HOME/.docker/config.json"
awkenvsubst < "${DOCKER_CONFIG_FILE}" > "$
BUILDTOOL_
HOME/.docker/config.json"
else
echo "${docker_snapshot_config_json}" > "$HOME/.docker/config.json"
echo "${docker_snapshot_config_json}" > "$
BUILDTOOL_
HOME/.docker/config.json"
fi
# Create the configuration file for Skopeo
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"
mkdir -p "$
BUILDTOOL_
HOME/skopeo/.docker"
echo "${docker_snapshot_config_json}" > "$
BUILDTOOL_
HOME/skopeo/.docker/src-config.json"
echo "${docker_release_config_json}" > "$
BUILDTOOL_
HOME/skopeo/.docker/dest-config.json"
log_info "Docker authentication configured for \\e[33;1m${docker_snapshot_registry_host}\\e[0m"
}
...
...
@@ -417,9 +418,10 @@ stages:
function configure_containers_registries() {
if [[ -n "$CONTAINER_REGISTRIES_CONFIG_FILE" ]]
then
mkdir -p "$HOME/.config/containers"
echo "${CONTAINER_REGISTRIES_CONFIG_FILE}" > "$HOME/.config/containers/registries.conf"
log_info "Configured $HOME/.config/containers/registries.conf"
BUILDTOOL_HOME=${BUILDTOOL_HOME:-$HOME}
mkdir -p "$BUILDTOOL_HOME/.config/containers"
echo "${CONTAINER_REGISTRIES_CONFIG_FILE}" > "$BUILDTOOL_HOME/.config/containers/registries.conf"
log_info "Configured $BUILDTOOL_HOME/.config/containers/registries.conf"
fi
}
...
...
@@ -441,6 +443,7 @@ stages:
entrypoint
:
[
"
"
]
variables
:
KANIKO_CACHE_DIR
:
"
${CI_PROJECT_DIR}/.cache"
BUILDTOOL_HOME
:
"
/kaniko"
cache
:
key
:
"
$CI_COMMIT_REF_SLUG-docker"
paths
:
...
...
@@ -788,9 +791,10 @@ 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 $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
BUILDTOOL_HOME=${BUILDTOOL_HOME:-$HOME}
skopeo copy --src-authfile $BUILDTOOL_HOME/skopeo/.docker/src-config.json --dest-authfile $BUILDTOOL_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 $HOME/skopeo/.docker/dest-config.json --format='{{ .Digest }}' "docker://$DOCKER_RELEASE_IMAGE")
-
docker_digest=$(skopeo inspect --authfile $
BUILDTOOL_
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
...
...
This diff is collapsed.
Click to expand it.
Pierre-Alain RIVIERE
@pariviere
mentioned in commit
789c25db
·
1 year ago
mentioned in commit
789c25db
mentioned in commit 789c25db4eb4ac37342dd81cb497c1f2d04dd964
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment