-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet publish: AfterTargets="AfterPublish" triggers before publish is complete #46999
Comments
I'd need to take a look at a binlog to double-check, but my first recommendation would be the PublishContainer target - that's the target that actually creates + pushes container images to the desired destination, whether that's local daemon, tarball, or remote registry. |
@baronfel Thanks I'll try that now - out of interest where can someone read about all the different "AfterTargets" options? I promise I did try searching myself! |
@baronfel I just tried this, but the commands never executed
|
Is there any way you can get an https://aka.ms/binlog and use the viewer to take a look? I added a target just like yours to a sample project I had, and then published that project with |
@baronfel thanks are you able to interpret this for me? Could the issue be that this publish is occuring within a docker container and so my pubxml commands aren't being triggered? |
Where is this DockerBuild target coming from? I'm not familiar with it at all. |
@baronfel I am just using the right-click Publish to Azure Container Registry feature that Visual Studio suggests |
Here is what I see in the output window, notice how the kubectl command is triggered, the publish "completes" but the actual push to ACR does not occur until after the publish is complete?
|
It's going to be very hard to help you because VS right click publish behaves significantly differently than CLI publish. I would strongly recommend using the CLI to publish directly as much as possible, because that's where we have the best ability to inspect and reproduce your scenarios. In the editor, VS sequences the Publish and the PublishContainer operations separately, and I think the screenshot you showed a bit ago is from the former - I don't see the SDK Container publish call at all. |
@baronfel developers would prefer to publish from within the IDE - do I need to log this somewhere else? Do you know where? |
@anvillan could you help me with some insight into how the VS container publish works/is triggered? Is is possible to get binlogs for the actual PublishContainer step? |
Not sure if its useful but here are all the binlogs VS generated for me doing various publishes via right-click publish... https://filebin.net/1qqoq7nxbm7b4exw |
I just ran a .NET SDK Container publish process to |
I don't really know how to interpret this, but to me it seems like the publish is doing what its supposed to, so perhaps it is rather that the container push (which presumeably is being performed by docker desktop?) is occuring in another process and dotnet isnt waiting for the result of that process before continuing |
@catmanjan thanks for those binlogs - they were very helpful! Ok, so it's as I expected - your pubxml is using the VS Docker tools to do publishing, not the .NET SDK - your pubxml is using the |
Ok cool, should I leave this issue here or log one elsewhere?
…On Thu, 27 Feb 2025, 2:13 am Chet Husk, ***@***.***> wrote:
@catmanjan <https://github.com/catmanjan> thanks for those binlogs - they
were very helpful! Ok, so it's as I expected - your pubxml is using the VS
Docker tools to do publishing, not the .NET SDK - your pubxml is using the
ContainerRegistry PublishProvider and the Custom WebPublishMethod. The
expected way to trigger the .NET SDK container publishing is via the
Container WebPublishMethod. I feel like a lot of the confusion in this
issue is because of the mixing of these two related-but-separate deployment
methods. You are not using the SDK container publishing here, you're using
the Microsoft.Docker VS tools - those tools likely have some customization
that only push the container *after* the related Publish call occurs.
—
Reply to this email directly, view it on GitHub
<#46999 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABBRBUI6A45A7BGORXGM7L2RXK3LAVCNFSM6AAAAABXSC6GGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBVGM3DKNRYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: baronfel]*baronfel* left a comment (dotnet/sdk#46999)
<#46999 (comment)>
@catmanjan <https://github.com/catmanjan> thanks for those binlogs - they
were very helpful! Ok, so it's as I expected - your pubxml is using the VS
Docker tools to do publishing, not the .NET SDK - your pubxml is using the
ContainerRegistry PublishProvider and the Custom WebPublishMethod. The
expected way to trigger the .NET SDK container publishing is via the
Container WebPublishMethod. I feel like a lot of the confusion in this
issue is because of the mixing of these two related-but-separate deployment
methods. You are not using the SDK container publishing here, you're using
the Microsoft.Docker VS tools - those tools likely have some customization
that only push the container *after* the related Publish call occurs.
—
Reply to this email directly, view it on GitHub
<#46999 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABBRBUI6A45A7BGORXGM7L2RXK3LAVCNFSM6AAAAABXSC6GGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBVGM3DKNRYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I believe that you should log one in VS Developer Community for the Docker Tools team to investigate - that's how that team responses to user feedback. Sorry for the back-and-forth! |
Hello we have a project like many others publishing docker images to kubernetes.
To try to make developers life easier I added the following to my pubxml:
However, I notice the RestartPods target occurs before the image is fully published to my ACR, resulting in a race condition that sometimes Kubernetes beats, meaning the old image is deployed instead of the new...
What should my AfterTargets be set to if I want it to only run the rollout commands after the container is fully published to ACR?
The text was updated successfully, but these errors were encountered: