Skip to content

RELEASE_VERSION should default to latest proper Git tag #912

@jaypipes

Description

@jaypipes

Since adding support for RELEASE_VERSION in the code generator's scripts/build-controller-release.sh script, the default release version is v0.0.0-non-release-version.

What this means is that if you go and regenerate an existing controller -- say, the rds-controller -- with a new ACK runtime using make build-controller from the code-generator repo, the static manifests inside the service controller repository (in the config/ and /helm directories) will have all their container image versions set to v0.0.0-non-release-version. This is incorrect. The image version for container images included in static manifests should refer to an actual image. Prior to the afore-mentioned commit, the image versions in the static manifests referred to the last git tag on the source repository, which was correct, since the git tag referred to an actual published controller image on the ECR Public registry. v0.0.0-non-release-version does not refer to a valid container image and can never refer to a specific set of bits that comprises an actual image since you cannot build a controller image with the tag v0.0.0-non-release-version that refers to the exact same bits -- it is a "fake" tag similar to latest.

While I understand the desire to always generate Helm artifacts and static configuration manifests so that we may run tests against those manifests, we need to ensure that the container image versions present on any static manifest that would be committed to a source controller repo are valid and refer to an image that can actually be built (by doing a git checkout <VERSION> && cd ../code-generator && make build-controller-image).

I identified this problem this morning when trying to bring the RDS controller up to v0.12.0 of the ACK runtime. I did the following:

cd $ACK_SOURCE_DIR;
for runtime code-generator as d; do
  cd $d; git checkout main; git fetch --all --tags; git rebase upstream/main; cd ..
done
cd rds-controller
# Edit go.mod to bring in ACK runtime v0.12.0
cd ../code-generator
make build-controller SERVICE=rds
cd ../rds-controller
git diff

And noted that all the static manifests' image references were changed from the latest release RDS controller release tag (v0.0.4) to v0.0.0-non-release-version:

-  repository: public.ecr.aws/aws-controllers-k8s/controller
-  tag: rds-v0.0.4
+  repository: public.ecr.aws/aws-controllers-k8s/rds-controller
+  tag: v0.0.0-non-release-version

We should change the logic in build-controller-release to grab the latest Git tag for the source controller repository and default to v0.0.0-non-release-version only when no Git tag is present on the repo. Below is shown what the git describe --tags --abbrev=0 command yields on a repo with a Git tag (rds-controller) and a repo without a Git tag (test-infra):

[jaypipes@thelio rds-controller]$ git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0-non-release-version"
v0.0.4
[jaypipes@thelio rds-controller]$ cd ../test-infra/
[jaypipes@thelio test-infra]$ git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0-non-release-version"
v0.0.0-non-release-version

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.project-managementInfra and communication stuff

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions