From 8a77503971bc93143db9e11eb8dd8c381ad9f3d2 Mon Sep 17 00:00:00 2001 From: Elizabeth Schneider Date: Wed, 18 Nov 2020 10:34:59 -0700 Subject: [PATCH] Clean up agents --- docker/linux/start.sh | 15 ++++++--------- docker/windows/start.ps1 | 3 --- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/docker/linux/start.sh b/docker/linux/start.sh index ee931df..a8bd1f8 100644 --- a/docker/linux/start.sh +++ b/docker/linux/start.sh @@ -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 \ @@ -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 \ No newline at end of file +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 $! \ No newline at end of file diff --git a/docker/windows/start.ps1 b/docker/windows/start.ps1 index c9cda43..8615af7 100644 --- a/docker/windows/start.ps1 +++ b/docker/windows/start.ps1 @@ -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