Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
CI-CD components
Docker
Commits
8df32637
Commit
8df32637
authored
1 year ago
by
Kiran Patel
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
fix(kaniko): fix $HOME variable See merge request to-be-continuous/docker!71
parents
cd60d14b
e213a9e2
Branches
Branches containing commit
Tags
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 @
8df32637
...
...
@@ -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.
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