Skip to content

optimize checking for current digest#1665

Merged
pkwarren merged 2 commits intomainfrom
pkw/check-current-digest-first
Dec 12, 2022
Merged

optimize checking for current digest#1665
pkwarren merged 2 commits intomainfrom
pkw/check-current-digest-first

Conversation

@pkwarren
Copy link
Member

@pkwarren pkwarren commented Dec 9, 2022

If the current digest has the same image ID as the image to push, we can greatly speed up looking through every tag (which may contain multiple duplicates - potentially one per version/revision of a plugin). This should greatly speed up the lookup in the case where the plugin already exists on the OCI registry.

If the current digest has the same image ID as the image to push, we can
greatly speed up looking through every tag (which may contain multiple
duplicates - potentially one per version/revision of a plugin). This
should greatly speed up the lookup in the case where the plugin already
exists on the OCI registry.
@pkwarren pkwarren requested a review from mfridman December 9, 2022 23:50
auth := &authn.Basic{Username: authConfig.Username, Password: authConfig.Password}
tags, err := remote.List(repo, remote.WithContext(ctx), remote.WithAuth(auth))
remoteOpts := []remote.Option{remote.WithContext(ctx), remote.WithAuth(auth)}
// First attempt to see if the current image digest matches the image ID
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a lot faster in the case of the image already existing in the BSR with the same digest as before. It only has to check one digest (the current one) and not potentially search through dozens of tags.

@pkwarren pkwarren merged commit 8985c1b into main Dec 12, 2022
@pkwarren pkwarren deleted the pkw/check-current-digest-first branch December 12, 2022 16:59
Monirul1 pushed a commit to Monirul1/buf that referenced this pull request Apr 30, 2023
If the current digest has the same image ID as the image to push, we can
greatly speed up looking through every tag (which may contain multiple
duplicates - potentially one per version/revision of a plugin). This
should greatly speed up the lookup in the case where the plugin already
exists on the OCI registry.
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.

2 participants