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

[BUG]: Installation conflict between Environment agents with same Environment name (breaks existing agent installed for other project) #5108

Open
1 of 4 tasks
michellabbe opened this issue Feb 7, 2025 · 0 comments

Comments

@michellabbe
Copy link

What happened?

When installing multiple agents on same server, for multiple Projects with same Environment name, the first one installs normally but any further registration attempts kills existing service.

Register agent for ProjectA, environment named Dev:

.\config.cmd` --environment --projectname 'ProjectA' --environmentname "Dev" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://dev.azure.com/OrgName/' --auth PAT

The Windows Service is created using provided parameters for service name and installs/starts normally:
vstsagent.OrgName.Dev.ComputerName
(note that the Registration script does not take into account the Project name)

Register agent for ProjectB on same host, with environment also named Dev:

.\config.cmd` --environment --projectname 'ProjectB' --environmentname "Dev" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://dev.azure.com/OrgName/' --auth PAT

The Registration script detects an existing Windows Service with the same name and tries to overwrite it.
It is not able to create/start Windows Service for ProjectB, and the existing vstsagent.OrgName.Dev.ComputerName service for ProjectA is marked for deletion (which is really bad).

As a workaround, we can customize the agent name:

.\config.cmd` --environment --projectname 'ProjectB' --environmentname "Dev" --agent $env:COMPUTERNAME-ProjectB --runasservice --work '_work' --url 'https://dev.azure.com/OrgName/' --auth PAT

and it then installs properly but the default Registration script (Copy command to clipboard button from Add resource in the Environment) still has this nasty issue and will break existing agents. Honestly I'm quite amazed this issue doesn't seem to have ever been reported yet.

On a side note, the documentation "strongly suggest to only install one agent per machine" (which we'd be more than happy to comply with) but it doesn't seem possible to share an Environment resource between multiple Projects.

Versions

Azure DevOps v4.251.0 / Windows Server 2019
Azure DevOps v3.251.0 / Windows Server 2019
(most likely all versions affected)

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows Server 2019 (most likely all Windows versions affected)

Version controll system

No response

Relevant log output

Log files were deleted before I decided to create this github issue, but this agent installation issue can be reproduced very easily.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants