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
9bb198ef
Commit
9bb198ef
authored
8 months ago
by
Bastien S.
Committed by
Pierre Smeyers
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: allow Skopeo to inherit Docker auth config
parent
2ff72920
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/gitlab-ci-docker.yml
+26
-4
26 additions, 4 deletions
templates/gitlab-ci-docker.yml
with
26 additions
and
4 deletions
templates/gitlab-ci-docker.yml
+
26
−
4
View file @
9bb198ef
...
@@ -518,6 +518,22 @@ stages:
...
@@ -518,6 +518,22 @@ stages:
done
done
}
}
# simple JSON merge (used in Skopeo job only)
function merge_json() {
python3 -c "import json,sys
def merge(a,b):
for key in b:
if key in a and isinstance(a[key],dict) and isinstance(b[key],dict): a[key]=merge(a[key],b[key])
else: a[key]=b[key]
return a
def mergef(*files):
res={}
for f in files:
with open(f,'r') as rd: res=merge(res,json.load(rd))
return res
print(json.dumps(mergef(*sys.argv[1:])))" "$@"
}
function wait_for_docker_daemon() {
function wait_for_docker_daemon() {
log_info "Wait for Docker daemon..."
log_info "Wait for Docker daemon..."
# shellcheck disable=SC2034
# shellcheck disable=SC2034
...
@@ -562,10 +578,16 @@ stages:
...
@@ -562,10 +578,16 @@ stages:
echo "${docker_snapshot_config_json}" > "$BUILDTOOL_HOME/.docker/config.json"
echo "${docker_snapshot_config_json}" > "$BUILDTOOL_HOME/.docker/config.json"
fi
fi
# Create the configuration file for Skopeo
# Create the configuration files for Skopeo
if command -v skopeo > /dev/null
then
mkdir -p "$BUILDTOOL_HOME/skopeo/.docker"
mkdir -p "$BUILDTOOL_HOME/skopeo/.docker"
echo "${docker_snapshot_config_json}" > "$BUILDTOOL_HOME/skopeo/.docker/src-config.json"
# use same auth config as the build tool for the source image
echo "${docker_release_config_json}" > "$BUILDTOOL_HOME/skopeo/.docker/dest-config.json"
cp -f "$BUILDTOOL_HOME/.docker/config.json" "$BUILDTOOL_HOME/skopeo/.docker/src-config.json"
# use a merged auth config for the destination image
echo "${docker_release_config_json}" > "$BUILDTOOL_HOME/skopeo/.docker/release-only.json"
merge_json "$BUILDTOOL_HOME/skopeo/.docker/src-config.json" "$BUILDTOOL_HOME/skopeo/.docker/release-only.json" > "$BUILDTOOL_HOME/skopeo/.docker/dest-config.json"
fi
log_info "Docker authentication configured for \\e[33;1m${docker_snapshot_registry_host}\\e[0m"
log_info "Docker authentication configured for \\e[33;1m${docker_snapshot_registry_host}\\e[0m"
}
}
...
...
This diff is collapsed.
Click to expand it.
Benguria Elguezabal, Gorka
@gorka.benguria
mentioned in commit
e4692726
·
4 months ago
mentioned in commit
e4692726
mentioned in commit e4692726d6c5a1938ea32ed55c572e120b4eb4ca
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