forked from openshiftio/booster-common
-
Notifications
You must be signed in to change notification settings - Fork 1
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
DO NOT MERGE: Automate release scripts #100
Open
metacosm
wants to merge
5
commits into
master
Choose a base branch
from
automate-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
30a2521
Specify an SB version to release so that we can validate boosters.
metacosm 9eaf15f
Add initial automation steps. NOT TESTED!
metacosm 51e8f6a
Pass argument to catalog command.
metacosm 0bb1e50
Update README with details on the new scripts.
metacosm 7393777
Clean up.
metacosm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Releases a new BOM based on a new Spring Boot version | ||
# Updates the boosters for this new BOM so that they can be tested | ||
set -e | ||
|
||
# Defining some colors for output | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
BLUE='\033[0;34m' | ||
|
||
simple_log() { | ||
echo -e "${BLUE}${1}${NC}" | ||
} | ||
|
||
# get the directory of the script | ||
CMD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" | ||
|
||
# create a temporary directory WORK_DIR to be removed at the exit of the script | ||
# see: https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory | ||
# ==== | ||
WORK_DIR=$(mktemp -d) | ||
|
||
# check if tmp dir was created | ||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then | ||
simple_log "Could not create temp directory" | ||
exit 1 | ||
fi | ||
|
||
# deletes the temp directory | ||
function cleanup { | ||
rm -rf "$WORK_DIR" | ||
} | ||
|
||
# register the cleanup function to be called on the EXIT signal | ||
trap cleanup EXIT | ||
# ==== | ||
|
||
|
||
error() { | ||
echo -e "${RED}Error: ${1}${NC}" | ||
exit ${2:-1} | ||
} | ||
|
||
# compute BOM branch based on provided SB version | ||
simple_log "Releases a new BOM based on the specified Spring Boot version in the x.y.zz form." | ||
simple_log "Updates the boosters for this new BOM so that they can be tested." | ||
declare -r sbVersion=${1?"Must provide a target Spring Boot version in the x.y.zz form"} | ||
if [[ ${sbVersion} =~ ([1-9].[0-9]).([0-9]+) ]]; then | ||
sbMajorVersion="${BASH_REMATCH[1]}" | ||
bomBranch="sb-${sbMajorVersion}.x" | ||
nextBOMVersion="${sbMajorVersion}.$((BASH_REMATCH[2] + 1))-SNAPSHOT" | ||
else | ||
error "Unsupported Spring Boot version: ${sbVersion}" 1>&2 | ||
fi | ||
|
||
# Clone BOM project in temp dir | ||
cd ${WORK_DIR} | ||
git clone [email protected]:snowdrop/spring-boot-bom.git >/dev/null 2>/dev/null | ||
pushd spring-boot-bom | ||
git checkout ${bomBranch} | ||
|
||
# update the BOM based on SB version (presumably other dependencies have already been updated) | ||
pushd ${CMD_DIR}/src/ | ||
groovy update-pom.groovy ${WORK_DIR}/spring-boot-bom/pom.xml ${sbVersion} "hibernate.version=,hibernate-validator.version=" | ||
popd | ||
mvn install | ||
# TODO: Update BOM README notably to update Spring Boot version | ||
|
||
# release the BOM | ||
releaseVersion="${sbVersion}.Final" | ||
mvn -B release:prepare -Prelease -Dtag="${releaseVersion}" -DreleaseVersion="${releaseVersion}" -DdevelopmentVersion="${nextBOMVersion}" | ||
mvn release:perform -Prelease | ||
popd | ||
|
||
# update the boosters for the new SB version | ||
./for-all-boosters.sh -pn -l boosters-release set_maven_property -v "spring-boot-bom.version" "${releaseVersion}" | ||
./for-all-boosters.sh -f -l boosters-release set_maven_property -v "spring-boot.version" "${sbVersion}" | ||
./for-all-boosters.sh -f -l boosters-release change_version -v "${sbVersion}-1-SNAPSHOT" | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Defining some colors for output | ||
NC='\033[0m' # No Color | ||
BLUE='\033[0;34m' | ||
|
||
simple_log() { | ||
echo -e "${BLUE}${1}${NC}" | ||
} | ||
|
||
# create a temporary directory WORK_DIR to be removed at the exit of the script | ||
# see: https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory | ||
# ==== | ||
WORK_DIR=$(mktemp -d) | ||
|
||
# check if tmp dir was created | ||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then | ||
simple_log "Could not create temp directory" | ||
exit 1 | ||
fi | ||
|
||
# deletes the temp directory | ||
function cleanup { | ||
rm -rf "$WORK_DIR" | ||
} | ||
|
||
# register the cleanup function to be called on the EXIT signal | ||
trap cleanup EXIT | ||
# ==== | ||
|
||
simple_log "Script to release the boosters once QA has validated them with the prod BOM." | ||
simple_log "You need to be connected to the VPN to be able to successfully run this script." | ||
|
||
declare -r sbVersion=${1?"Must provide a target Spring Boot version in the x.y.zz form"} | ||
for-all-boosters.sh -pn -l ${WORK_DIR}/boosters-release release ${sbVersion} | ||
for-all-boosters.sh -f -l ${WORK_DIR}/boosters-release catalog ${sbVersion} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The qualifier should also be a parameter I would say