Skip to content

Instantly share code, notes, and snippets.

@TylerLeonhardt
Last active July 30, 2020 18:42
Show Gist options
  • Save TylerLeonhardt/5cde9d208d773cf61e24c14d1971d9e6 to your computer and use it in GitHub Desktop.
Save TylerLeonhardt/5cde9d208d773cf61e24c14d1971d9e6 to your computer and use it in GitHub Desktop.
A non-interactive start up of vso hosted agent

Usage:

docker build . -t 'vso'
docker run -it vso:latest -SubscriptionName  "'My Sub'" -PlanName "myplan" -ArmToken (az account get-access-token)
FROM mcr.microsoft.com/powershell:latest
RUN apt-get update && apt-get install wget
COPY LICENSE README.md /
COPY install-vso.sh /install-vso.sh
RUN sh /install-vso.sh
COPY entrypoint.ps1 /entrypoint.ps1
ENTRYPOINT ["pwsh", "-Command", "/entrypoint.ps1"]
param($SubscriptionName, $PlanName, $ArmToken)
Set-Location $HOME
$env:VSCS_ARM_TOKEN = $ArmToken
"y`nn`n" | codespaces start -s $SubscriptionName -p $PlanName
Read-Host -Prompt "Press ENTER or ^C to stop server."
set -exv
echo "Getting all VSO dependencies"
reqsTemp=$(mktemp)
wget -O $reqsTemp https://aka.ms/vsls-linux-prereq-script && chmod +x $reqsTemp && $reqsTemp
AgentTemp=$(mktemp)
AgentURL=https://vsoagentdownloads.blob.core.windows.net/vsoagent/VSOAgent_linux_3929085.tar.gz
wget -O $AgentTemp --user-agent vso/1.0 $AgentURL
mkdir -p /opt/vsonline/bin/
tar -xf $AgentTemp -C /opt/vsonline/bin/
rm $AgentTemp
chmod +x /opt/vsonline/bin/codespaces
chmod +x /opt/vsonline/bin/vsls-agent
ln -sf /opt/vsonline/bin/codespaces /usr/bin/codespaces
echo "VSO installed! Just run codespaces start to set up your machine's environment"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment