Bug: Woodpecker agent secret drift — 3 conflicting values across tfvars/k8s/statefulset #137
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-platform#137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
plan-pal-e-platform— standalone, discovered during operationsRepo
forgejo_admin/pal-e-platformWhat Broke
woodpecker_agent_secrethas different values across four sources. Atofu applywill overwrite the live value, potentially breaking webhook auth (same failure pattern as the March 14 incident).secrets.auto.tfvars3e053aaa...3e053aaa...woodpecker-default-agent-secret8ABReJ9K...from_secret: tf_var_woodpecker_agent_secret)Repro Steps
woodpecker_agent_secretacross all four locations:secrets.auto.tfvars, live statefulset env (kubectl exec ... printenv), k8s Secret (kubectl get secret), and Woodpecker CI secret storetofu applywill overwrite live with tfvars value — if the active value differs, this breaks agent authExpected Behavior
All four locations should have the same value. The single source of truth should be
secrets.auto.tfvars, propagated through Terraform to k8s secret and consumed by the statefulset. The Woodpecker CI secret store must also match.Environment
File Targets
terraform/secrets.auto.tfvars— line 12,woodpecker_agent_secretvalueterraform/variables.tf— line 157, variable definition (marked sensitive)terraform/main.tf— lines 773-783,set_sensitiveblocks injecting value into server + agent env.woodpecker.yaml— lines 70-71 and 159-160,from_secret: tf_var_woodpecker_agent_secrettf_var_woodpecker_agent_secret(via Woodpecker API or UI)woodpecker-default-agent-secretinwoodpeckernamespace (Helm-managed, not directly in Terraform)Acceptance Criteria
Test Expectations
grep woodpecker_agent_secret terraform/secrets.auto.tfvars,kubectl get secret woodpecker-default-agent-secret -n woodpecker -o jsonpath='{.data.*}' | base64 -d,kubectl execinto agent pod and checkprintenv WOODPECKER_AGENT_SECRET, and check Woodpecker CI secret store via APIConstraints
woodpecker_agent_secret, it could happen towoodpecker_encryption_key,woodpecker_db_password, or any other secret. Reconciliation must not disturb those 17 other secrets.tofu applymay or may not reconcile it depending on how the chart handles existing secrets.Checklist
Related
tofu apply— must resolve before any merge triggers apply-on-mainScope Review: NEEDS_REFINEMENT
Review note:
review-256-2026-03-22Ticket describes the problem well but has gaps that would confuse an executing agent.
secrets.auto.tfvarscurrently has prefix3e053aaa(matches statefulset), not597ea9dcas listed. The597ea9dcvalue does not exist anywhere in the repo.from_secret: tf_var_woodpecker_agent_secret) is a distinct location not listed in the table.sop-woodpecker-db-migration. This is a separate deliverable, not part of a secret reconciliation bug fix.Scoping Notes (2026-03-24)
Context: This is likely WHY the Helm release got stuck. A previous
tofu applytried to change the agent secret via Helm upgrade, something went wrong mid-upgrade (timeout/OOM), and the release got stuck inpending-upgradestate.Where the secret is used in terraform:
terraform/main.tf:773-774—server.env.WOODPECKER_AGENT_SECRET(set_sensitive)terraform/main.tf:779-780—agent.env.WOODPECKER_AGENT_SECRET(set_sensitive)var.woodpecker_agent_secretfrom Salt pillarThe 3 values to reconcile:
secrets.auto.tfvars— what Salt pillar says (canonical source)Fix procedure (after Helm unstick):
helm -n woodpecker get values woodpecker -o yaml | grep AGENT_SECRET— see what Helm thinksmake tofu-secrets && grep agent_secret terraform/secrets.auto.tfvarstofu plan -lock=false— see what tofu wants to changePairs well with #86 (rotate Woodpecker API token) — both are secret reconciliation tasks.
Resolved (2026-03-24)
Verified all three values are aligned:
597ea9dc...5432helm_release.woodpeckerThe drift was reconciled by a previous partial apply (pipeline #260). No further action needed.