Type: Bug
Affected Tasks: PublishBuildArtifacts@1 and AzureCLI@1
Tasks fail with:
##[error]Unhandled: ENOENT: no such file or directory, open '/__w/.taskkey'
##[section]Starting: Push Performance Data
==============================================================================
Task : Azure CLI
Description : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
Version : 1.155.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
##[error]Unhandled: ENOENT: no such file or directory, open '/__w/.taskkey'
##[section]Finishing: Push Performance Data
##[section]Starting: Publish cimetrics graphs as build artifact
==============================================================================
Task : Publish build artifacts
Description : Publish build artifacts to Azure Pipelines or a Windows file share
Version : 1.151.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/publish-build-artifacts
==============================================================================
##[error]Unhandled: ENOENT: no such file or directory, open '/__w/.taskkey'
##[section]Finishing: Publish cimetrics graphs as build artifact
The problem is caused by the lack of a __w directory under the container. It is solved by mounting the agent workspace manually:
container:
image: ccfciteam/ccf-ci-18.04-oe-0.6-sgx:latest
options: -v /mnt/build:/__w/
Since .taskkey is already mounted by default during container initialisation, I believe the steps need to be adjusted to use that rather than rely on /__w. Alternatively, mounting /__w should happen automatically when using a container.
Apologies looks like completing #11203 automatically closed this issue. The AzureCLI task still needs to be updated, so I'm reopening this
@joshmgross, thanks for following up, please let me know if I can help with testing or by providing additional information.
@achamayou Could you try using the updated PublishBuildArtifacts task from #11203 and see if that fixes your issue? I was unable to reproduce the issue on the Hosted Windows Container image.
You'll have to upload the task to your Azure DevOps account to get the updated version, let me know if you need assistance doing that.
@joshmgross I've not done that before, is it this process? https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
If so, that looks fairly involved, is there any way I can pick up build artifacts from #11203? I'm running this on custom agents, in case it helps (by which I mean I can easily drop files somewhere in the agent install).
@achamayou It's not as difficult as the linked documentation, as these are tasked that are shipped with the service (so no extension required). Unfortunately, the setup isn't as easy as dropping files.
You can download the updated task here: PublishBuildArtifactsV1.zip but I'll provide instructions below for building the task yourself.
Using the Attached Zip of the Task
Pre-Reqs:
Agent Pools - Read & Manage permissionsSteps:
tfx login -u [ORG URL] -t [PAT] - Replacing [ORG URL] with your Azure DevOps organization URL (ex. https://dev.azure.com/joshmgross) and [PAT] with the PAT you generated above tfx build tasks upload --task-path .\path\to\unzipped\task\PublishBuildArtifactsV1 - Replace with the path to the unzipped taskBuilding the Task Yourself
Pre-Reqs:
Agent Pools - Read & Manage permissionsSteps - In the directory where you cloned the tasks repository:
npm install - This will install all the dependencies for the tasksnode make.js build --task PublishBuildArtifactsV1 - Build the updated tasktfx login -u [ORG URL] -t [PAT] - Replacing [ORG URL] with your Azure DevOps organization URL (ex. https://dev.azure.com/joshmgross) and [PAT] with the PAT you generated above tfx build tasks upload --task-path .\_build\Tasks\PublishBuildArtifactsV1\ - Publish the task built from the _build directoryThat's it! When running your build, your task should show the new version (1.158)
at the top of the logs
@joshmgross Thank you, I鈥檝e installed the build of the extension you linked and I can confirm that it fixes the problem for us: https://dev.azure.com/MSRC-CCF/CCF/_build/results?buildId=582
@joshmgross Is it safe to assume that when PublishBuildArtifactsV1 1.159 and later are released, my agents will pick them up automatically, or will I need to tfs build tasks delete the copy of PublishBuildArtifactsV1 I have now?
In any case, thank you for the super quick fix, it's much appreciated!
@achamayou Yes that is correct, your deployment will pick up the next latest version once it's released (could be 1.158.1 if we update it again this week).
@joshmgross excellent! :)
Hey @achamayou,
We have fixed the AzureCLI task. Here is the update package. Please try it out and let us know the feedback.
@vineetmimrot it works great: https://dev.azure.com/MSRC-CCF/CCF/_build/results?buildId=657
I've removed the workaround we had now, thank you for getting this fixed so quickly!
Closing this issue as both tasks are fixed.
Most helpful comment
@joshmgross Thank you, I鈥檝e installed the build of the extension you linked and I can confirm that it fixes the problem for us: https://dev.azure.com/MSRC-CCF/CCF/_build/results?buildId=582