Allow only semantic release versions like
"v${SEMVER}" or "${SEMVER}".
Fail the script if the version is not valid.
Do not append any additional characters to the
release version during tagging and pushing steps.
In this case, if the user wants to use the prefixed
"v", they can define it in the releases/*.yaml as:
version: 'v1.0.0'
Issue: RELENG-2131
Change-Id: I71f32600d3e17ec117776be6764c2e45ee934bdd
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
--- /dev/null
+---
+fixes:
+ - |
+ Allow only semantic release versions like "v${SEMVER}" or "${SEMVER}".
+ Fail the script if the version is not valid.
+ Do not append any additional characters to the release version during
+ tag and push steps.
cat "$PATCH_DIR"/taglist.log
popd
cat "$PATCH_DIR"/taglist.log
popd
+ # Verify allowed versions
+ # Allowed versions are "v#.#.#" or "#.#.#" aka SemVer
+ allowed_version_regex="^((v?)([0-9]+)\.([0-9]+)\.([0-9]+))$"
+ if [[ ! $VERSION =~ $allowed_version_regex ]]; then
+ echo "The version $VERSION is not a semantic valid version"
+ echo "Allowed versions are "v#.#.#" or "#.#.#" aka SemVer"
+ echo "See https://semver.org/ for more details on SemVer"
+ exit 1
+ fi
+
git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")"
git fetch "$PATCH_DIR/$PROJECT.bundle"
git merge --ff-only FETCH_HEAD
git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")"
git fetch "$PATCH_DIR/$PROJECT.bundle"
git merge --ff-only FETCH_HEAD
- git tag -am "$PROJECT $VERSION" "v$VERSION"
- sigul --batch -c "$SIGUL_CONFIG" sign-git-tag "$SIGUL_KEY" v"$VERSION" < "$SIGUL_PASSWORD"
+ git tag -am "$PROJECT $VERSION" "$VERSION"
+ sigul --batch -c "$SIGUL_CONFIG" sign-git-tag "$SIGUL_KEY" "$VERSION" < "$SIGUL_PASSWORD"
echo "Showing latest signature for $PROJECT:"
git log --show-signature -n1
echo "Showing latest signature for $PROJECT:"
git log --show-signature -n1
########## Merge Part ##############
if [[ "$JOB_NAME" =~ "merge" ]]; then
echo "Running merge"
########## Merge Part ##############
if [[ "$JOB_NAME" =~ "merge" ]]; then
echo "Running merge"
- git push origin "v$VERSION"
+ git push origin "$VERSION"
lftools nexus release --server "$NEXUS_URL" "$STAGING_REPO"
if [ "${MAVEN_CENTRAL_URL}" == 'None' ]; then
echo "No Maven central url specified, not pushing to maven central"
lftools nexus release --server "$NEXUS_URL" "$STAGING_REPO"
if [ "${MAVEN_CENTRAL_URL}" == 'None' ]; then
echo "No Maven central url specified, not pushing to maven central"