Download Build Artifacts in vsts not able to get latest build of a specific build definition - azure-pipelines-build-task

I am using the download artifact plugin in VSTS to get the specific artifact of different build def using the current build definition.I am unable to download the artifact to my local agent (I installed private agent).
Error below is throwing:
[‎12-‎01-‎2018 PM 01:30] Shwetha Rattihalli:
2018-01-11T07:23:53.7178634Z ##[section]Starting: Download Build Artifacts
2018-01-11T07:23:53.7385942Z ==============================================================================
2018-01-11T07:23:53.7386234Z Task : Download Build Artifacts
2018-01-11T07:23:53.7386451Z Description : Download Build Artifacts
2018-01-11T07:23:53.7386670Z Version : 0.127.5
2018-01-11T07:23:53.7386874Z Author : Microsoft Corporation
2018-01-11T07:23:53.7387214Z Help :
2018-01-11T07:23:53.7387484Z ==============================================================================
2018-01-11T07:23:55.4791903Z ##[error]Build with id NaN not found for build definition id 6
2018-01-11T07:23:55.4807213Z ##[section]Finishing: Download Build Artifacts
!

For the Download Build Artifacts task, you need to specify the build manually since the task has no such settings to "get Latest artifacts" for now. And you can also follow up the issue Download Build Artifacts (Preview) not able to get latest build of a specific build definition.
If you want to get the latest build artifacts for a build definition, you can use the Fetch Build Artifacts task instead.
This task can get the latest build artifacts from the specified build definition:
Note: you should Enable Allow scripts to access OAuth token in your agent phase.

Related

Where to save a reusable static jar to be used from an Azure DevOps pipeline?

I have an Azure DevOps pipeline
The pipeline has a "command line" task that runs a java command on a jar file
The jar file is a static one that represents a tool to be used in the build process.
The jar file is not created as part of the build pipeline. It's just a jar with one version and it doesn't change with each build
Where is the best place to save this jar file and how to download it to the agent during the build pipeline execution ?
Since the jar file is static one and not created as part of the build pipeline, you can save the jar file to Azure Artifacts Feed -> Universal Package.
To upload the jar file to Azure Artifacts Universal Package, you can use Universal Packages Task - Publish command in Pipeline or Azure CLI command: az artifacts universal publish (work in pipeline or local machine).
Then you can use the task: Universal Packages Task - Download command to download the Universal Package during the build pipeline execution.

Azure build pipeline (Power apps solution) run successfully but Artifact not displayed in Repo. but its displayed in pipeline artifact

Azure build pipeline run successfully but Artifact (folder and files) not displayed in Repo.
This is pipeline for Power apps solutions
I have mentioned the following paths for Solution export and import
Solution output file : $(Build.StagingDirectory)$(SolutionName)_Unmanaged.zip
Solution Input file : $(Build.StagingDirectory)$(SolutionName)_Unmanaged.zip
Target folder to unpack the solution : $(Build.StagingDirectory)$(SolutionName)\Unmanaged
target version : not given
I have bit doubt that these paths are created automatically
Publish to Artifact : $(Build.StagingDirectory)$(SolutionName)\Unmanaged
Build pipeline
Artifact published
Azure repo screenshot
Azure Pipeline will clone the Repo to the agent, changes are made on the agent environment and will not sync to Repo automatically.
If you want the Artifact display in Repo, you could add a PowerShell task after your build tasks in your pipeline to push the change the Target Repo:
git push https://{PAT}#dev.azure.com/{OrgName}/{ProjName}/_git/{RepoName}

Azure DevOps Release Pipelines have stopped not being able to download Artifacts

Our release pipelines stopped working as of this morning can no longer download Artifacts that were produced by the related build pipeline.
2021-06-21T05:42:23.2924212Z ##[section]Starting: Download artifact - _Dev
2021-06-21T05:42:24.1919023Z ==============================================================================
2021-06-21T05:42:24.1920480Z Task : Download build artifacts
2021-06-21T05:42:24.1921432Z Description : Download files that were saved as artifacts of a completed build
2021-06-21T05:42:24.1923297Z Version : 1.189.0
2021-06-21T05:42:24.1924185Z Author : Microsoft Corporation
2021-06-21T05:42:24.1925170Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/download-build-artifacts
2021-06-21T05:42:24.1927176Z ==============================================================================
2021-06-21T05:42:24.2958112Z ##[error]Value cannot be null. (Parameter 'DownloadBuildArtifacts (a433f589-fce1-4460-9ee6-44a624aeb1fb/1.189.0)')
The same build artifacts is gets download for other staged like dev in same release pipeline, but not working with QA stage.
What value cannot be null?
there is a built artifact there in the system I can see it and the release has a valid link to it.
The issue can be resolved by upgrading the version from 1.189.0 to 2.0.0
After upgrading the version if you still face the issue
try this
Open Download Pipeline Artifact
check the Destination Directory property
If it is reset to $(System.ArtifactsDirectory) change to the specific path which is given by you.
If not check if there is any data that should be cleared in the artifact directory folder.
Because the artifact directory should be empty before downloading.
You could refer the Thread which discussed on the similar related issue.
if you are using Self hosted agents refer the Thread to make changes

How to create a build pipeline for multi-module maven in Azure Devops

I have a multi-module maven project in azure repo:
Parent
----App
--POM.xml
----Core
--POM.xml
----API
--POM.xml
----ParentPOM.xml
When I tried to build App project in Azure, I am getting the following error: [ERROR] Failed to execute goal on the project: Could not resolve dependencies for project com.core:jar:1.0: Could not find artifact com.core:jar:1.0 in central (https://repo.maven.apache.org/maven2).
So I tried to create multiple tasks in the same azure build to package for each module (App, Core, API), which also gives the same result. Could someone please help me on how to build the multi-module project and get the App jar file.
The way I've done it:
with this command: install -pl (module name) -am
where the module name should be one of the submodules. If you want to build all of them then only go with install
I have found the solution for the multi-module maven dependency issue, First We need to build the parent pom.xml, then build the submodules as per hierarchical order. In between each module, add a task to copy and move the jar files to the staging directory. Here shared the image of my build steps. Please take a look and comment on any questions.
Please look into the DevOps configuration for reference

How to output npm build error log files from linux hosted agents in vsts?

Trying to use the Linux build agents on vsts to build an angular application. For some reason it fails on the agent and I would like to get the full details in the log files. Any examples on how to get that sent to the output from the hosted build agents in vsts using a vsts build task?
To get the log files from Hosted agent, you just need to add Copy Files task and Publish Build Artifacts task in your build definition. Detail steps as below:
Add Copy Files task after the task you failed
After the task you failed (as the failed log you showed), add Copy Files task with below settings:
Add Publish Build Artifacts task after Copy Files task
The Publish Build Artifacts task settings as below:
Queue the build agent again
After the build finished, download the build artifacts to get the log files:

Resources