I want to set some agent requirements which depend on the value of an environment variable but I've noticed that if you change an environment variable, the Build Agent will not see the change unless you stop and start it again.
Basically I have two machines and want to alternate how they run tests so that on one day, Machine A will run all the daily tests and Machine B will run the hourly tests when the hourly build artifacts are produced. The next day Machine A & B switch roles. The problem is the build triggers work in the OR sense not in the AND sense so I can't do this using triggers alone. I had the idea of setting a variable (say "TCRole") to either "DAILY" or "HOURLY" at midnight each night and then setting an agent requirement so that hourly test jobs require "TCRole=HOURLY" and daily test jobs require "TCRole=DAILY". The only problem is that the Build Agent holds on the variables as they were set at agent startup. In fact, I've found it very difficult to get the build agent to let go of the old variables and usually have to resort to a system restart! (Maybe a process hanging on somewhere?)
Can anyone help?