Why the MacOS "login item approach" was removed from the latest manual?

If i use the LaunchAgent approach with multiple agents on MacOs, there is a problem with agent updates:

When the agent2 updates, its local bin/jetbrains.teamcity.BuildAgent.plist generates, but with default Label "jetbrains.teamcity.BuildAgent", which should be "jetbrains.teamcity.BuildAgent2", as configured in the /Users/builduser/Library/LaunchAgents/jetbrains.teamcity.BuildAgent2.plist file.

10 comments
Comment actions Permalink

Hi Dmitry,

What is the contents of your jetbrains.teamcity.BuildAgent.plist file?

We've recently changed it, so it would allow two-agent installation on the same machine.

The latest version of jetbrains.teamcity.BuildAgent.plist uses agent.sh to start the agent and there should not be any problem with the upgrade.

 

Thanks,

 

0
Comment actions Permalink

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Debug</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>jetbrains.teamcity.BuildAgent</string>
<key>LowPriorityBackgroundIO</key>
<false/>
<key>LowPriorityIO</key>
<false/>
<key>OnDemand</key>
<false/>
<key>ProcessType</key>
<string>Interactive</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>--login</string>
<string>-c</string>
<string>bin/agent.sh run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>logs/launchd.err.log</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>WorkingDirectory</key>
<string>/Volumes/data/teamcity_agents/buildagent2</string>
</dict>
</plist>

0
Comment actions Permalink

note the Label was changed to

------------
<key>Label</key>
<string>jetbrains.teamcity.BuildAgent</string>

------------

 

Before update the Label was

 

----------

<key>Label</key>
<string>jetbrains.teamcity.BuildAgent2</string>

----------

0
Comment actions Permalink

Hello,

   Looks fine as I can see. 2 plists files for different agents should have different Labels and different WorkingDirectory values + different Port and Name values in the corresponding buildAgent.properties files. 

 

   The contents of the `bin/jetbrains.teamcity.BuildAgent.plist` after upgrade should not affect build agent installation, because the working version of the plist file is only stored under `/Users/builduser/Library/LaunchAgents/` directory and it does not change during agent upgrade.

 

  Please let me know if this explains the situation,

  KIR

0
Comment actions Permalink

No it doesnt looks fine, because the label is wrong: it is jetbrains.teamcity.BuildAgent when should be jetbrains.teamcity.BuildAgent2

0
Comment actions Permalink

Does it change the label  in `/Users/builduser/Library/LaunchAgents/jetbrains.teamcity.BuildAgent2.plist`?  

0
Comment actions Permalink

it uses the local ./bin/jetbrains.teamcity.BuildAgent.plist or maybe jetbrains.teamcity.BuildAgentUpgrade.plist  file when running upgrade script. And in local plist it only changes the WorkingDirectory.

The /Users/builduser/Library/LaunchAgents/*.plist doesnt touched at all and its all fine with them

0
Comment actions Permalink

So, the upgrade process does not touch /Users/builduser/Library/LaunchAgents/*.plist files, and that's correct. So after the upgrade, if you reboot the machine, both build agents will start as expected and will work. I'm afraid I don't understand the problem.

0
Comment actions Permalink

I dont reboot server. I expect the agents will restart automatically, which is true if i have only 1 agent per server.

If i have server with multiple-agents, after the agents upgraded, they didnt start automatically. I think its because the agent upgrade process generates local ./bin/*.plist files and uses them to autostart the agents. But it doesnt know what Label should be and just uses the default. And plist cant be started because other agent with the same label already running.

0
Comment actions Permalink

I'm afraid your guess is wrong. When TeamCity starts build agents using agent.sh script from the plist file, it does not use plist mechanics on upgrade. So the reason of agent not coming back after the upgrade is elsewhere. To investigate, we need all logs from the buildAgent2/logs directory for the time of the upgrade, so probably the best way to continue is to create an issue at https://youtrack.jetbrains.com/issues/TW and attach archive with logs there + the contents of your /Users/builduser/Library/LaunchAgents/jetbrains.teamcity.BuildAgent2.plist file (it should use agent.sh for the start as well)

Thanks!

 

0

Please sign in to leave a comment.