Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e17254

Browse files
authored
fix: Add test for wrapping init script with single quotes (#2979)
This ensures our initialization script works with single uotes.
1 parentb5f5e90 commit8e17254

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

‎provisionersdk/agent_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ func TestAgentScript(t *testing.T) {
4646
}
4747
script=strings.ReplaceAll(script,"${ACCESS_URL}",srvURL.String()+"/")
4848
script=strings.ReplaceAll(script,"${AUTH_TYPE}","token")
49-
output,err:=exec.Command("sh","-c",script).CombinedOutput()
49+
// This is intentionally ran in single quotes to mimic how a customer may
50+
// embed our script. Our scripts should not include any single quotes.
51+
// nolint:gosec
52+
output,err:=exec.Command("sh","-c","sh -c '"+script+"'").CombinedOutput()
5053
t.Log(string(output))
5154
require.NoError(t,err)
5255
// Ignore debug output from `set -x`, we're only interested in the last line.

‎provisionersdk/scripts/bootstrap_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ cd "$BINARY_DIR"
1616
# This could fail for a number of reasons, many of which are likely transient.
1717
# So just keep trying!
1818
while:;do
19-
# Try a number of different download tools, as we don'tknow what we'll
20-
# have available
19+
# Try a number of different download tools, as we don notknow what we
20+
#willhave available.
2121
status=""
2222
ifcommand -v curl>/dev/null2>&1;then
2323
curl -fsSL --compressed"${BINARY_URL}" -o"${BINARY_NAME}"&&break

‎provisionersdk/scripts/bootstrap_windows.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sleep for a while in case the underlying provider deletes the resource on error.
22
trap {
3-
Write-Error'=== Agent script exited with non-zero code. Sleeping 24h to preserve logs...'
3+
Write-Error"=== Agent script exited with non-zero code. Sleeping 24h to preserve logs..."
44
Start-Sleep-Seconds86400
55
}
66

@@ -25,7 +25,7 @@ while ($true) {
2525
}
2626
}
2727

28-
# If the below fails, retrying probablywon't help.
28+
# If the below fails, retrying probablywill not help.
2929
Set-MpPreference-DisableRealtimeMonitoring$true-ExclusionPath$env:TEMP\sshd.exe
3030
$env:CODER_AGENT_AUTH="${AUTH_TYPE}"
3131
$env:CODER_AGENT_URL="${ACCESS_URL}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp