microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.72k stars 867 forks source link

[BUG]: "Object reference not set to an instance of an object" error throwing by DownloadSecureFile task #4962

Open mauriciomutte opened 2 months ago

mauriciomutte commented 2 months ago

What happened?

All pipelines that use the DownloadSecureFile task are failing with the error “Object reference not defined for an instance of an object” during the "Initialize job" step.

What did you do?

Upon noticing the issue, I investigated the error logs and identified that the problem consistently occurs during the "Initialize job" step whenever the DownloadSecureFile task is executed. I ran the pipeline in debug mode and extracted logs to gain more detailed insights into the failure (see it in "Relevant log output" section). I also reviewed recent changes to the pipeline configurations and dependencies that might have introduced this issue.

We did a test by removing the “DownloadSecureFile@1” step from the pipeline and the error didn't happen

What did you expect to happen?

I expected the pipeline to execute smoothly, with the DownloadSecureFile task successfully downloading the necessary secure files and proceeding to the subsequent steps without encountering any errors.

Versions

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

No response

Version controll system

No response

Relevant log output

Prepare build directory.
##[debug]Creating build directory: '/home/vsts/work/1'
##[debug]Delete existing artifacts directory: '/home/vsts/work/1/a'
##[debug]Creating artifacts directory: '/home/vsts/work/1/a'
##[debug]Delete existing test results directory: '/home/vsts/work/1/TestResults'
##[debug]Creating test results directory: '/home/vsts/work/1/TestResults'
##[debug]Creating binaries directory: '/home/vsts/work/1/b'
##[debug]Creating source directory: '/home/vsts/work/1/s'
Set build variables.
Download all required tasks.
Downloading task: NodeTool (0.235.1)
##[debug]Task 'NodeTool' has been downloaded into '/home/vsts/work/_tasks/NodeTool_31c75bbb-bcdf-4706-8d7c-4da6a1959bc2/0.235.1'.
Downloading task: CmdLine (2.244.3)
##[debug]Task 'CmdLine' has been downloaded into '/home/vsts/work/_tasks/CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce9/2.244.3'.
Downloading task: DownloadSecureFile (1.244.1)
##[debug]Task 'DownloadSecureFile' has been downloaded into '/home/vsts/work/_tasks/DownloadSecureFile_2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b/1.244.1'.
##[error]Object reference not set to an instance of an object.
##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskManager.CheckIfTaskNodeRunnerIsDeprecated(IExecutionContext executionContext, TaskStepDefinitionReference task) in /mnt/vss/_work/1/s/src/Agent.Worker/TaskManager.cs:line 382
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskManager.DownloadAsync(IExecutionContext executionContext, IEnumerable`1 steps) in /mnt/vss/_work/1/s/src/Agent.Worker/TaskManager.cs:line 100
   at Microsoft.VisualStudio.Services.Agent.Worker.JobExtension.InitializeJob(IExecutionContext jobContext, AgentJobRequestMessage message) in /mnt/vss/_work/1/s/src/Agent.Worker/JobExtension.cs:line 140
Finishing: Initialize job
phmonte commented 2 months ago

I believe it may have something to do with this implementation here

The download task does not have the "execution" field, DownloadSecureFileTask

willianantunes commented 2 months ago

It seems this PR solves it.

juucustodio commented 2 months ago

I have the same problem in all my Azure DevOps Pipelines

jonathanpaul25 commented 2 months ago

I have the same problem in all my Azure Devops Pipelines.

neemias-carvalho-movti commented 2 months ago

I have the same problem in all my Azure Devops Pipelines.

mmrazik commented 2 months ago

Sorry for the regression. We are working on a fix.

mmrazik commented 2 months ago

Thank you for great report! This helped us to identify this quickly. We rolled back a feature flag which is bypassing this faulty code path and it should be mitigated for all of you (I was able to repro and verify the fix in my pipeline). We will do a proper fix and some repair items.

willianantunes commented 2 months ago

@mmrazik why do we use fixed versions of all components in Azure DevOps if they can be broken by a change? Why Microsoft does not respect Semantic Versioning? Unacceptable. We had to waste a bunch of time replacing DownloadSecureFile with an in-house solution. Who will pay for it?

We are considering moving all pipelines to another plataform.

willianantunes commented 2 months ago

I thought it was new, but I found the following issue:

Unbelievable.

ricardochaves commented 2 months ago

A system maintained by Microsoft generates a very high expectation of high quality in those who buy this system. This is not the first time that things stop working like this. This latest problem shows that you do not have tests to guarantee quality. You do not guarantee versioning.

I am curious to know what "production ready" means in the Azure Devops team.

I am seriously questioning why we are using this product here, tests with other competitors will begin in the company.