Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to publish artifacts separately for each project in solution from VSTS CI pipeline?

In my solution, I have two projects (a Asp.net MVC and a Windows Service). I want to create CI/CD pipeline to deploy web application and windows service on different VMs. But to achieve this my CI pipeline should be able to publish artifacts separately for both project and then I can feed these artifacts in CD pipeline for deployment. How artifacts for all projects can be published separately in a CI pipeline ?

PS: If I create two solutions each with one project only and create CI/CD pipeline separately, all works fine. But I want to achieve it with solution having multiple project as mentioned above.

like image 997
DevX Avatar asked Dec 16 '17 00:12

DevX


People also ask

How do you publish Artifacts in release pipeline?

Publishing pipeline artifacts is not supported in release pipelines. The publish keyword is a shortcut for the Publish Pipeline Artifact task . targetPath: the path to the folder or file you want to publish. artifactName: the name of the artifact that you want to create.

How can Artifacts be configured in a pipeline?

To set up this configuration, go to the Configuration screen for a pipeline (Pipeline B) and add an automated trigger of type Pipeline pointing to another pipeline (Pipeline A). Whenever Pipeline A completes, it will trigger a run of Pipeline B, and Pipeline B will have access to all artifacts from Pipeline A.

Can we link multiple Artifacts with one release definition?

A single release pipeline can be linked to multiple artifact sources, of which one is the primary source. In this case, when you create a release, you specify individual versions for each of these sources.


1 Answers

You can use multiple, Publish tasks to create multiple artifacts in a single build definition.

For example lets say, you have below, as your current artifacts for a single project, comprising of _PublishedWebsites\MVS5WebApp (XCopy deployable website) and _PublishedWebsites\MVS5WebApp_Package (web deploy package).

Current Artifact

If you want to separate these two, into two artifacts, you can use two Publish Artifact tasks as shown below, each one specifying exact path to publish (this path does not support wildcards, you just have to specify the folder you need to publish) Publish website XCopy deploy content

Publish Web Deploy Package

This will give you output as shown below. Two Artifacts

In this example I just only used the Publish Artifacts task and created two artifacts using a single web site project. You can do same for your two project scenario. If you want to use wild card to filter more files before publish you can use "Copy File" task multiple times as required.

like image 75
ChamindaC Avatar answered Nov 13 '22 09:11

ChamindaC