Skip to content

Commit ac8470e

Browse files
authored
use latest tag before non-release version (#164)
Updates the `build-controller-release.sh` script to check for the latest Git tag on the target service controller repository before defaulting the RELEASE_VERSION to `v0.0.0-non-release-version`. This allows developers to regenerate their service controllers with new ACK runtimes without overwriting the static manifests' image versions from the latest published Git tag to `v0.0.0-non-release-version`. For service controllers that have yet to release any images, the `v0.0.0-non-release-version` continues to be used. Before this patch: ``` [jaypipes@thelio code-generator]$ make build-controller SERVICE=rds building ack-generate ... ok. ==== building rds-controller ==== Copying common custom resource definitions into rds Building Kubernetes API objects for rds Generating deepcopy code for rds Generating custom resource definitions for rds Building service controller for rds Generating RBAC manifests for rds Running gofmt against generated code for rds ==== building rds-controller release artifacts ==== Building release artifacts for rds-v0.0.0-non-release-version Generating common custom resource definitions Generating custom resource definitions for rds Generating RBAC manifests for rds ``` After this patch: ``` [jaypipes@thelio code-generator]$ make build-controller SERVICE=rds building ack-generate ... ok. ==== building rds-controller ==== Copying common custom resource definitions into rds Building Kubernetes API objects for rds Generating deepcopy code for rds Generating custom resource definitions for rds Building service controller for rds Generating RBAC manifests for rds Running gofmt against generated code for rds ==== building rds-controller release artifacts ==== Building release artifacts for rds-v0.0.4 Generating common custom resource definitions Generating custom resource definitions for rds Generating RBAC manifests for rds ``` Note that at this time, the RDS controller's latest published image is `v0.0.4`. Issue aws-controllers-k8s/community#912 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 5a886f9 commit ac8470e

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

scripts/build-controller-release.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,7 @@ TEMPLATES_DIR=${TEMPLATES_DIR:-$DEFAULT_TEMPLATES_DIR}
4141
DEFAULT_RUNTIME_DIR="$ROOT_DIR/../runtime"
4242
RUNTIME_DIR=${RUNTIME_DIR:-$DEFAULT_RUNTIME_DIR}
4343
RUNTIME_API_VERSION=${RUNTIME_API_VERSION:-"v1alpha1"}
44-
DEFAULT_RELEASE_VERSION="v0.0.0-non-release-version"
45-
# If the release version is not provided, use "v0.0.0-non-release-version".
46-
# This non-release version will allow generation of release artifacts and
47-
# executing presubmit 'release-test' job on those artifacts.
48-
# ACK postsubmit release job makes sure this version does not get released to
49-
# public ecr repository.
50-
#
51-
# Using a static non-release version works because this is only a placeholder
52-
# value which gets replaced during presubmit 'release-test' job. Having a
53-
# default non-release value also helps AWS service teams to develop the
54-
# controller without worrying about the version until actual controller
55-
# release.
56-
RELEASE_VERSION=${RELEASE_VERSION:-$DEFAULT_RELEASE_VERSION}
44+
NON_RELEASE_VERSION="v0.0.0-non-release-version"
5745

5846
USAGE="
5947
Usage:
@@ -142,7 +130,25 @@ if [[ ! -d $SERVICE_CONTROLLER_SOURCE_PATH ]]; then
142130
exit 1
143131
fi
144132

145-
if [[ $RELEASE_VERSION != $DEFAULT_RELEASE_VERSION ]]; then
133+
# If the release version is not provided, check if the source controller
134+
# repository has a Git tag on it. If it does, use that as the version. If it
135+
# does not, use "v0.0.0-non-release-version".
136+
#
137+
# This non-release version will allow generation of release artifacts and
138+
# executing presubmit 'release-test' job on those artifacts.
139+
# ACK postsubmit release job makes sure this version does not get released to
140+
# public ecr repository.
141+
#
142+
# Using a static non-release version works because this is only a placeholder
143+
# value which gets replaced during presubmit 'release-test' job. Having a
144+
# default non-release value also helps AWS service teams to develop the
145+
# controller without worrying about the version until actual controller
146+
# release.
147+
pushd $SERVICE_CONTROLLER_SOURCE_PATH 1>/dev/null
148+
RELEASE_VERSION=${RELEASE_VERSION:-`git describe --tags --abbrev=0 2>/dev/null || echo $NON_RELEASE_VERSION`}
149+
popd 1>/dev/null
150+
151+
if [[ $RELEASE_VERSION != $NON_RELEASE_VERSION ]]; then
146152
# validate that release version is in the format vx.y.z , where x,y,z are
147153
# positive real numbers
148154
if ! (echo "$RELEASE_VERSION" | grep -Eq "^v[0-9]+\.[0-9]+\.[0-9]+$"); then
@@ -246,4 +252,4 @@ if [[ $ACK_GENERATE_OLM == "true" ]]; then
246252
fi
247253

248254
$ACK_GENERATE_BIN_PATH olm $ag_olm_args
249-
fi
255+
fi

0 commit comments

Comments
 (0)