Skip to content

build: switch MPC node image push to skopeo with --preserve-digests#2780

Open
barakeinav1 wants to merge 3 commits intomainfrom
barak/skopeo-node-push
Open

build: switch MPC node image push to skopeo with --preserve-digests#2780
barakeinav1 wants to merge 3 commits intomainfrom
barak/skopeo-node-push

Conversation

@barakeinav1
Copy link
Copy Markdown
Contributor

@barakeinav1 barakeinav1 commented Apr 9, 2026

Summary

  • Switch MPC node and node-gcp image push from docker push to skopeo copy --preserve-digests, matching the pattern already used for launcher images
  • Add skopeo to required commands when --push is used
  • Output manifest digest after push for both node images

Closes #2778

Test plan

Use skopeo copy --preserve-digests for MPC node and node-gcp images,
matching the pattern already used for launcher images. This ensures
manifest digests are preserved when pushing to Docker Hub.

Also adds skopeo to required commands when --push is used and outputs
the manifest digest after push.

Closes #2778

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Apr 9, 2026

Reviewed the diff. No critical issues found. The changes correctly mirror the existing skopeo pattern used for launcher images, adding proper temp dir cleanup and manifest digest output.

✅ Approved

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the image build/push helper script to push MPC node images via skopeo copy --preserve-digests, aligning the node push flow with the launcher images so manifest digests are deterministic and can be reported.

Changes:

  • Replace docker tag && docker push for mpc-node and mpc-node-gcp with skopeo copy --preserve-digests via a temporary dir: transport.
  • Require skopeo when --push is used.
  • Compute and print manifest digests for node images after a push.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +183 to +185
temp_dir=$(mktemp -d)
skopeo copy --all --dest-compress docker-daemon:$NODE_IMAGE_NAME:latest dir:$temp_dir
skopeo copy --preserve-digests dir:$temp_dir docker://docker.io/nearone/$NODE_IMAGE_NAME:$image_tag
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temp_dir is unquoted in the skopeo copy ... dir:$temp_dir arguments. If $TMPDIR contains spaces, mktemp -d can produce a path with spaces and these commands will break. Quote the whole transport argument (e.g., dir:"$temp_dir") to make this robust.

Copilot uses AI. Check for mistakes.
Comment on lines +183 to +187
temp_dir=$(mktemp -d)
skopeo copy --all --dest-compress docker-daemon:$NODE_IMAGE_NAME:latest dir:$temp_dir
skopeo copy --preserve-digests dir:$temp_dir docker://docker.io/nearone/$NODE_IMAGE_NAME:$image_tag
node_manifest_digest="sha256:$(sha256sum $temp_dir/manifest.json | cut -d' ' -f1)"
rm -rf "$temp_dir"
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temp dir cleanup only happens on the success path. With set -e, if a skopeo copy fails the script exits and leaves the mktemp -d directory behind. Consider registering a trap (or similar) to ensure $temp_dir is removed on errors as well.

Copilot uses AI. Check for mistakes.
Comment on lines +186 to +187
node_manifest_digest="sha256:$(sha256sum $temp_dir/manifest.json | cut -d' ' -f1)"
rm -rf "$temp_dir"
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For safer deletion, prefer rm -rf -- "$temp_dir". Even when quoted, if a path starts with - it can be interpreted as an option by rm without the -- terminator.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to +193
temp_dir=$(mktemp -d)
skopeo copy --all --dest-compress docker-daemon:$NODE_GCP_IMAGE_NAME:latest dir:$temp_dir
skopeo copy --preserve-digests dir:$temp_dir docker://docker.io/nearone/$NODE_GCP_IMAGE_NAME:$image_tag
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same quoting issue here: dir:$temp_dir is unquoted. If the temporary directory path contains spaces (e.g., from $TMPDIR), skopeo copy will fail. Quote the full transport argument.

Copilot uses AI. Check for mistakes.
Comment on lines +194 to +195
node_gcp_manifest_digest="sha256:$(sha256sum $temp_dir/manifest.json | cut -d' ' -f1)"
rm -rf "$temp_dir"
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: use rm -rf -- "$temp_dir" to avoid rm treating a path starting with - as an option.

Copilot uses AI. Check for mistakes.
The build script now requires skopeo for --push. Add the install
step to docker_build_node.yml and docker_build_node_gcp.yml,
matching the pattern already used in other workflows.
- Quote all $temp_dir usages to handle paths with spaces
- Use 'rm -rf --' to guard against paths starting with '-'
- Add EXIT trap to clean up temp dir on failure (set -e exits)
@barakeinav1
Copy link
Copy Markdown
Contributor Author

All Copilot feedback addressed in 7db9d79: quoted all $temp_dir paths, added rm -rf -- for safety, and added trap EXIT to clean up temp dir on failure.

@claude
Copy link
Copy Markdown

claude bot commented Apr 9, 2026

PR title type suggestion: This PR primarily modifies GitHub Actions workflows, which are CI/CD pipeline changes. The type prefix should probably be ci: instead of build:.

Suggested title: ci: switch MPC node image push to skopeo with --preserve-digests

@claude
Copy link
Copy Markdown

claude bot commented Apr 9, 2026

PR title type suggestion: This PR modifies CI workflow files to change how Docker images are pushed. The type prefix should probably be ci: instead of build:.

Suggested title: ci: switch MPC node image push to skopeo with --preserve-digests

@claude
Copy link
Copy Markdown

claude bot commented Apr 9, 2026

PR title type suggestion: This PR primarily modifies GitHub Actions workflows (CI/CD configuration), so the prefix should probably be ci: instead of build:.

Suggested title: ci: switch MPC node image push to skopeo with --preserve-digests

Copy link
Copy Markdown
Contributor

@gilcu3 gilcu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment on lines +188 to +189
rm -rf -- "$temp_dir"
trap - EXIT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these two needed? the first no needed because this will only run in CI

Comment on lines +193 to +197
temp_dir=$(mktemp -d)
trap 'rm -rf -- "$temp_dir"' EXIT
skopeo copy --all --dest-compress "docker-daemon:$NODE_GCP_IMAGE_NAME:latest" "dir:$temp_dir"
skopeo copy --preserve-digests "dir:$temp_dir" "docker://docker.io/nearone/$NODE_GCP_IMAGE_NAME:$image_tag"
node_gcp_manifest_digest="sha256:$(sha256sum "$temp_dir/manifest.json" | cut -d' ' -f1)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could put this in a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[build] Switch MPC node image push to skopeo with --preserve-digests

3 participants