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
• 18,570 points
629 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
• 52,360 points

Related Questions In Other DevOps Questions

+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,520 views
+2 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
1,444 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
• 52,360 points
3,348 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP