Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help wanted: 2.2 retag via api #14954

Closed
zigmund opened this issue May 24, 2021 · 6 comments
Closed

Help wanted: 2.2 retag via api #14954

zigmund opened this issue May 24, 2021 · 6 comments
Labels

Comments

@zigmund
Copy link

zigmund commented May 24, 2021

/help wanted

Need to retag image with overwrite - latest, for example.

Of course I can do docker pull registry/proj/repo:source && docker tag registry/proj/repo:source registry/proj/repo:latest && docker push registry/proj/repo:latest, but want to avoid needless traffic.

According to docs (https://goharbor.io/docs/2.2.0/working-with-projects/working-with-images/retagging-images/), I should use copy. Docs says: In the Retag window, enter the project name, repository name, the new tag name, and click Confirm. But web ui forbids to set :tag to destination repo field. Also, according to api swagger, seems it's not possible.

I tried to use create tag api call, but got CONFLICT and cannot see in swagger any param to overwrite tag.
Also tried to delete destination tag at first and then create tag with api. It works, but since we have event-based replication, there is race condition sometimes (create replicated first and delete goes after) and we have inconsistent remote registry.

So what is best atomic way to retag image with overwrite without pull / tag / push?

@zigmund
Copy link
Author

zigmund commented May 24, 2021

Same issue was resolved two years ago in v1 api but it is unavailable in Harbor v2.
#5778

@stonezdj
Copy link
Contributor

You should make sure you have permission to the target project.

@zigmund
Copy link
Author

zigmund commented May 24, 2021

@stonezdj I have permissions, doing it under admin account.
Problem in v2 api. There are two routes in api for such operations:

  1. artifact/CopyArtifact - doesn't allow to specify destinations tag.
  2. artifact/createTag - doesn't allow to overwrite existing tag.

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Apr 17, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.

@github-actions github-actions bot closed this as completed Jul 6, 2022
@Yingrjimsch
Copy link

Hi is there progress or is it possible to implement this feature?
My workaround for now is deleting the tag via API and then resetting it on another digest.
Would be great if that could be done in one step 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants