Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFBuildProvider.IsHostedAgent returns wrong value when running on 2nd build agent #2608

Closed
thomasdc opened this issue Aug 20, 2019 · 1 comment · Fixed by #2617

Comments

@thomasdc
Copy link

commented Aug 20, 2019

What You Are Seeing?

I noticed that TFBuildProvider.IsHostedAgent isn't working as expected when you have more than the default build agent (which is named Hosted Agent), we have a second agent named Azure Pipelines 2. When a build is scheduled on that agent, the build script malfunctions.

What is Expected?

TFBuildProvider.IsHostedAgent should return true when the build agent name starts with Azure Pipelines

What version of Cake are you using?

0.33.0

Are you running on a 32 or 64 bit system?

64 bit

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

Yes, Azure Pipelines

List of environment variables on CI server

Note the value of AGENT_NAME

AGENT_BUILDDIRECTORY=d:\a\1
AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN=true
AGENT_DISABLELOGPLUGIN_TESTRESULTLOGPLUGIN=true
AGENT_HOMEDIRECTORY=C:\agents\2.155.1
AGENT_ID=24
AGENT_JOBNAME=Job
AGENT_JOBSTATUS=Succeeded
AGENT_MACHINENAME=fv-az29
AGENT_NAME=Azure Pipelines 2
AGENT_OS=Windows_NT
AGENT_OSARCHITECTURE=X64
AGENT_RETAINDEFAULTENCODING=false
AGENT_ROOTDIRECTORY=d:\a
AGENT_SERVEROMDIRECTORY=C:\agents\2.155.1\externals\vstsom
AGENT_TEMPDIRECTORY=d:\a\_temp
AGENT_TOOLSDIRECTORY=C:/hostedtoolcache/windows
AGENT_VERSION=2.155.1
AGENT_WORKFOLDER=d:\a
ALLUSERSPROFILE=C:\ProgramData
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
ANDROID_NDK_HOME=C:\Microsoft\AndroidNDK64\android-ndk-r16b
ANDROID_NDK_PATH=C:\Microsoft\AndroidNDK64\android-ndk-r16b
ANT_HOME=C:\ProgramData\chocolatey\lib\ant\apache-ant-1.10.5
APPDATA=C:\Users\VssAdministrator\AppData\Roaming
AZURE_EXTENSION_DIR=C:\Program Files\Common Files\AzureCliExtensionDirectory
AZURE_HTTP_USER_AGENT=VSTS_8d44eb24-b3d2-4d1c-a837-8f3bd9e18f01_build_27_0
BOOST_ROOT=C:\Program Files\Boost\1.69.0
BOOST_ROOT_1_69_0=C:\Program Files\Boost\1.69.0
BUILD_ARTIFACTSTAGINGDIRECTORY=d:\a\1\a
BUILD_BINARIESDIRECTORY=d:\a\1\b
BUILD_BUILDID=4029
BUILD_BUILDNUMBER=20190820.2
BUILD_BUILDURI=vstfs:///Build/Build/4029
BUILD_CONTAINERID=2528117
BUILD_DEFINITIONNAME=message-queue-monitor CI
BUILD_DEFINITIONVERSION=2
BUILD_QUEUEDBY=XXX
BUILD_QUEUEDBYID=5613824d-648d-6d82-9c1e-d08346c921aa
BUILD_REASON=Manual
BUILD_REPOSITORY_CLEAN=true
BUILD_REPOSITORY_GIT_SUBMODULECHECKOUT=False
BUILD_REPOSITORY_ID=6de05528-1e63-48dc-8772-04859ec33696
BUILD_REPOSITORY_LOCALPATH=d:\a\1\s
BUILD_REPOSITORY_NAME=message-queue-monitor
BUILD_REPOSITORY_PROVIDER=TfsGit
BUILD_REPOSITORY_URI=https://XXX
BUILD_REQUESTEDFOR=XXX
BUILD_REQUESTEDFOREMAIL=XXX
BUILD_REQUESTEDFORID=5613824d-648d-6d82-9c1e-d08346c921aa
BUILD_SOURCEBRANCH=refs/heads/master
BUILD_SOURCEBRANCHNAME=master
BUILD_SOURCESDIRECTORY=d:\a\1\s
BUILD_SOURCEVERSION=09176ad3b06c7e551ba9a8e0d969b314e1eec443
BUILD_SOURCEVERSIONAUTHOR=XXX
BUILD_SOURCEVERSIONMESSAGE=XXX
BUILD_STAGINGDIRECTORY=d:\a\1\a
COBERTURA_HOME=C:\cobertura-2.1.1
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMMON_TESTRESULTSDIRECTORY=d:\a\1\TestResults
COMPUTERNAME=fv-az29
COMSPEC=C:\windows\system32\cmd.exe
CONDA=C:\Miniconda
ChocolateyInstall=C:\ProgramData\chocolatey
ChromeWebDriver=C:\SeleniumWebDrivers\ChromeDriver
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
DriverData=C:\Windows\System32\Drivers\DriverData
ENDPOINT_URL_SYSTEMVSSCONNECTION=XXX
EXEPATH=C:\Program Files\Git\bin
GIT_TERMINAL_PROMPT=0
GOROOT=C:\Go1.12.7
GOROOT_1_10_X64=C:\Go1.10.8
GOROOT_1_11_X64=C:\Go1.11.12
GOROOT_1_12_X64=C:\Go1.12.7
GRADLE_HOME=C:\ProgramData\chocolatey\lib\gradle\tools\gradle-5.5.1
GeckoWebDriver=C:\SeleniumWebDrivers\GeckoDriver
HOME=/c/Users/VssAdministrator
HOMEDRIVE=C:
HOMEPATH=\Users\VssAdministrator
IEWebDriver=C:\SeleniumWebDrivers\IEDriver
INPUT_ARGUMENTS=
ImageVersion=156.2
JAVA_HOME=C:\Program Files\Java\zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64
JAVA_HOME_11_X64=C:\Program Files\Java\zulu-11-azure-jdk_11.33.15-11.0.4-win_x64
JAVA_HOME_7_X64=C:\Program Files\Java\zulu-7-azure-jdk_7.31.0.5-7.0.232-win_x64
JAVA_HOME_8_X64=C:\Program Files\Java\zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64
LOCALAPPDATA=C:\Users\VssAdministrator\AppData\Local
LOGONSERVER=\\fv-az29
M2=\bin
M2_HOME=C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.1
M2_REPO=C:\ProgramData\m2
MAVEN_OPTS=-Xms256m
MSDEPLOY_HTTP_USER_AGENT=VSTS_8d44eb24-b3d2-4d1c-a837-8f3bd9e18f01_build_27_0
MSYSTEM=MINGW64
NPM_CONFIG_CACHE=C:\npm\cache
NPM_CONFIG_PREFIX=C:\npm\prefix
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
PATH=/mingw64/bin:/usr/bin:/c/Users/VssAdministrator/bin:/c/agents/2.155.1/externals/git/cmd:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/Program Files/Mercurial:/c/vcpkg:/c/cf-cli:/c/Program Files (x86)/NSIS:/c/Program Files/Mercurial:/c/Program Files/Boost/1.69.0:/c/Program Files/dotnet:/c/mysql-5.7.21-winx64/bin:/c/Program Files/Java/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64/bin:/c/npm/prefix:/c/Rust/.cargo/bin:/c/hostedtoolcache/windows/Ruby/2.5.3/x64/bin:/c/Go1.12.7/bin:/bin:/usr/bin:/mingw64/bin:/c/hostedtoolcache/windows/Python/3.7.4/x64/Scripts:/c/hostedtoolcache/windows/Python/3.7.4/x64:/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/windows/System32/OpenSSH:/c/ProgramData/Chocolatey/bin:/c/Program Files/Docker:/c/Program Files/PowerShell/6:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files/dotnet:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/cmd:/mingw64/bin:/usr/bin:/c/tools/php:/c/Program Files (x86)/Subversion/bin:/c/Program Files/nodejs:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.1/bin:/c/Program Files/CMake/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Program Files/OpenSSL/bin:/c/Users/VssAdministrator/.dotnet/tools:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/B
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
PHPROOT=c:\tools\php
PIPELINE_WORKSPACE=d:\a\1
PLINK_PROTOCOL=ssh
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=4f01
PROGRAMFILES=C:\Program Files
PSModulePath=C:\Modules\azurerm_2.1.0;C:\Modules\azure_2.1.0;C:\Users\packer\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Microsoft SQL Server\130\Tools\PowerShell\Modules\
PUBLIC=C:\Users\Public
PWD=/d/a/1/s
PYTHON_HOME=C:/hostedtoolcache/windows\Python\3.6.8\x64
ProgramData=C:\ProgramData
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
RUNNER_TOOLSDIRECTORY=C:/hostedtoolcache/windows
SHLVL=1
SYSTEM=build
SYSTEMDRIVE=C:
SYSTEMROOT=C:\windows
SYSTEM_ARTIFACTSDIRECTORY=d:\a\1\a
SYSTEM_COLLECTIONID=8d44eb24-b3d2-4d1c-a837-8f3bd9e18f01
SYSTEM_COLLECTIONURI=https://dev.azure.com/XXX
SYSTEM_CULTURE=en-US
SYSTEM_DEFAULTWORKINGDIRECTORY=d:\a\1\s
SYSTEM_DEFINITIONID=27
SYSTEM_DEFINITIONNAME=message-queue-monitor CI
SYSTEM_ENABLEACCESSTOKEN=SecretVariable
SYSTEM_HOSTTYPE=build
SYSTEM_ISSCHEDULED=False
SYSTEM_JOBATTEMPT=1
SYSTEM_JOBDISPLAYNAME=Job
SYSTEM_JOBID=12f1170f-54f2-53f3-20dd-22fc7dff55f9
SYSTEM_JOBIDENTIFIER=Job.__default
SYSTEM_JOBNAME=__default
SYSTEM_JOBPARALLELISMTAG=Private
SYSTEM_JOBPOSITIONINPHASE=1
SYSTEM_PHASEATTEMPT=1
SYSTEM_PHASEDISPLAYNAME=Job
SYSTEM_PHASEID=3a3a2a60-14c7-570b-14a4-fa42ad92f52a
SYSTEM_PHASENAME=Job
SYSTEM_PIPELINESTARTTIME=2019-08-20 14:21:04+02:00
SYSTEM_PLANID=624abb70-9a9f-406a-9476-59df78364403
SYSTEM_PULLREQUEST_ISFORK=False
SYSTEM_SERVERTYPE=Hosted
SYSTEM_STAGEATTEMPT=1
SYSTEM_STAGEDISPLAYNAME=__default
SYSTEM_STAGEID=96ac2280-8cb4-5df5-99de-dd2da759617d
SYSTEM_STAGENAME=__default
SYSTEM_TASKDEFINITIONSURI=https://dev.azure.com/XXX
SYSTEM_TASKDISPLAYNAME=Bash
SYSTEM_TASKINSTANCEID=efa2bfe1-554a-50c8-79b6-ef106ad3c7c2
SYSTEM_TASKINSTANCENAME=Bash
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI=https://dev.azure.com/XXX
SYSTEM_TEAMFOUNDATIONSERVERURI=https://dev.azure.com/XXX
SYSTEM_TEAMPROJECT=RITS Project
SYSTEM_TEAMPROJECTID=20fbadbe-ba3d-429c-ab0a-095e89b69d77
SYSTEM_TIMELINEID=624abb70-9a9f-406a-9476-59df78364403
SYSTEM_TOTALJOBSINPHASE=1
SYSTEM_WORKFOLDER=d:\a
TASK_DISPLAYNAME=Bash
TEMP=/tmp
TERM=cygwin
TF_BUILD=True
TMP=/tmp
USERDOMAIN=fv-az29
USERDOMAIN_ROAMINGPROFILE=fv-az29
USERNAME=VssAdministrator
USERPROFILE=C:\Users\VssAdministrator
VCPKG_INSTALLATION_ROOT=C:\vcpkg
VSTS_AGENT_PERFLOG=c:\vsts\perflog
VSTS_PROCESS_LOOKUP_ID=vsts_83233a87-36c1-4d2e-826f-3b5d1f303821
WINDIR=C:\windows
WIX=C:\Program Files (x86)\WiX Toolset v3.11\

@agc93 agc93 self-assigned this Aug 20, 2019

@RehanSaeed

This comment has been minimized.

Copy link
Contributor

commented Sep 3, 2019

Also seeing this issue.

@devlead devlead added the Bug label Sep 4, 2019

@devlead devlead added this to the v0.35.0 milestone Sep 4, 2019

devlead added a commit that referenced this issue Sep 4, 2019
Merge branch 'agc93-feature/GH-2608' into develop
* agc93-feature/GH-2608:
  GH2608: Correctly identifies extra hosted agents in Azure Pipelines

@devlead devlead closed this in #2617 Sep 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.