VSTS IsHostedAgent detection is flawed
See original GitHub issueWhen running CakeBuild in VSTS and rely on Context.TFBuild().IsRunningOnVSTS
. However we have 2 hosted build agents and second build agent is called “Hosted Agent 2”. And build is always failing on the second agent.
Here code insists that agent name is exactly “Hosted Agent”.
Also We are setting up private build agent and this code does not agree with private build agents. It is still VSTS build, only not run in hosted agent.
I propose to change the check for the agent name to .StartsWith("Hosted Agent")
and remove check for IsHostedAgent
from IsRunningOnVSTS
option.
@agc93 what do you think? (as far as I remember you have done work on this)
I can do PR for this.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (4 by maintainers)
Top Results From Across the Web
TFBuild.IsRunningOnVSTS is confusing when using own ...
I have a VSTS build agent, which is triggering a cake build on GitHub commits. ... VSTS IsHostedAgent detection is flawed #1684.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’ve just stumbled across this issue too since we’ve added a couple more hosted agents to our team. As a workaround we’re just checking that we’ve got a agent name:
Yep, I’ll have a look at this (a few different parts of the logic need improvements)