feat(ci): add automatic terraform tagging on charm release#438
Open
feat(ci): add automatic terraform tagging on charm release#438
Conversation
MichaelThamm
approved these changes
Apr 21, 2026
Rename _charm-terraform-release.yaml to terraform-release.yaml so it can be called directly by repositories that have a Terraform module but no charm module. Rename the 'charm-path' input to 'root-path' to reflect that the caller is not necessarily a charm repository. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…into feat/tf-tagging
The terraform-release workflow now accepts a direct path to the terraform directory (defaulting to 'terraform') via the terraform-path input, instead of a root directory that implicitly contains terraform/. The charm-release caller passes '<charm-path>/terraform' accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a branch-format validation step in terraform-release.yaml that checks github.ref_name against ^track/[0-9]+\.[0-9]+$ before proceeding. This ensures branches like track/2 or track/main don't trigger tagging, while track/2.0 and track/1.3 are accepted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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
Add automatic Terraform module tagging to the charm release pipeline. When a push to a
track/*branch includes changes under theterraform/directory, a new annotated git tag is created and pushed.The tag for a Terraform module on
track/major.minoris built as:where
{computed_patch}is the number of commits that touched theterraform/directory since thetrack/branch diverged from main.Changes
New workflow:
terraform-release.yamlA public reusable workflow that can be called from
charm-release.yamlor directly by repositories that have a Terraform module but no charm. It:terraform/(relative toroot-path).<prefix><track_version>.<patch><suffix>, where the patch number is the count of commits touchingterraform/since diverging frommain.Inputs:
root-path(default".") — path to the root directory containing theterraform/folder.terraform-tag-prefix(default"tf-") — prefix for the generated tag.terraform-tag-suffix(default"") — suffix for the generated tag.Updated workflow:
charm-release.yamlterraform-tag-prefixandterraform-tag-suffixinputs.release-terraformjob that runs afterrelease-charm, only ontrack/*branches, passing through the root path and tag options.