Background: I'm using on-prem TFS 2015. I have two build agents. As part of my build and release process I want to run some PowerShell modules that are registered on one agent but not one the other. I've set up capabilities on the agent and demands on the build so that the build runs on a particular agent. But now I need to run the release and specify the same agent.
Question: How do I set up my release to run on a particular agent?
I found it. It's on the Trigger Tab. Select "Edit" pencil icon in Environmental triggers.
You can also edit it if you click on this:
Related
We are currently moving from our legacy build server to Jenkins.
In our previous system, we had the following system:
You don't directly build a release version, but you build a "BETA".
After you are satisfied with the result, you can promote the "BETA" to "RELEASE".
For that, you click on the build (the actual pipeline run) and click on a button "BETA to RELEASE".
This button triggers a script to do the actual promotion (the actual steps are irrelevant for this question).
For Jenkins, I haven't found something like that yet. To be precise: I would like to choose one of the successful builds and then click on some kind of button to promote the results of that build to RELEASE. So even if I have build 1.2.0-BETA, 1.2.1-BETA and 1.2.2-BETA, I can choose 1.2.1-BETA and release it to 1.2.1.
What would be a good approach for this?
I would like to suggest the following
We can create a Jenkins pipeline for an Application (Ex: API Services). In this API deployment pipeline, there are many stages,
Get source code from GIT
Restore the dependent libraries
Build the solution & generate the deployment artifacts (with suitable version , ex: Beta 1)
Deploy the artifacts to Dev environment
We have a wait time (ex: 1 day) using a timeout in Jenkins pipeline
Once the dev team validates the build and finds that it is suitable for promotion to QA
they click on Approve
Approved build gets updated with the version (ex: QA-1)
Await QA team approval
Once approved, move to production.
Reference Link: https://jenkins.io/doc/pipeline/steps/pipeline-input-step/
Example Snippet of pipeline code
stage("Validate before Apply") {
timeout(time:30, unit:'MINUTES') {
input 'Are you sure to promote this build to QA?'
}
}
I think that Promoted Builds Plugin is what you need.
Basically, after installing the plugin, you create a job that build your BETA version and in its configuration, you set up a promotion, manually approved, that run your promotion script.
Depending of your need, you maybe configure as well the number of days you want to keep the builds of the job.
Is it possible to set the Build.Clean control variable during a build step (Not at Queue Time), based upon the way the build is queued?
For instance, I have a build that if queued manually during the day, I want it to run Incrementally. If it runs on its schedule in the middle of the night, I want to have it do a Build.Clean, recreating the Binaries (b) folder on the build agent.
It seems like this control variable has to be set at queue time, because the build runs this operation on the Agent prior to executing any of the build steps themselves. I'm just curious if anyone else has run into this requirement before, or if it is even possible. Thank you
No, it can only be set at queue time.
In your scenario, you can create two build definitions. One for incremental build (Disable the Clean option, Clean = False), and another enable the Clean option for middle of the night build.
Reference:
Control variables
Clean the local repo on the agent--TFS 2017 RTM, TFS 2015.4
area.
We have 1 Team Foundation Server 2017 Update 3 and 3 different build agents configuered. I've noticed that TFS picks the same build agent after when a project have to build. My question is there an option to pick a build agent randomly?
Unfortunately there isn't an option to set that to pick a build agent randomly.
For now, in TFS 2017 it picks the agent in the order that they are registered if the agents are all idle when a build is queued, rather than randomly selecting an agent.
Set Build Agent Priority is an good idea, and there is a user voice here to suggest the feature, you can go and vote it up to achieve it in future.
Currently as a workaround, you can set the demands in build definitions to force building with the specific agents.
To do that, you can reference below articles:
How to send TFS build to a specific agent or server
Build vNext, distributing load to different agents
In TFS 2015 Update 2, I have configured seven release agents in one pool, separated into a set of logical environments using capabilities.
I also have a release configured with three environments defined to use the queue corresponding to this pool and demands specified to filter to the appropriate servers for each environment (1-Test, 2-QA, 4-Prod).
My problem is that TFS is only releasing to the first agent created that meets the demands. If I remove all demands in an environment I would assume it would release to every agent in the pool yet TFS still releases to only the first agent in the pool. If I disable that first agent, it will release to the next; but still to only one agent.
What am I missing?
I think you're misunderstanding what agents are for. The agent merely acts as an invocation mechanism for your deployment activities. You don't need one agent per environment or per server.
For example, if you need to run a PowerShell script on a machine, you use the "PowerShell on Target Machine" deployment activity. The agent will then use WinRM to tell the target machine what scripts to run. That agent can run PowerShell scripts against any machine.
Why would you want the release or build to select a different agent every time? I had always seen with TFS that the probability of a build running on the agent, where the last successful build for a specific build definition ran, is very high.
The only reason I think a build/release should run on a different agent every time is if the number of builds running at a same time requiring the same capabilities is more than one.
If you would like to test each of the agents then try disabling one agent at a time and run the build/release.
Consider TFS 2010's ability for a Build Controller to have 1+ build agents. Since builds are a subjective topic to the team/environment, consider an environment where builds are performed on commit/check-in. Each Project Collection will have 10+ Team Projects, but perhaps only 1 or 2 are being committed to in a day.
When should a TFS administrator consider creating a new build agent?
Do multiple agents run in parallel?
When a single agent is defined to a Build Controller, does it run serially?
MSDN states: "if you set up your agents to have specialized capabilities..." . What does this mean? A technology/platform differentiator? How can you setup your agents to have specialized capabilities?
How can 'tagging' build agents be used effectively in an environment where builds are (typically) performed on each check-in.
You use multiple build agents to support multiple build machines (I work currently with a build farm with 3 build machines - and thus 3 build agents - to distribute the load).
You also might want to have multiple build agents to be able to run builds in parallel. This is a nice feature to share resources, but a requirement when you start working with Test/Lab Management features.
With the capabilities: for example you can setup a build agent with version 1 of a 3rd party component, and a second build agent with version 2. With tagging you can specify in the build definition which build agent it will choose from out of the pool of build agents.
We use 2 build agents on the same machine at work, since we only have one build machine.
The first one handles our CI builds, and is tag with CI. The build definition for the CI build is set up to only use agents that have the CI tag.
The second one is for manually queued builds, mostly for the release branch builds.
I specialized the CI build agent, because it was not uncommon when we were preparing a new build for QA to have several developers check into the development branch, which would slowing down being able to release the build to QA.
One of our builds takes 9 minutes. Its nice that you don't have to be in the Queue behind it if you happen to deploy at the wrong time.