4

On Agent Requirements, I've set:

system.agent.name EQUALS agent1

Now, the build only runs on agent1.

How can I make the build able to run either "agent1" and "agent2"?

So for example, if "agent1" is busy, then "agent2" is allowed to run instead.

alansiqueira27
  • 8,129
  • 15
  • 67
  • 111

2 Answers2

20

Instead of using EQUALS, you could use MATCHES and specify a regular expression.

Example: system.agent.name MATCHES agent(1|2)

Screenshot showing agent requirement setting

henningst
  • 1,664
  • 2
  • 20
  • 30
  • 1
    That's strange. I just tested on a TC 9.1.5 installation I have, and it works just fine. You also added an answer below indicating it worked when you set the value to (agent1|agent2)? – henningst Feb 24 '16 at 08:57
  • did you write right on this part? "agent(1|2)". Didn't you mean "(agent1|agent2)" ? – alansiqueira27 Feb 24 '16 at 12:57
  • 1
    Yes, I had just the numbers inside the parenthesis. It's a regular expression that would match 1 OR 2. Have a look at the screenshot I just posted in my original answer. Here you can see my actual settings. My agent is called hrmts-build01 and it matches the expression hrmts-build(01|02). In this case I have only 1 agent, but that doesn't matter. If I add a second one with the name hrmts-build02 it will also match :) But in your case, using (agent1|agent2) would also work just fine. It's just a bit more specific. – henningst Feb 25 '16 at 08:51
7

With the help of @henningst, I discovered this:

Parameter Name:

system.agent.name

Condition:

matches

Value:

(agent1|agent2)
alansiqueira27
  • 8,129
  • 15
  • 67
  • 111