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
• 14,080 points
61 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 35,750 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,520 points
153 views
+1 vote
2 answers

Unable to build TFS project because files not found

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

answered 5 days ago in Other DevOps Questions by Shashikesh Mishra
219 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,120 points
105 views
+13 votes
2 answers
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
32 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
• 35,750 points
221 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.