Compile and reuse exe in Azure pipelines - azure-devops

In Azure DevOps, can I build a solution using the Visual studio Build task, publish the .exe file to the artifacts (or somewhere else, repo?) and then utilize that .exe file in another pipeline?
If so, to where and how should I publish it and then how do I reference it?
thanks

D.J. recommended possible solution, though I am using different approach with Universal Packages:
Once the binary is produced, the pipeline publishes it as Universal
Package to Artifact Feet
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/universal-packages?view=azure-devops&tabs=yaml#publish-a-universal-package
Any other pipeline in project or organization can reference the Artifact Feed and utilize
the binary as part of the job
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/universal-packages?view=azure-devops&tabs=yaml#download-a-universal-package
This solution requires more effort, since you have to create the Artifact Feed, but it is possible to use the published artifacts across projects within the organization. This is ideal when project produces libraries for integration. Other projects can reference the feed and use up-to-date libraries as part of their build.
Artifact feeds support Semantic Versioning. You can find more about Artifact Feeds in Azure DevOps here https://learn.microsoft.com/en-us/azure/devops/artifacts/concepts/feeds?view=azure-devops
It only depends on what are your specific requirements.

Yes this is possible. You can use pipeline-artifacts for a start. The artifacts will be associated with the pipline, you'll have a task for publishing at the end of the pipeline that creates the exe-file and downloading at the start of the other pipeline that re-uses that exe.
See this for reference -> https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=classic

Related

Azure Pipeline artifacts do not show under Storage

I have created a c++ pipeline where the output of the build pipeline is published to drop container. The structure is the following
drop/v1.0.0/Release/MyService.dll
drop/v1.1.0/Release/MyService.dll
drop/v1.1.0/Release/MyService.dll
My engineers will need to view drop folder and according to the version that needs to be manually deployed to a client the will download the dll file.
As far as I understand there is not any way to view them under Artifacts (what a shame). I go to the project settings under Storage but I cannot view them either there. Only place that I am able to find them is under the pipeline run and then I have to find in which version of the pipeline run a specific service version was produced. This is a maze. We have dozens of c++ projects and we have to keep track of which pipeline version run of each project matches the service version.
Is there any way to be able to access them like in a folder structure?
You could use Builds - List via rest API to get all the builds for a pipeline, then use : Artifacts - List rest API to get all the artifacts for a build. It will list all the download URL for artifacts, then you could download them together or choose the one you want to download.
Besides, you could use the publishLocation argument in publish build artifacts task to copy the artifacts to a file share (FilePath). And the file share must be accessible from the agent running the pipeline. In this way you could publish all your artifacts to the file share you want for better management.
In addition, you could also use Universal Package task to publish your artifacts to your feed for better review.

Is there an equivalent of GitHib releases in Azure DevOps?

Simply speaking, does Azure Devops have something that works very close to GitHub releases?
I would like to publish artifacts that are created during an Azure DevOps pipeline so that they be easily viewed and downloaded afterwards in a central location. The closest equivalent to what I'm looking for is how GitHub releases work, where there is a web page listing out all the versions of the repository and the assets that can be downloaded for each version.
It seems to me that published artifacts within Azure DevOps pipelines are always tied to the run of the pipeline, and there isn't an easy way to see one list of artifacts that have been created in a historical view like GitHub releases provides, but maybe I'm missing something.
Azure Artifacts does not meet my needs because it is tied to particular packaging formats and is meant to be used for developer tooling.
I would like to publish artifacts that are created during an Azure
DevOps pipeline so that they be easily viewed and downloaded
afterwards in a central location.
As a workaround ,you can switch Artifact publish location to A file share in Publish Pipeline Artifacts task then specify your network drive folder path.
Specifying the path to the file share where you want to copy the files. The path must be a fully-qualified path or a valid path relative to the root directory of your repository. Publishing artifacts from a Linux or macOS agent to a file share is not supported.
Besides, there should be no other built-in hosting, I am afraid that Azure Artifact is the closest to your needs. because it is tied to particular packaging formats you can consider using Universal Packages.

Pipeline artifacts in .NET client libraries for Azure DevOps Services (and TFS)

Originally posted on GitHub.
We are using .NET client libraries for Azure DevOps Services (and TFS) in some custom tools. BuildHttpClient.GetArtifactContentZipAsync does not work for the new pipeline artifacts. Which HttpClient do I use to download this type of artifacts?
Pipeline artifacts in .NET client libraries for Azure DevOps Services (and TFS)
I am afraid there is no such .NET client libraries for Pipeline artifacts.
As we could to know, the Pipeline artifacts:
Pipeline artifacts provide a way to share files between stages in a
pipeline or between different pipelines.
When we share the files between stages in a pipeline, it just like a "copy" inside in the pipeline, it is more like a copy instruction of windows. So, this operation does not have the client's libraries to implement it.
You could implicitly get related information from the document Keep in mind:
If you plan to consume the artifact from a job running on a different operating system or file system, you must ensure all file paths in the artifact are valid for the target environment. For example, a file name containing a \ or * character will typically
fail to download on Windows.
On the other hand, I have checked the source code for this azure-pipelines-tasks, there is also no source code to implement it here.
Hope this helps.

What is the difference between Build Artifact and Pipeline Artifact tasks?

In Azure DevOps, we have Download/Publish Build Artifact tasks and Download/Publish Pipeline Artifact tasks.
What is the difference between the build artifact tasks and the pipeline artifact tasks and when would we choose one over the other?
There is an issue about it in Azure DevOps GitHub and Microsoft answered:
Hey everyone - I'm from the Azure Artifacts team and we built the
Pipeline Artifacts feature that you've discovered in Azure Pipelines.
I'll address the most important comment around documentation - we've
got a whole new page coming out around Artifacts in Azure Pipelines
which lists out each artifact type that we support and what they are
for along with links to specific documentation. We think that should
answer most of your questions.
Because that is still being edited before we publish it I thought I
would give you the 30,000 foot view on the difference between Pipeline
Artifacts and Build Artifacts and also mention how Pipeline Artifacts
relate to Universal Packages.
Build Artifacts (published via the Publish Build Artifacts task) have
been in Azure DevOps for a long time and are the built-in artifact
storage mechanism for Azure Pipelines. Most builds that store
non-package artifacts today would likely use this task. The task can
push the content up to the server/cloud but can also copy the files to
a local file share.
Pipeline Artifacts (published using the Publish Pipeline Artifact task
are intended as the replacement for Build Artifacts. They are in
preview right now and there are a few more things we need to do to
reach parity. The benefit of Pipeline Artifacts is that they can
dramatically reduce the time it takes to upload and download large
artifacts. We do this be first checking whether the content that is
being uploaded exists in the service. We do this not just at the
per-file level but also at the sub-file level (in up to 128K chunks).
It can lead to really dramatic performance improvements.
Universal Packages - also in preview use the same storage/transfer
technology as Pipeline Artifacts. You would use Universal Packages
when you want to create an artifact with a life time independent of
the pipeline that created it. You can download Pipeline Artifacts
after a pipeline has completed via the artifacts UX - but if you want
something that really exists independent of pipeline you would go for
Universal Packages. There should be no performance difference between
the two.
Hopefully this helps. Feel free to ask any more questions and I'll
follow-up with answers.

VS402864: No artifact type found corresponding to id PipelineArtifact

I am using a Azure DevOps/VSTS release pipeline to deploy artifacts created during a build, but I am unable to explore the artifacts in the pipeline editor.
VS402864: No artifact type found corresponding to id PipelineArtifact.
Make sure that the artifact type extension is available and try again.
I am able to explore the artifact contents just fine on the build summary.
What am I doing wrong?
It looks like you're using the new (in preview) Pipeline Artifacts feature. Based on the dates of the discussion at the bottom of the Publish Pipeline Artifacts task documentation, I think there are still some defects to be worked through to get it out of preview.
I'd recommend you use Copy Files and Publish Build Artifacts until it comes out of preview.