Skip to content

fix: make agent scripts easier to troubleshoot #2922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 13, 2022

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Jul 12, 2022

This PR makes the following changes:

  • Adds distinct exit statuses to the bootstrap scripts
  • Makes the bootstrap scripts loop forever trying to download the coder agent
  • Surfaces and logs the status codes returned by the download tool

Tested Linux script with a Docker template, Windows script with aws-windows template, and Darwin script by running locally with an existing Coder agent token.

Note: I also ran PSScriptAnalyzer on the PowerShell script and changed things until it no longer complained.

@johnstcn johnstcn self-assigned this Jul 12, 2022
@johnstcn johnstcn requested review from mafredri and kylecarbs July 12, 2022 11:35
Comment on lines +2 to +5
trap {
Write-Error '=== Agent script exited with non-zero code. Sleeping 24h to preserve logs...'
Start-Sleep -Seconds 86400
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that PS also has trap

@johnstcn johnstcn changed the title feature: make agent scripts easier to troubleshoot fix: make agent scripts easier to troubleshoot Jul 12, 2022
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful, and props on figuring out how to do this neatly in Windows! 🤩

@johnstcn johnstcn merged commit 0f5f30b into main Jul 13, 2022
@johnstcn johnstcn deleted the cj/gh-1544/agent-script-wait branch July 13, 2022 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants