Last active
May 22, 2019 22:15
-
-
Save Roadmaster/e63da7e20694a2448b0e4bd37d3d45fd to your computer and use it in GitHub Desktop.
Bump crt release (with local testing)
This file contains hidden or 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
#/bin/bash | |
CRT_BRANCH=/src/click-reviewers-tools/review-tools # git branch | |
SCA_BRANCHES=/src/software-center-agent | |
WANTED_RELEASE=$1 | |
NEW_BRANCH=sca-crt-$WANTED_RELEASE | |
if [ -z $WANTED_RELEASE ]; then | |
echo "Didn't indicate a wanted release" | |
exit 1 | |
fi | |
test_snap_dir=$CRT_BRANCH/tests/ | |
# Bail if we can't pull tools or checkout the requested release | |
set -e | |
# Store dir I was in, before starting this mess. | |
pushd $CRT_BRANCH | |
# Pull and try to checkout requested commit/tag | |
git checkout master | |
git pull | |
git checkout $WANTED_RELEASE | |
set +e | |
# Run reviewer-tools tests on a simple snap, smoke test. | |
for the_snap in $test_snap_dir/busybox-static-mvo_2.snap; do | |
PYTHONPATH=$PWD ./bin/click-review --allow-classic $the_snap | |
if [ "$?" != "0" ]; then | |
echo "Tools failed, you should not push this" | |
cd $CRT_BRANCH | |
rm -rf $WANTED_RELEASE | |
exit 1 | |
fi | |
done | |
# After check, reset the git repo to origin/master | |
git checkout origin/master | |
echo "SUCCESS, preparing merge" | |
# Prepare merge for SCA with the review tools branch bump | |
cd $SCA_BRANCHES | |
(cd trunk && bzr pull) | |
bzr branch trunk $NEW_BRANCH | |
sed -i "s/review-tools;revno=.*/review-tools;revno=$WANTED_RELEASE/" $NEW_BRANCH/config-manager.txt | |
pushd $NEW_BRANCH | |
bzr commit -m "Bump review-tools to r$WANTED_RELEASE" | |
# Test new SCA branch with one extra commit | |
# NOTE: DB is assumed to be up in the sca-xenial container | |
ssh sca-xenial.lxd "cd /src/software-center-agent/$NEW_BRANCH/ && make clean && make bootstrap && make test ARGS='-c 20'" | |
if [ $? != 0 ]; then | |
echo "Tests failed, not pushing/committing" | |
exit 1 | |
else | |
echo "Tests passed, pushing/proposing" | |
fi | |
# if tests passed, push to Launchpad and propose | |
bzr push lp:~roadmr/software-center-agent/bump-crt-$WANTED_RELEASE | |
bzr lp-propose -m "Bump click-reviewers-tools to r${WANTED_RELEASE}" lp:software-center-agent | |
# Go back to original dir | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment