question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSTS IsHostedAgent detection is flawed

See original GitHub issue

When 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:open
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kevbitecommented, Jun 15, 2018

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:

var isRunningOnVSTS = !string.IsNullOrEmpty(EnvironmentVariable("AGENT_NAME"));
1reaction
agc93commented, Jul 26, 2017

Yep, I’ll have a look at this (a few different parts of the logic need improvements)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found