Skip to content

Commit 78ce1b2

Browse files
chapterjasonclaude
andcommitted
Consolidate git identity into git_setup script, bump web-shell to 0.5.1
Renames coder_script.git_ssh_signing → coder_script.git_setup since it now owns both identity and signing. Writes user.name / user.email from the workspace owner so git itself and tools that read .gitconfig (Claude Code, IDE git extensions) see the identity without relying on env-var layering. Drops the four redundant coder_env.git_* resources; coder_agent.env covers agent-started processes, git_setup covers everything that reads config. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ef28b86 commit 78ce1b2

2 files changed

Lines changed: 11 additions & 34 deletions

File tree

main.tf

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ locals {
2626
node = "ghcr.io/sourecode/coder-workspace:node"
2727
cpp = "ghcr.io/sourecode/coder-workspace:cpp"
2828
}
29+
30+
git_author_name = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
31+
git_author_email = data.coder_workspace_owner.me.email
2932
}
3033

3134
data "coder_parameter" "workspace_image" {
@@ -213,42 +216,14 @@ module "git-clone" {
213216
version = "~> 1.0"
214217
}
215218

216-
# Git identity for commits made from inside the workspace.
217-
resource "coder_env" "git_author_name" {
218-
count = data.coder_workspace.me.start_count
219-
agent_id = coder_agent.main.id
220-
name = "GIT_AUTHOR_NAME"
221-
value = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
222-
}
223-
224-
resource "coder_env" "git_author_email" {
225-
count = data.coder_workspace.me.start_count
226-
agent_id = coder_agent.main.id
227-
name = "GIT_AUTHOR_EMAIL"
228-
value = data.coder_workspace_owner.me.email
229-
}
230-
231-
resource "coder_env" "git_committer_name" {
232-
count = data.coder_workspace.me.start_count
233-
agent_id = coder_agent.main.id
234-
name = "GIT_COMMITTER_NAME"
235-
value = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
236-
}
237-
238-
resource "coder_env" "git_committer_email" {
239-
count = data.coder_workspace.me.start_count
240-
agent_id = coder_agent.main.id
241-
name = "GIT_COMMITTER_EMAIL"
242-
value = data.coder_workspace_owner.me.email
243-
}
244-
245-
# SSH commit signing. Uses the ed25519 key Coder provisions per workspace
246-
# owner. The user must also register this public key as a *signing key* on
219+
# Git configuration: identity + SSH commit signing. Identity uses the Coder
220+
# workspace owner. Signing uses the ed25519 key Coder provisions per owner —
221+
# the user must also register this public key as a *signing key* on
247222
# GitHub/GitLab (separate from auth keys) for commits to show as Verified.
248-
resource "coder_script" "git_ssh_signing" {
223+
resource "coder_script" "git_setup" {
249224
count = data.coder_workspace.me.start_count
250225
agent_id = coder_agent.main.id
251-
display_name = "Git SSH signing setup"
226+
display_name = "Git setup"
252227
icon = "/icon/git.svg"
253228
run_on_start = true
254229
script = <<-EOT
@@ -271,6 +246,8 @@ resource "coder_script" "git_ssh_signing" {
271246
>> ~/.ssh/known_hosts 2>/dev/null || true
272247
sort -u ~/.ssh/known_hosts -o ~/.ssh/known_hosts
273248
249+
git config --global user.name "${local.git_author_name}"
250+
git config --global user.email "${local.git_author_email}"
274251
git config --global gpg.format ssh
275252
git config --global user.signingkey ~/.ssh/id_ed25519.pub
276253
git config --global commit.gpgsign true

scripts/web-shell/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# proxy, which gates access with Coder auth.
1010
set -e
1111

12-
WS_VERSION_OPT="${VERSION:-0.5.0}"
12+
WS_VERSION_OPT="${VERSION:-0.5.1}"
1313

1414
# Activate nvm so `npm` resolves against the user's default Node.
1515
export NVM_DIR="$HOME/.nvm"

0 commit comments

Comments
 (0)