Skip to content

refactor: read image_version from a single VERSION file, no per-template copies - #185

Merged
rfay merged 2 commits into
mainfrom
20260727_version_single_source
Jul 27, 2026
Merged

refactor: read image_version from a single VERSION file, no per-template copies#185
rfay merged 2 commits into
mainfrom
20260727_version_single_source

Conversation

@rfay

@rfay rfay commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Makes the root VERSION file the single source of truth for the image tag across all three templates, instead of copying it into each template directory at push time.
  • make push-template-* now passes --variable image_version=$(cat VERSION) directly to coder templates push, so each template.tf just reads var.image_version (no more try(trimspace(file("${path.module}/VERSION")), var.image_version) fallback).
  • Removes the per-template VERSION files and their now-unnecessary .gitignore entries. drupal-contrib/VERSION had accidentally been git-tracked while the other two templates' copies were gitignored — this eliminates that drift entirely by removing the copies altogether.

Why

The previous copy-based approach caused real staleness bugs: a manual template push was done against a stale root VERSION because the copy step was easy to forget, and per-template copies could silently diverge from the root file (as drupal-contrib/VERSION already had, being tracked when it shouldn't have been). Passing the version explicitly at push time removes the possibility of drift altogether.

Test plan

  • terraform fmt -recursive (no changes needed)
  • terraform -chdir=<template> init -backend=false && terraform -chdir=<template> validate for all three templates
  • terraform -chdir=<template> test for all three templates — passes with the same test counts as before this change (6/6, 6/6, and freeform's baseline), confirming no unrelated test content leaked in
  • make push-template-* against a real Coder deployment to confirm the pushed template version matches root VERSION

🤖 Generated with Claude Code

…ate copies

Each template read its own local VERSION file (file("${path.module}/VERSION"))
because coder templates push only ships the contents of --directory <template>
to the provisioner -- it never had access to the repo root. That meant three
physical copies kept in sync by a Makefile `cp` step, and drupal-contrib's
copy had drifted: it was accidentally committed (and gitignored in neither
drupal-core nor freeform's case either, inconsistently), while the actual
value could silently go stale relative to root VERSION.

Drop the per-template copies entirely. Each template.tf now just uses
var.image_version directly; the Makefile passes it explicitly via
--variable image_version=$(VERSION) (already computed from the root VERSION
file) when pushing. Root VERSION is now the only copy anywhere -- delete
drupal-contrib/VERSION (the only one that was actually tracked) and drop the
now-unnecessary VERSION gitignore entries from drupal-core/freeform.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-27 14:08 UTC

The VERSION single-source-of-truth refactor removed the file-read
fallback from local.image_version in all three templates, but four CI
workflows still relied on it (copying VERSION into the template
directory instead of passing --variable image_version). Without the
fallback, those pushes silently used the hardcoded v0.1 default,
causing PR #185's Drupal integration tests to fail against a stale
image.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@rfay
rfay merged commit 49e6652 into main Jul 27, 2026
16 checks passed
@rfay
rfay deleted the 20260727_version_single_source branch July 27, 2026 14:08
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.

1 participant