Skip to content

fix(crane): avoid creating export tar on pull failure#2318

Merged
Subserial merged 2 commits into
google:mainfrom
Haihan-Jiang:codex/crane-export-no-empty-tar
Jun 2, 2026
Merged

fix(crane): avoid creating export tar on pull failure#2318
Subserial merged 2 commits into
google:mainfrom
Haihan-Jiang:codex/crane-export-no-empty-tar

Conversation

@Haihan-Jiang

Copy link
Copy Markdown
Contributor

Fixes #2066

What changed

  • Delay opening the destination tarball in crane export until after the source image has been loaded successfully.
  • Add a command-level regression test using a local 404 registry to verify failed pulls do not create the destination tar file.

Why

crane export IMAGE out.tar previously created/truncated out.tar before pulling IMAGE. If the pull failed, an empty or partial destination file could still be left behind.

Validation

  • go test ./cmd/crane/cmd
  • go test ./cmd/crane/...
  • git diff --check

@Haihan-Jiang
Haihan-Jiang marked this pull request as ready for review May 24, 2026 08:41
@Haihan-Jiang

Copy link
Copy Markdown
Contributor Author

This is ready for review from my side. Could someone take a look when convenient?

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.02%. Comparing base (7f937fe) to head (fc960df).

Files with missing lines Patch % Lines
cmd/crane/cmd/export.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2318      +/-   ##
==========================================
+ Coverage   56.94%   57.02%   +0.07%     
==========================================
  Files         166      166              
  Lines       11398    11398              
==========================================
+ Hits         6491     6500       +9     
+ Misses       4140     4131       -9     
  Partials      767      767              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Subserial
Subserial merged commit 06ee049 into google:main Jun 2, 2026
21 checks passed
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.

crane export creates tar even on failure

3 participants