How to build Start vNext from Powershell and fetch artifacts

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 artifacts of the build (the .exe), so we can deploy them. For the sake of the question I am focussing on the 'Get artifacts from build' part.

For DevOps purposes, I'd like to use PowerShell, since it should be able to access the TFS API libraries and because MS recommends using it.


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

No comes my challenge; how do I programmaticaly access these artifacts, step 3?

  1. Get Sources for ChangeSetId
  2. MSBuild application with given configuration
  3. Get build Artifacts using PowerShell
  4. Deploy to environment using Release Management (Powershell as well)
Oct 17, 2018 in Kubernetes by Nilesh
• 7,050 points

1 answer to this question.

0 votes

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

  • Add a "PowerShell script" build step after your "Publish artifacts" 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 post can 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 artifacts of the build zipped as a single archive
    • Finally, extract the archive and pick up those artifacts you need. Perhaps, you'd like to deploy it to your testing environment in this step as well

Hope this helps.

answered Oct 17, 2018 by lina
• 8,220 points

Related Questions In Kubernetes

0 votes
1 answer

How to start and stop a cluster on AWS using kops without stopping the instance

Export your KOPS_STAT_STORE variable export KOPS_STATE_STORE=s3://your-bucket-name Get your instances ...READ MORE

answered Jan 8, 2019 in Kubernetes by Kashish
+7 votes
4 answers

How are ClusterIP, NodePort and LoadBalancer different from each other?

ClusterIP ClusterIP accesses the services through proxy. ClusterIP ...READ MORE

answered Sep 10, 2018 in Kubernetes by Nilesh
• 7,050 points
0 votes
1 answer
+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
+2 votes
1 answer
0 votes
1 answer

Using IBM Bluemix Track & Plan how to manage multiple instance?

As of now, there is not a ...READ MORE

answered Oct 17, 2018 in Kubernetes by lina
• 8,220 points
0 votes
1 answer

Using REST API I cannot connect SonarQube to JIRA 7

The JIRA Plugin is not compatible with JIRA 7 ...READ MORE

answered Oct 17, 2018 in Kubernetes by lina
• 8,220 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP