Skip to content

fix: ignore error of manifest tag path not found in gc - #4331

Merged
squizzi merged 1 commit into
distribution:mainfrom
microyahoo:gc
Apr 25, 2024
Merged

squizzi merged 1 commit into
distribution:mainfrom
microyahoo:gc

Conversation

@microyahoo

Copy link
Copy Markdown
Contributor

it is reasonable to ignore the error that the manifest tag path does not exist when querying all tags of the specified repository when executing gc.

Signed-off-by: Liang Zheng [email protected]

@squizzi squizzi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel you could add a test for this that tests that GC does not error on an unknown repository, something like:

func TestGCWithUnknownRepository(t *testing.T) {
	d := inmemory.New()

	registry := createRegistry(t, d)
	repo := makeRepository(t, registry, "nonexistentrepo")
	uploadRandomSchema2Image(t, repo)

	err := MarkAndSweep(dcontext.Background(), d, registry, GCOpts{
		DryRun:         false,
		RemoveUntagged: true,
	})
	if err != nil {
		t.Fatalf("got error: %v, expected nil", err)
	}
}

Passes with this addition but fails without it.

Comment thread registry/storage/garbagecollect.go Resolved
Comment thread registry/storage/garbagecollect.go Resolved
@squizzi
squizzi requested review from Jamstah and milosgajdos April 22, 2024 22:48
@microyahoo

Copy link
Copy Markdown
Contributor Author

hi @squizzi, seems PR #4285 has already coverred this scenario.

@squizzi

squizzi commented Apr 23, 2024

Copy link
Copy Markdown
Collaborator

@microyahoo ya, it does.. I like your addition of having emit log when the repository is skipped. Perhaps rebase and add that one line change?

@squizzi

squizzi commented Apr 24, 2024

Copy link
Copy Markdown
Collaborator

@microyahoo good catch on the ManifestUnknownRevision error in the other PR, it seems yours is back on the table, let's get a test added for this, rebase and move forward with it.

@milosgajdos

Copy link
Copy Markdown
Member

@microyahoo there is a merge conflict now that needs fixing 😬

@microyahoo

Copy link
Copy Markdown
Contributor Author

@microyahoo there is a merge conflict now that needs fixing 😬

hi @milosgajdos, thanks for you kindly reminder, I will fix it ASAP.

it is reasonable to ignore the error that the manifest tag path does not exist when querying
all tags of the specified repository when executing gc.

Signed-off-by: Liang Zheng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants