Skip to content

Commit

Permalink
Clean up agents
Browse files Browse the repository at this point in the history
  • Loading branch information
mozts2005 committed Jan 21, 2021
1 parent 7f100c1 commit 8a77503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
15 changes: 6 additions & 9 deletions docker/linux/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ curl -LsS $AZP_AGENTPACKAGE_URL | tar -xz & wait $!

source ./env.sh

trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM

print_header "3. Configuring Azure Pipelines agent..."

./config.sh --unattended \
Expand All @@ -88,11 +85,11 @@ print_header "3. Configuring Azure Pipelines agent..."
--replace \
--acceptTeeEula & wait $!

# remove the administrative token before accepting work
rm $AZP_TOKEN_FILE

print_header "4. Running Azure Pipelines agent..."

# `exec` the node runtime so it's aware of TERM and INT signals
# AgentService.js understands how to handle agent self-update and restart
exec ./externals/node/bin/node ./bin/AgentService.js interactive
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM

# To be aware of TERM and INT signals call run.sh
# Running it with the --once flag at the end will shut down the agent after the build is executed
./run.sh & wait $!
3 changes: 0 additions & 3 deletions docker/windows/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ if (-not (Test-Path Env:AZP_URL)) {
--work "$(if (Test-Path Env:AZP_WORK) { ${Env:AZP_WORK} } else { '_work' })" `
--replace

# remove the administrative token before accepting work
Remove-Item $Env:AZP_TOKEN_FILE

Write-Host "4. Running Azure Pipelines agent..." -ForegroundColor Cyan

.\run.cmd
Expand Down

0 comments on commit 8a77503

Please sign in to comment.