mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: set /Users/spike for coder agent in gcp-linux template (#2147)
Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
@@ -70,5 +70,21 @@ resource "google_compute_instance" "dev" {
|
||||
email = data.google_compute_default_service_account.default.email
|
||||
scopes = ["cloud-platform"]
|
||||
}
|
||||
metadata_startup_script = coder_agent.dev.init_script
|
||||
# The startup script runs as root with no $HOME environment set up, which can break workspace applications, so
|
||||
# instead of directly running the agent init script, setup the home directory, write the init script, and then execute
|
||||
# it.
|
||||
metadata_startup_script = <<EOMETA
|
||||
#!/usr/bin/env sh
|
||||
set -eux pipefail
|
||||
|
||||
mkdir /root || true
|
||||
cat <<'EOCODER' > /root/coder_agent.sh
|
||||
${coder_agent.dev.init_script}
|
||||
EOCODER
|
||||
chmod +x /root/coder_agent.sh
|
||||
|
||||
export HOME=/root
|
||||
/root/coder_agent.sh
|
||||
|
||||
EOMETA
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user