Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support default non-release version in build-controller-release.sh #162

Merged
merged 2 commits into from
Aug 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions scripts/build-controller-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ RUNTIME_API_VERSION=${RUNTIME_API_VERSION:-"v1alpha1"}

USAGE="
Usage:
$(basename "$0") <service> <release_version>
$(basename "$0") <service> [<release_version>]

<service> should be an AWS service API aliases that you wish to build -- e.g.
's3' 'sns' or 'sqs'

<release_version> should be the SemVer version tag for the release -- e.g.
'v0.1.3'
'v0.1.3' . If no release_version is specified 'v0.0.0-non-release-version' is used.

Environment variables:
ACK_GENERATE_CACHE_DIR Overrides the directory used for caching
Expand Down Expand Up @@ -91,9 +91,14 @@ Environment variables:
custom resource definitions.
Default: $K8S_RBAC_ROLE_NAME
"
if [ $# -lt 1 ]; then
echo "ERROR: $(basename "$0") needs one required parameter, the SERVICE" 1>&2
echo "$USAGE"
exit 1
fi

if [ $# -ne 2 ]; then
echo "ERROR: $(basename "$0") accepts exactly two parameters, the SERVICE and the RELEASE_VERSION" 1>&2
if [ $# -gt 2 ]; then
echo "ERROR: $(basename "$0") accepts atmost two parameters, the SERVICE(required) and the RELEASE_VERSION(optional)" 1>&2
vijtrip2 marked this conversation as resolved.
Show resolved Hide resolved
echo "$USAGE"
exit 1
fi
Expand Down Expand Up @@ -131,7 +136,28 @@ if [[ ! -d $SERVICE_CONTROLLER_SOURCE_PATH ]]; then
exit 1
fi

RELEASE_VERSION="$2"
if [[ $# -eq 2 ]]; then
RELEASE_VERSION="$2"
# validate that release version is in the format vx.y.z , where x,y,z are
# positive real numbers
if ! (echo "$RELEASE_VERSION" | grep -Eq "^v[0-9]+\.[0-9]+\.[0-9]+$"); then
echo "Release version should have following regex format: ^v[0-9]+\.[0-9]+\.[0-9]+$"
exit 1
fi
else
# If the release version is not provided, use "v0.0.0-non-release-version".
# This non-release version will allow generation of release artifacts and
# executing presubmit 'release-test' job on those artifacts.
# ACK postsubmit release job makes sure this version does not get released to
# public ecr repository.
#
# Using a static non-release version works because this is only a placeholder
# value which gets replaced during presubmit 'release-test' job. Having a
# default non-release value also helps AWS service teams to develop the
# controller without worrying about the version until actual controller
# release.
RELEASE_VERSION="v0.0.0-non-release-version"
vijtrip2 marked this conversation as resolved.
Show resolved Hide resolved
fi
K8S_RBAC_ROLE_NAME=${K8S_RBAC_ROLE_NAME:-"ack-$SERVICE-controller"}
ACK_GENERATE_SERVICE_ACCOUNT_NAME=${ACK_GENERATE_SERVICE_ACCOUNT_NAME:-"ack-$SERVICE-controller"}

Expand Down