In my post https://www.jenx.si/2019/05/27/how-to-setup-private-linux-azure-devops-agent/ I investigated how to put up custom Linux build agent for Azure DevOps.
The problem is that registration to Azure DevOps is done only per session with
./run.sh. If you logout from current session or Ctrl+Break current Job Listener – registration to Azure DevOps is also dropped. So, in production environment this scenario is of no use.
If I start agent registration by running
./run.sh then agent registration lifespan is per user session!
If I check Azure DevOps portal at point “STARTED” my build agent is online, as shown below:
But, if I cancel script execution (Ctrl+C -> STOPED point) or if I exit ssh session (exit terminal) my agent goes offline!
In general, for build agents we want to be online all the time! So, let’s investigate
Let’s check svc.sh script.
Linux Azure build agent has svc.sh bash script in installation bundle. Let’s investigate what this script does.
It’s straightforward, script can install, start, stop, display status and uninstall linux build service.
That’s it, Linux Azure build agent is running as service. Now, I can disconnect from console (kill session), restart build server and it will automatically register to Azure DevOps on the next boot. Nice!