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

Unable to push an image to a repository with multiple image tags #412

Open
amammes opened this issue Jan 23, 2024 · 4 comments
Open

Unable to push an image to a repository with multiple image tags #412

amammes opened this issue Jan 23, 2024 · 4 comments

Comments

@amammes
Copy link

amammes commented Jan 23, 2024

My app is C# Asp.Net 8.0.1 - VS2022 Version 17.9.0 Preview 3.0.

I would like to publish my image with multiple tags using a single pubxml, for example:

projectname:1
projectname:1.2
projectname:1.2.3
projectname:latest
projectname:{{last_git_commit_sha}}

Among several tests, I tried putting this in the pubxml, but only the last tag is used.

<PublishImageTag>1</PublishImageTag>  
<PublishImageTag>1.2</PublishImageTag>  
<PublishImageTag>1.2.3</PublishImageTag>  

I believe this requires calling docker tag and docker push in a loop, once for each tag. Been trying to figure out a way to do this for a couple of days. Is there a way to do this directly from csproj, pubxml, and/or Dockerfile? Thanks

@amammes amammes changed the title How to push an image to a repository with multiple image tags Unable to push an image to a repository with multiple image tags Jan 23, 2024
@dbreshears
Copy link
Member

I don't believe there is any way to handle this currently in csproj, pubxml, and/or Dockerfile. I would recommend to log a suggestion for this at https://developercommunity.visualstudio.com/VisualStudio/suggest and it will get routed to the team that owns Publish.

@amammes
Copy link
Author

amammes commented Jan 24, 2024

Is there a way to do this directly from csproj, pubxml, and/or Dockerfile?

That suggestion page does not work. Whatever I do, after clicking submit it says "Unexpected error" "Sign-in required. Please sign-in again and retry.". But I AM signed in with my Microsoft account. I tried from Chrome, Chrome incognito and Edge, all fail the same way

@dbreshears
Copy link
Member

Unfortanate timing, I think there may have been an outage. Feel free to try again later, however I opened a suggestion directly on the internal backlog with a link to this.

@NCarlsonMSFT
Copy link
Member

@amammes I did some digging: while the publish experience in VS does not have support for this, if you are willing to use the new container image publish feature in the .NET SDK they do provide a property for specifying multiple image tags ContainerImageTags.

Note: Support for debugging SDK published containers is only in 17.9+ which is still in Preview.
Note2: I tested how our debugging support handles the ContainerImageTags property and found it caused a conflict. but you can work-around it with a condition:
<ContainerImageTags Condition="'$(ContainerImageTag)' == ''">tag1;tag2</ContainerImageTags>

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

No branches or pull requests

3 participants