Skip to content

Setup Self Hosting with Azure DevOps

MarkBergman-cbica edited this page Jul 16, 2021 · 10 revisions

Windows

Download

Make a directory called vsts (anywhere you want the agent located, but keep the path short).

Download the agent at https://vstsagentpackage.azureedge.net/agent/2.165.2/vsts-agent-win-x64-2.165.2.zip

If on Windows 7 (as SBIA-PC132 is), instead download https://vstsagentpackage.azureedge.net/agent/2.165.1/vsts-agent-win-x64-2.165.1.zip

Extract the archive inside vsts.

Configuration

Inside vsts, run .\config.cmd. This will initiate the configuration process.

The organization/server URL is https://dev.azure.com/CBICA/

For authorization method, select PAT (default) generate & use a Personal Access Token.

The agent pool name is from this list https://dev.azure.com/CBICA/CaPTk/_settings/agentqueues Select one (not the default OS pools, but the pools with the OS name and distribution version, and they are case sensitive)

Keep _work as default and machine name as default (or you can pick one you like, as long as the name has not existed)

Running the agent

If you want to run the agent as a service (admin privilege needed), select Yes to all questions.

Else, choose No to all questions.

If you selected No and want to test if the agent works, run .\run.cmd to start an interactive session.

In both cases, for the agent to stay alive, the machine must be kept on running.

Current agent

Agent SBIA-PC132 in pool Windows is set up under NgoPh user account, running interactively. In case the machine is shut down or goes to sleep, the agent will stop running. To restart the agent, log into machine SBIA-PC132, find the agent inside user NgoPh, and rerun the agent using one of the methods described above.

Linux

Download

Make a directory called vsts (anywhere you want the agent located, but keep the path short).

Download the agent at https://vstsagentpackage.azureedge.net/agent/2.165.2/vsts-agent-linux-x64-2.165.2.tar.gz

Extract the archive inside vsts.

Configuration

Inside vsts, run ./config.sh. This will initiate the configuration process.

The organization/server URL is https://dev.azure.com/CBICA/

For authorization method, select PAT (default) and the token is wje6v7sj5ntglbpsexgf3e4nuww2evrytf24wz6oe4btibdr5ijq

The agent pool name is from this list https://dev.azure.com/CBICA/CaPTk/_settings/agentqueues Select one (not the default OS pools, but the pools with the OS name and distribution version, and they are case sensitive)

Keep _work as default and machine name as default (or you can pick one you like, as long as the name has not existed)

Running the agent

If you want to run the agent as a service (sudo privilege needed), run

sudo ./svc.sh install
sudo ./svc.sh start

Run sudo ./svc.sh stop to stop.

Else, to start an interactive session, run ./run.sh

In both cases, for the agent to stay alive, the machine must be kept on running.

Current agent

  • Agent ubuntu16.04-self-hosting in pool Ubuntu_16.04 is set up under cbica-devs user account, running as a service inside the VM inside crete. In case the VM or crete is shut down or goes to sleep, the agent will stop running. To restart the agent, log into the machine, and the agent will restart automatically.

  • Agent SBIA-PC152 (to be moved to pool Ubuntu_18.04) is set up under **Alex's** user account, running **as a service**. In case the machine is shut down or goes to sleep, the agent will stop running. To restart the agent, log into the machine SBIA-PC152`, and the agent will restart automatically.

  • Agents cubic-login* (to be moved to pools CentOS*) are set up under a service account running in the Cluster.

macOS

Download

Make a directory called vsts (anywhere you want the agent located, but keep the path short).

Download the agent at https://vstsagentpackage.azureedge.net/agent/2.165.2/vsts-agent-osx-x64-2.165.2.tar.gz

Extract the archive inside vsts.

Configuration

Inside vsts, run ./config.sh. This will initiate the configuration process.

The organization/server URL is https://dev.azure.com/CBICA/

For authorization method, select PAT (default) and the token is wje6v7sj5ntglbpsexgf3e4nuww2evrytf24wz6oe4btibdr5ijq

The agent pool name is macOS (case sensitive)

Keep _work as default and machine name as default (or you can pick one you like, as long as the name has not existed)

Running the agent

If you want to run the agent as a service (sudo privilege needed), run

sudo ./svc.sh install
sudo ./svc.sh start

Run sudo ./svc.sh stop to stop.

Else, to start an interactive session, run ./run.sh

In both cases, for the agent to stay alive, the machine must be kept on running.

Current agent

  • Agent cbica-osx2 in the pool macOS_10.13 is set up under NgoPh user account, running interactively. In case the machine is shut down or goes to sleep, the agent will stop running. To restart the agent, log into machine cbica-osx2, find the agent inside user NgoPh at /Users/ngoph/Desktop/vsts-agent-osx-{version}, and rerun the agent using one of the methods described above. If ran interactively, make sure to run it with the nohup command: nohup ./run.sh 1> run.out 2>&1 &

  • Agent cbica-osx3 in the pool macOS_10.14 is set up under NgoPh user account, running interactively. In case the machine is shut down or goes to sleep, the agent will stop running. To restart the agent, log into machine cbica-osx3, find the agent inside user NgoPh at /Users/ngoph/Desktop/vsts-agent-osx-{version}, and rerun the agent using one of the methods described above. If ran interactively, make sure to run it with the nohup command: nohup ./run.sh 1> run.out 2>&1 &

Other information can be found here

Docker builds on Azure

As of 2020/10/30, the "Docker Image build & push to Docker Hub" job in the Azure build pipeline now builds and pushes a docker image to the Docker Hub repo. This task only runs on a manual build or when a scheduled build is triggered (as of 2020/10/08 this is nightly, at midnight to 1AM Eastern time). This requires the Docker CLI to be installed on the build agent.

Currently this agent is on the ubuntu18.04-self-hosting VM under Crete. See this page for instructions on installing the Docker CLI to other machines. Also note that permissions can be finicky -- if permission errors arise, try making sure that the user running the agent has read, write and execute access to the file /var/run/docker.sock .

If you wish to add the Docker build+push task to another agent pool, you can simply copy the relevant task in azure-pipelines.yml to the other section.