Closed onarres closed 1 year ago
Same issue here.
Is there a dev guide to help the community to produce fix to these bugs?
My team moved a Dockerfile from where it was expected. We forgot to update the azure_pipelines.yaml file and I was surprised that CI passed without a Dockerfile. Some teams rely on CI to tell them when something broke. Telling that CI is green when it surely failed is not good.
Ran into the same issue today on a Microsoft hosted agent within one of my CD pipelines which goes on to deploy the container image to Azure Container Apps.
==============================================================================
Task : Docker
Description : Build or push Docker images, login or logout, start or stop containers, or run a Docker command
Version : 2.212.1
Author : Microsoft Corporation
Help : https://aka.ms/azpipes-docker-tsg
==============================================================================
(node:1547) UnhandledPromiseRejectionWarning: Error: No Dockerfile matching /home/vsts/work/1/s/HMI.Tooling.FileRepository.Frontend/HMI.Tooling.FileRepository.Frontend/Dockerfile was found.
at Object.run (/home/vsts/work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.212.1/dockerbuild.js:15:15)
at Object.run (/home/vsts/work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.212.1/dockerbuildandpush.js:13:31)
at getToken.then (/home/vsts/work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.212.1/docker.js:72:27)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
(node:1547) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1547) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Because of this silent error my deployment goes ahead and I deploy a new revision to Azure Container Apps which also does not give me any error log, therefore one would assume the deployment was successful. However, the application cannot be reached and when looking in the Azure portal one can see that the container app just stays in Provisioning status forever (no errors here as well). Only when I looked into my container registry and did not find the image I was trying to push I got back to the pipeline and saw that there was indeed an error.
What I am trying to say, this clearly is an error which should be reported as such and cause the pipeline to fail, because in subsequent steps this might also not cause an issue and leave you with a failing deployment without you noticing.
Nevertheless, the fix is obviously quite easy. Adjust the path or if you are in a deployment job within your pipeline checkout the repo source code first which was the error in my case.
On the bright side: With a new Node version which will exit with an non-zero exit code on Promise
rejection this bug will fix itself ;)
Does anybody found a solution for this?
Same here. I just held a workshop for a customer regarding Docker and Azure with DevOps Pipelines and this error was only logged as a warning and didn't stop the pipeline.
A solution would be greatly appreciated.
Btw. agent is self-hosted.
Having same issue with Docker@2 task. As stated, if the dotnet build fails within the Docker@2, the overall pipeline does not fail. Which for us, we build unit tests assemblies from Docker@2 task. When the builds fail in Docker@2, the unit tests are never executed and the pipeline continues. We have to put in some hacky powershell to detect when the build fails as part of the Docker@2 task. We are setting the continueOnError attribute of the Docker@2 task to false. Seems like that attribute is not properly implemented or honored in Docker@2.
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
So there is no workaround?
Question, Bug, or Feature?
Type: Bug
Enter Task Name: Docker@2
list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks
Environment
Server - Azure Pipelines or TFS on-premises?
Agent - Hosted or Private:
Issue Description
[Include task name(s), screenshots and any other relevant details] When an invalid docker name is passed to the Docker@2 for just building the image but not publishing too, we will see an error in the logs but the task does not appear to error (no stop on standard error flag available) and so the build appears as a false positive.
Example inputs:
It would be better if the Task failed because the docker command failed.
Task logs