Skip to content

Tagging for TF modules in charm repos #427

@MichaelThamm

Description

@MichaelThamm

Summary

What do we want to do with tagging charm repos to match the CC008 spec? The spec gives us freedom to decide as long as we meet SemVer requirements. We want this solution to:

  • have friendly UX for our users
  • be extendible to product modules
  • be automatable: tagging the repo and releasing to the TF registry

The core of the problem

Since we want the charm to have channel validation, we want to hint that in the tag. How can we map charm tracks to TF SemVer?

Tip

I think the best option is C. It works well for product modules as well. The user's confusion regarding what workload the tag is for can be reduced with the module's README. The runner-up is B. Please see the pros and cons for each.

Statements of truth

Charm tracks

  1. All tracks are feature frozen, except dev.
  2. It is never ok to make breaking changes in-track, only on dev; the source of new tracks.
  3. If upstream major bumps, we make an effort to bump our track at the end of the current cycle, unless time pressure/capacity does not permit.
  4. Some charms have tracks major.minor if they have an upstream workload.
    • Otherwise, they have major following COS' track: reference

Terraform

  1. We must bump the major version on breaking changes, the minor for non-breaking changes, and the patch for trivial fixes (e.g., updating descriptions) and non-breaking bug fixes.
  2. A breaking change can be either:
    • an API change to the TF layer e.g., removing an endpoint in the outputs.tf.
    • an endpoint interface changes without updating the endpoint name i.e., no change to the TF layer, but a side-effect in the module.
  3. Terraform registry requires tags following a subset of SemVer i.e., {major}.{minor}.{patch} without features like metadata or pre-releases.
  4. The registry will not pick up our rev123 tags because they are not valid semver.

Decision making

The main blockers for each strategy are identified with ❗️.

Rubric

  • A: Charm revisions
  • B: Track(major.minor), TF .patch SemVer
  • C: Pure TF SemVer
  • D: Track(major.minor) SemVer
Identifier Tag scheme UX Terrareg support CC008 Compatible
A
B
C ❓️
D

Tagging strategies

Upstream Track Cycle Event B C D
3.6.7 3.6 26.04 3.6.0 1.0.0 3.6 3.6-tf.0
A TF endpoint added to track 3.6 3.6.1 1.1.0 3.6 3.6-tf.1
A TF endpoint added to previous track e.g., 2.9 2.9.n+1 n-1.n+1.0 or n.n+1.0 2.9 2.9-tf.n+1
3.6.7 3.6 26.10 We consciously decide not to track bump (to 3.7.0) across cycles 3.6.1 1.1.0 3.6 3.6-tf.1
4.1.0 4.1 27.04 We time a breaking change with 27.04 4.1.0 2.0.0 4.1 4.1-tf.0
We decide to make a breaking change mid-cycle ❗️ ❗️ 3.0.0

A: Charm revisions

Good:

  • We already have the tags and automation.

Bad:

  • ❗️Does not conform to CC008 spec.
  • Tags are opaque e.g., rev123 is specific to track 2, but rev124 is specific to track dev.
  • We do not release with (only) TF changes

B: Track(major.minor), TF .patch SemVer

Good:

  • Provides insight on which track the tag is for.
  • Terrareg allows mapping a git tag 1.2-tf.0 -> 1.2.0 in Terrareg; obvious in git, but confusing in Terrareg UI.

Bad:

  • ❗️The TF-specific patch can confuse the user that it is the workload version patch.
  • Workload-less charm tracks use the stack track i.e., just a major, not major.minor
    • We could map to major.minor e.g., 3 -> 3.0 and a TF version of 3.0.TF
    • This would not map well to product modules since they have no upstream e.g., major.TF.TF
    • Would documentation be enough for users to understand?

C: Pure TF SemVer

Good:

  • Aligns most closely to the CC008 spec.
  • Major changes are not gated per cycle.

Bad:

  • ❗️Tags are opaque to charm-tracks e.g., 1.0.0 is specific to track 2.
    • A user needs to search release notes / module docs to understand what tracks are allowed.
  • We have to manage a VERSION file for tagging CI.

D: Track(major.minor) SemVer

Good:

  • Similar to sourcing product modules with track branches, but with tags.
    • E.g., in 26.04 source ?ref=track/3.6.
    • E.g., in 26.10 source ?ref=3.6.
  • Breaking (major) changes are gated for 6 months (per cycle).
  • The workload version is the tag.
  • Having a second tag (with metadata and no TF changes) acts as a source of truth for users.
    • metadata identifies the tag creation order e.g., 3.6+tf.1 vs. 3.6+tf.2.

Bad:

  • ❗️Does not fully conform to the CC008 spec.
  • ❗️We lose reproducibility.
    • e.g., day 1 the module documentation says it supports endpoint X, then day 2 it supports both endpoints X & Y
    • i.e., user needs to refresh the documentation vs. going to the new version.
    • e.g., day 1 terraform apply, then day 2 terraform apply is broken!
  • In the event that we (unlikely) commit a regression and overwrite the tag, the admin might not know how to (or that they even can) switch between a registry ref to a GitHub ref.
    • e.g., 3.6 is broken so they must use the ?ref=3.6+metadata tag, which is not published in the registry.
  • Hard to scale the fixes if we make a breaking change e.g., ManSol needs to make many changes to switch to the -tf.n tags.

TODOs

  • Comment on registry TF spec: both registry and module specs
  • Move this to the teams ADRs or to a spec and close this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions