refactor: read image_version from a single VERSION file, no per-template copies - #185
Merged
Conversation
…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>
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VERSIONfile 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 tocoder templates push, so eachtemplate.tfjust readsvar.image_version(no moretry(trimspace(file("${path.module}/VERSION")), var.image_version)fallback).VERSIONfiles and their now-unnecessary.gitignoreentries.drupal-contrib/VERSIONhad 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
VERSIONbecause the copy step was easy to forget, and per-template copies could silently diverge from the root file (asdrupal-contrib/VERSIONalready 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> validatefor all three templatesterraform -chdir=<template> testfor 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 inmake push-template-*against a real Coder deployment to confirm the pushed template version matches rootVERSION🤖 Generated with Claude Code