问题
How I can configure the build tasks in 2017 within "build" and "release" as code? I am searching for something like the Jenkinsfiles for the Jenkins Pipelines.
Use case is:
- I need to validate params and then decide which tasks I call in which order etc. based on globally passed parameters
- Don't have the only source of changes in a web UI
- Have the configuration in source control
Is there may be a possibility or a Plugin available doing this?
回答1:
There's no out of the box way. There are marketplace tasks to export build and release definitions as JSON, and you can use the REST APIs to create or update build and release definitions. Combine those things, and you certainly can achieve what you want. I've had some success with scripting build/release definition creation via PowerShell against TFS 2015 and VSTS.
回答2:
What you've requested is currently not possible. There is a proposal out on the Visual Studio Agent GitHub site asking for feedback and with a proposal to do most of what you want.
I suggest subscribing to that topic and providing what feedback you'd like to contribute. There is currently no indication to a timeline to when this new yaml based build will be available though.
You could indeed cobble something together with the REST API to download the json for the build whenever it changes and put it in source control. You could update the build whenever a new json is committed. But given that Microsoft is working on enabling your scenario in the product, I'd recommend to wait out a while longer.
回答3:
The TFS/VSTS VNext build tasks are running sequentially, for release, it has the environment deployment conditions, but the tasks are still running sequentially. You can’t change the order per variable or parameter, also there isn’t the way to configure.
During the build process, it will download the necessary tasks to build agent machine, so you can check the source code (PowerShell file or JS running by Node.js) in tasks folder in your build agent folder, you also can check the source code from this article: vsts-tasks
来源:https://stackoverflow.com/questions/41147555/tfs-2017-build-as-code