-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Artifacts do not download on multi stage yaml build using DownloadPipelineArtifactV2 #11267
Comments
I'm seeing what I can only imagine is the same problem. - download: current
displayName: 'Download Scripts'
artifact: Topic
patterns: '@(SetBranchName|StopAppPool).ps1' In this case the new version of This seems like a fairly serious problem if older files could be run or referenced by newer builds. Logs:
|
@giggio I cannot repro the issue you mentioned. In my pipeline, I have stage 1 with build and pipeline artifacts published, in the stage 2, I have another build and pipeline artifact published and in the stage 3, I have a download pipeline artifact V2 task and it will download both build artifacts and pipeline artifacts if the multi-download mode is selected. Can you please let me know if you're still seeing the same issue after the dependencies are specified? |
I've been experiencing this problem today as well. If an artifact has previously been downloaded by the agent, it is used in the subsequent stages instead of the latest being downloaded. Even though when you view the artifact in Azure DevOps, it shows the files as they should be. In my case, I had renamed 2 files. The artifact in Azure DevOps looked ok, with the 2 new filenames being present, but when the job was running, it was using the older artifact version with the 2 old filenames. The solution for me was to log into each agent's work folder and delete the cached version. I'm using the download keyword as part of a deployment job, and not the task.
This happened irrespective of whether or not I created a new Release. |
@giggio Are you still seeing the issue after adding dependencies? If so, can you please provide your sample build def/yaml schema? @TabithaLarkin @giggio |
@GarethOates I don't think I fully understand the scenario you described. Can you please provide a sample build definition/ yaml schema of the issue you ran into? |
Sorry, I should have been a bit clearer about what my particular scenario is with regards to the 'build' and 'deploy' steps.
I have a git repo which contains a collection of .docx and .pdf files. The yaml file I have here describes the process by which we upload those documents to our different SharePoint environments, using a simple Powershell script. This script loops over each .docx or .pdf file in the pipeline artifact directory and attempts to upload that file to SharePoint. What I noticed when I updated the git repository to either include new files, or rename existing files, was that in deploy stages of my pipeline, the list of files being looped over and uploaded did not reflect the latest changes made to the repository, but instead was looping over an out of date collection of files. I discovered that what was happening was, the 'download' task was not downloading the latest pipeline artifact produced in the previous stage, but was instead using a previously downloaded (and now old) cached version of the artifact. So when my script was looping round all the files in the directory, those that were changed, added or renamed were not being included in this process. I worked around this, by connecting to each agent and deleting the 'documents' artifact from the working directory. This then forced the download step to fetch the latest version of the documents artifact, which contained the correct files. |
@GarethOates Thanks for the additional info. Can you please try adding dependsOn input field in the yaml schema and assign the stage name it's dependent on to the value and see if it works?
For reference: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema |
I'm afraid that didn't fix the problem. From the task output in Azure DevOps: But when I remote onto the on-premise agent's server and look at C:_work\6\documents, the Date modified of the 'documents' directory is 06.12.2019, the last time the build was run, not today's date. So it's using the old 'documents' artifact from the previous build, not the latest one published by the BUILD stage of my pipeline. if I delete that directory, it will then fetch the latest one from the newest most recent build, and the task will succeed. |
@GarethOates Thanks for the updates. I think that goes back to the scenario where old artifacts are not being deleted in the agent. In the DPA V2 task, the default download directory is working directory and by design, it won't get cleaned up when running a new build In the meantime, we will evaluate to see if it makes sense to set the default download directory to some folder that gets cleaned at the beginning of each run. |
Ok, so does that mean I can’t use the shortcut version of those tasks like - download: current and must instead define the tasks fully, specifying the directory myself? If so, I’ll do that. It might make sense to mention this caveat (if you can call it that) in the docs somewhere. I’ll have a go at updating them and submitting a PR tomorrow CET, unless you beat me to it, or don’t agree that it needs mentioning. 😊 |
@GarethOates Sorry for the inconvenience. Fro the download keyword, unfortunately the target input field is currently not exposed but it should have the capability for users to specify a custom download directory very soon. |
The issue should be resolved after adding dependent stages and regarding the default download directory not being cleaned up, it's currently by design. I'm closing the ticket for now and we can reopen it if you are still seeing the issue. |
It was resolved by switching to using the DownloadPipelineArtifact task instead of the download keyword. Setting dependent stages did not resolve the issue, however I have been able to work around it. |
@fadnavistanmay who will be looking into PA related issues. If this is download keyword related, the RM team can help look into it. |
If the solution is using the "DownloadPipelineArtifact task instead of the download keyword" then @microsoft you need to update your docs - this is driving folks crazy. |
Required Information
Question, Bug, or Feature?
Type: Bug
Enter Task Name:
DownloadPipelineArtifactV2
Environment
Server - Azure Pipelines
lambda3
sdk
template
12494
Agent - Hosted:
Default
2.155.1
Issue Description
When you try to download the artifacts on a multi stage build definition using the
DownloadPipelineArtifactV2
task it will only download the artifacts from the first stage. In my scenario I have 3 stages, and I product the artifacts on the second stage, while the first stage only has a code coverage artifact. What I've seen is that the code coverage artifacts (1st stage) download, while the ones from the 2nd stage don't.Note: I am using a self hosted agent, and I noted that the artifacts were not being removed between each build, which created problems, as leftover artifacts from previous builds were still around. So, I had the idea of downloading the artifacts to the
Agent.TempDirectory
, so it would be removed for sure.This was all on a deployment stage.
If you let the download happen naturally, it will download all the artifacts, the problem only happens when you use the
DownloadPipelineArtifactV2
task directly.I also noticed that the Build Summary shows no artifacts for the second stage, it only shows one artifact for the 1st stage. But the artifacts tab does show all 3 artifacts.
Task logs
These are the partial logs for the download of the last two artifacts, named
vsix
andnupkg
:The text was updated successfully, but these errors were encountered: