Start vNext build from Powershell and get artefacts

0 votes

In order to automate our deployments, I would like to rebuild an application, based on a given ChangeSetId. Once this build has completed, I want to get the artefacts of the build (the .exe), so we can deploy them.

For DevOps purposes, I'd like to use PowerShell

I've set up Builds in our On Premise TFS 2015 server (which are working neatly) - and added a VSO task 'Publish artefacts’ after this build. So far so good. The published artefacts is are to be stored on the Server, which basically means I have to download the artefacts connected to build - every existing build will have its artifacts linked - which is better than an UNC drop in my book.

Jul 5, 2018 in Other DevOps Questions by Hannah
• 15,340 points
88 views

1 answer to this question.

0 votes

TFS 2015 comes with the new REST API, and it includes the method to get the artefacts of the specific build. I would approach your challenge in the following way:

  • Add a "PowerShell script" build step after your "Publish artefacts" step
  • In that PowerShell script:
    • Get the ID of the current build. TFS exposes a number of predefined variables, and build ID is there. All those variables end up as environment variable, and this postcan help you read the appropriate one from your PowerShell script
    • Next, make a web request to get build artifacts. As you can see from the API description, you'll have to provide just the build ID
    • Then, parse the JSON response - the downloadUrl property contains the link to download all the artefacts of the build zipped as a single archive
    • Finally, extract the archive and pick up those artefacts you need. Perhaps, you'd like to deploy it to your testing environment in this step as well
answered Jul 5, 2018 by Kalgi
• 41,590 points

Related Questions In Other DevOps Questions

0 votes
1 answer

How to get issues count based on rules in a sonar project?

There are API docs in the footer ...READ MORE

answered May 4, 2018 in Other DevOps Questions by DareDev
• 6,810 points
379 views
+1 vote
2 answers

Unable to build TFS project because files not found

Please make a folder in solution Nd ...READ MORE

answered May 16 in Other DevOps Questions by Shashikesh Mishra
580 views
+1 vote
2 answers

When do we use Chef or Azure SDK to create VM and deploy in automation

The solution to the automated deployment in ...READ MORE

answered Aug 21, 2018 in Other DevOps Questions by Priyaj
• 56,900 points
143 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
179 views
0 votes
1 answer
+3 votes
6 answers

Devops and security

By using tools that are shared across the ...READ MORE

answered Oct 23, 2018 in Other DevOps Questions by Anvit
81 views
0 votes
1 answer

Unable to Pull image from quay.io: ERROR x509: certificate signed by unknown authority

Download necessary CA certificate. "/etc/ssl/certs/ca-certificates.crt", -> Debian/Ubuntu "/etc/pki/tls/certs/ca-bundle.crt", ...READ MORE

answered Jul 3, 2018 in Other DevOps Questions by Kalgi
• 41,590 points
663 views