Add bashate testing
bashate is pep8 for bash scripts. This adds a bashate target to tox.ini and cleans up any pre-existing issues. The target was originally copied from devstack and then modified to remove things that aren't in release-tools. Change-Id: I2d38c0a17099a687b6ab33737c513be839118ff0
This commit is contained in:
parent
2f2f552c86
commit
1460868d81
77
milestone.sh
77
milestone.sh
|
@ -34,35 +34,35 @@ LPROJECT="$PROJECT"
|
|||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
if [[ "$PROJECT" == "swift" ]]; then
|
||||
echo "Swift mode: skipping fixreleasing (bugs should be set at RC time)"
|
||||
SKIPBUGS=1
|
||||
IS_RELEASE=1
|
||||
echo "Swift mode: skipping fixreleasing (bugs should be set at RC time)"
|
||||
SKIPBUGS=1
|
||||
IS_RELEASE=1
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == "oslo-incubator" ]]; then
|
||||
echo "Oslo-incubator mode: skipping tarball generation and upload"
|
||||
SKIPTARBALL=1
|
||||
SKIPUPLOAD=1
|
||||
echo "Oslo-incubator mode: skipping tarball generation and upload"
|
||||
SKIPTARBALL=1
|
||||
SKIPUPLOAD=1
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == neutron-* ]]; then
|
||||
echo "Neutron advanced services mode: skipping bugs and upload to neutron"
|
||||
SKIPBUGS=1
|
||||
LPROJECT="neutron"
|
||||
echo "Neutron advanced services mode: skipping bugs and upload to neutron"
|
||||
SKIPBUGS=1
|
||||
LPROJECT="neutron"
|
||||
fi
|
||||
|
||||
title "Resolving $MILESTONE to version"
|
||||
if [[ "$IS_RELEASE" == "1" ]]; then
|
||||
VERSION=$MILESTONE
|
||||
RELVERSION=$MILESTONE
|
||||
VERSION=$MILESTONE
|
||||
RELVERSION=$MILESTONE
|
||||
else
|
||||
VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $MILESTONE`
|
||||
RELVERSION=${VERSION:0:8}
|
||||
VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $MILESTONE`
|
||||
RELVERSION=${VERSION:0:8}
|
||||
fi
|
||||
echo "$MILESTONE is $VERSION (final being $RELVERSION)"
|
||||
|
||||
|
@ -77,13 +77,13 @@ HEADSHA=`git log -1 HEAD --format='%H'`
|
|||
|
||||
title "Tagging $TARGETSHA as $VERSION"
|
||||
if [[ "$IS_RELEASE" == "1" ]]; then
|
||||
TAGMSG="${PROJECT^} $VERSION release"
|
||||
TAGMSG="${PROJECT^} $VERSION release"
|
||||
else
|
||||
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
|
||||
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
|
||||
fi
|
||||
echo "Tag message is '$TAGMSG'"
|
||||
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
|
||||
echo "Warning: target SHA does not correspond to HEAD"
|
||||
echo "Warning: target SHA does not correspond to HEAD"
|
||||
fi
|
||||
git tag -m "$TAGMSG" -s "$VERSION" $TARGETSHA
|
||||
git push gerrit $VERSION
|
||||
|
@ -94,33 +94,34 @@ cd ../..
|
|||
rm -rf $MYTMPDIR
|
||||
|
||||
if [[ "$SKIPTARBALL" != "1" ]]; then
|
||||
title "Waiting for tarball from $REALSHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $REALSHA
|
||||
title "Waiting for tarball from $REALSHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $REALSHA
|
||||
|
||||
title "Checking tarball is similar to last master.tar.gz"
|
||||
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
|
||||
echo "It will probably be a bit different since target is not HEAD."
|
||||
fi
|
||||
$TOOLSDIR/similar_tarballs.sh $PROJECT master $VERSION
|
||||
read -sn 1 -p "Press any key to continue..."
|
||||
title "Checking tarball is similar to last master.tar.gz"
|
||||
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
|
||||
echo "It will probably be a bit different since target is not HEAD."
|
||||
fi
|
||||
$TOOLSDIR/similar_tarballs.sh $PROJECT master $VERSION
|
||||
read -sn 1 -p "Press any key to continue..."
|
||||
fi
|
||||
|
||||
if [[ "$SKIPBUGS" != "1" ]]; then
|
||||
title "Setting FixCommitted bugs to FixReleased"
|
||||
$TOOLSDIR/process_bugs.py $LPROJECT --settarget=$MILESTONE --fixrelease
|
||||
read -sn 1 -p "Fix any leftover bugs manually and press key to continue..."
|
||||
title "Setting FixCommitted bugs to FixReleased"
|
||||
$TOOLSDIR/process_bugs.py $LPROJECT --settarget=$MILESTONE --fixrelease
|
||||
read -sn 1 -p "Fix any leftover bugs manually and press key to continue..."
|
||||
fi
|
||||
|
||||
if [[ "$SKIPUPLOAD" != "1" ]]; then
|
||||
title "Uploading tarball to Launchpad"
|
||||
if [[ "$IS_RELEASE" == "1" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --deliverable=$PROJECT
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --deliverable=$PROJECT \
|
||||
--milestone=$MILESTONE
|
||||
fi
|
||||
title "Uploading tarball to Launchpad"
|
||||
if [[ "$IS_RELEASE" == "1" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION \
|
||||
--deliverable=$PROJECT
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION \
|
||||
--deliverable=$PROJECT --milestone=$MILESTONE
|
||||
fi
|
||||
else
|
||||
title "Marking milestone as released in Launchpad"
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --deliverable=$PROJECT \
|
||||
title "Marking milestone as released in Launchpad"
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --deliverable=$PROJECT \
|
||||
--milestone=$MILESTONE --nop
|
||||
fi
|
||||
|
|
44
rccut.sh
44
rccut.sh
|
@ -33,32 +33,32 @@ PROJECT=$3
|
|||
LPROJECT="$PROJECT"
|
||||
|
||||
if [[ "$PROJECT" == "oslo-incubator" ]]; then
|
||||
echo "Oslo-incubator mode: skipping tarball check"
|
||||
SKIPTARBALL=1
|
||||
echo "Oslo-incubator mode: skipping tarball check"
|
||||
SKIPTARBALL=1
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == neutron-* ]]; then
|
||||
echo "Neutron advanced services mode: skipping bugs"
|
||||
SKIPBUGS=1
|
||||
LPROJECT="neutron"
|
||||
echo "Neutron advanced services mode: skipping bugs"
|
||||
SKIPBUGS=1
|
||||
LPROJECT="neutron"
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == "swift" ]]; then
|
||||
if [[ $# -eq 4 ]]; then
|
||||
RC1MILESTONE="$4-rc1"
|
||||
else
|
||||
echo "Missing Swift final version number argument !"
|
||||
exit 2
|
||||
fi
|
||||
if [[ $# -eq 4 ]]; then
|
||||
RC1MILESTONE="$4-rc1"
|
||||
else
|
||||
echo "Missing Swift final version number argument !"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
RC1MILESTONE="$SERIES-rc1"
|
||||
RC1MILESTONE="$SERIES-rc1"
|
||||
fi
|
||||
|
||||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
title "Checking that $RC1MILESTONE exists"
|
||||
|
@ -72,10 +72,10 @@ cd $PROJECT
|
|||
LANG=C git review -s
|
||||
|
||||
if $(git branch -r | grep proposed > /dev/null); then
|
||||
echo "A *proposed* branch already exists !"
|
||||
cd ../..
|
||||
rm -rf $MYTMPDIR
|
||||
exit 1
|
||||
echo "A *proposed* branch already exists !"
|
||||
cd ../..
|
||||
rm -rf $MYTMPDIR
|
||||
exit 1
|
||||
fi
|
||||
|
||||
title "Creating proposed/$SERIES at $SHA"
|
||||
|
@ -88,11 +88,11 @@ cd ../..
|
|||
rm -rf $MYTMPDIR
|
||||
|
||||
if [[ "$SKIPTARBALL" != "1" ]]; then
|
||||
title "Waiting for tarball from $REALSHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $REALSHA
|
||||
title "Waiting for tarball from $REALSHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $REALSHA
|
||||
fi
|
||||
|
||||
if [[ "$SKIPBUGS" != "1" ]]; then
|
||||
title "Setting FixCommitted bugs to FixReleased"
|
||||
$TOOLSDIR/process_bugs.py $LPROJECT --settarget=$RC1MILESTONE --fixrelease
|
||||
title "Setting FixCommitted bugs to FixReleased"
|
||||
$TOOLSDIR/process_bugs.py $LPROJECT --settarget=$RC1MILESTONE --fixrelease
|
||||
fi
|
||||
|
|
103
rcdelivery.sh
103
rcdelivery.sh
|
@ -33,52 +33,52 @@ PROJECT=$3
|
|||
LPROJECT="$PROJECT"
|
||||
|
||||
if [[ "$PROJECT" == "oslo-incubator" ]]; then
|
||||
echo "Oslo-incubator mode: skipping tarball generation and upload"
|
||||
SKIPTARBALL=1
|
||||
SKIPUPLOAD=1
|
||||
echo "Oslo-incubator mode: skipping tarball generation and upload"
|
||||
SKIPTARBALL=1
|
||||
SKIPUPLOAD=1
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == neutron-* ]]; then
|
||||
echo "Neutron advanced services mode: upload to Neutron Launchpad project"
|
||||
LPROJECT="neutron"
|
||||
echo "Neutron advanced services mode: upload to Neutron Launchpad project"
|
||||
LPROJECT="neutron"
|
||||
fi
|
||||
|
||||
if [[ "$PROJECT" == "swift" ]]; then
|
||||
if [[ $# -eq 4 ]]; then
|
||||
FINALVERSION=$4
|
||||
else
|
||||
echo "Missing Swift final version number argument !"
|
||||
exit 2
|
||||
fi
|
||||
if [[ $# -eq 4 ]]; then
|
||||
FINALVERSION=$4
|
||||
else
|
||||
echo "Missing Swift final version number argument !"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
title "Resolving $LPROJECT $SERIES $RC to version"
|
||||
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
if [[ "$LPROJECT" != "swift" ]]; then
|
||||
RC1VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $SERIES-rc1`
|
||||
FINALVERSION=${RC1VERSION:0:8}
|
||||
fi
|
||||
MILESTONE=$FINALVERSION
|
||||
VERSION=$FINALVERSION
|
||||
$TOOLSDIR/ms2version.py --onlycheck $LPROJECT $MILESTONE
|
||||
else
|
||||
if [[ "$LPROJECT" != "swift" ]]; then
|
||||
MILESTONE="$SERIES-$RC"
|
||||
VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $MILESTONE`
|
||||
FINALVERSION=${VERSION:0:8}
|
||||
else
|
||||
MILESTONE="$FINALVERSION-$RC"
|
||||
VERSION="${FINALVERSION}$RC"
|
||||
if [[ "$LPROJECT" != "swift" ]]; then
|
||||
RC1VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $SERIES-rc1`
|
||||
FINALVERSION=${RC1VERSION:0:8}
|
||||
fi
|
||||
MILESTONE=$FINALVERSION
|
||||
VERSION=$FINALVERSION
|
||||
$TOOLSDIR/ms2version.py --onlycheck $LPROJECT $MILESTONE
|
||||
fi
|
||||
else
|
||||
if [[ "$LPROJECT" != "swift" ]]; then
|
||||
MILESTONE="$SERIES-$RC"
|
||||
VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $MILESTONE`
|
||||
FINALVERSION=${VERSION:0:8}
|
||||
else
|
||||
MILESTONE="$FINALVERSION-$RC"
|
||||
VERSION="${FINALVERSION}$RC"
|
||||
$TOOLSDIR/ms2version.py --onlycheck $LPROJECT $MILESTONE
|
||||
fi
|
||||
fi
|
||||
echo "$SERIES $RC (milestone $MILESTONE) is version $VERSION"
|
||||
echo "Final $SERIES version will be $FINALVERSION"
|
||||
|
@ -91,9 +91,9 @@ cd $PROJECT
|
|||
LANG=C git review -s
|
||||
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
TAGMSG="${PROJECT^} $VERSION"
|
||||
TAGMSG="${PROJECT^} $VERSION"
|
||||
else
|
||||
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
|
||||
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
|
||||
fi
|
||||
title "Tagging $VERSION ($TAGMSG)"
|
||||
git tag -m "$TAGMSG" -s "$VERSION"
|
||||
|
@ -101,31 +101,32 @@ SHA=`git show-ref -s "$VERSION"`
|
|||
git push gerrit $VERSION
|
||||
|
||||
if [[ "$SKIPTARBALL" != "1" ]]; then
|
||||
title "Waiting for tarball from $SHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $SHA
|
||||
title "Waiting for tarball from $SHA"
|
||||
$TOOLSDIR/wait_for_tarball.py $SHA
|
||||
|
||||
title "Checking tarball is similar to last proposed-$SERIES.tar.gz"
|
||||
$TOOLSDIR/similar_tarballs.sh $PROJECT proposed-$SERIES $VERSION
|
||||
read -sn 1 -p "Press any key to continue..."
|
||||
title "Checking tarball is similar to last proposed-$SERIES.tar.gz"
|
||||
$TOOLSDIR/similar_tarballs.sh $PROJECT proposed-$SERIES $VERSION
|
||||
read -sn 1 -p "Press any key to continue..."
|
||||
fi
|
||||
|
||||
if [[ "$SKIPUPLOAD" != "1" ]]; then
|
||||
title "Uploading tarball to Launchpad"
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION --deliverable=$PROJECT
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --milestone=$MILESTONE
|
||||
fi
|
||||
title "Uploading tarball to Launchpad"
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --milestone=$MILESTONE
|
||||
fi
|
||||
else
|
||||
title "Marking milestone as released in Launchpad"
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --nop
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --milestone=$MILESTONE --nop
|
||||
fi
|
||||
title "Marking milestone as released in Launchpad"
|
||||
if [[ "$RC" == "final" ]]; then
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --nop
|
||||
else
|
||||
$TOOLSDIR/upload_release.py $LPROJECT $FINALVERSION \
|
||||
--deliverable=$PROJECT --milestone=$MILESTONE --nop
|
||||
fi
|
||||
fi
|
||||
|
||||
title "Cleaning up"
|
||||
|
|
|
@ -41,8 +41,8 @@ PROJECT=$4
|
|||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
if [[ $VERSION == *a* ]]; then
|
||||
|
@ -95,8 +95,8 @@ else
|
|||
fi
|
||||
|
||||
if [[ "$ALPHA_RELEASE" != "1" ]]; then
|
||||
title "Renaming next-$SERIES to $VERSION"
|
||||
$TOOLSDIR/rename_milestone.py $PROJECT next-$SERIES $VERSION
|
||||
title "Renaming next-$SERIES to $VERSION"
|
||||
$TOOLSDIR/rename_milestone.py $PROJECT next-$SERIES $VERSION
|
||||
fi
|
||||
|
||||
title "Setting FixCommitted bugs to FixReleased"
|
||||
|
@ -105,6 +105,6 @@ read -sn 1 -p "Fix any leftover bugs manually and press key to continue..."
|
|||
echo
|
||||
|
||||
if [[ "$ALPHA_RELEASE" != "1" ]]; then
|
||||
title "Marking milestone as released in Launchpad"
|
||||
$TOOLSDIR/upload_release.py $PROJECT $VERSION --milestone=$TARGET --nop
|
||||
title "Marking milestone as released in Launchpad"
|
||||
$TOOLSDIR/upload_release.py $PROJECT $VERSION --milestone=$TARGET --nop
|
||||
fi
|
||||
|
|
|
@ -34,8 +34,8 @@ PROJECT="swift"
|
|||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
title "Checking that milestone exists for $VERSION"
|
||||
|
@ -54,7 +54,7 @@ title "Tagging $TARGETSHA as $RCVERSION"
|
|||
TAGMSG="${PROJECT^} $RCVERSION"
|
||||
echo "Tag message is '$TAGMSG'"
|
||||
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
|
||||
echo "Warning: target SHA does not correspond to HEAD"
|
||||
echo "Warning: target SHA does not correspond to HEAD"
|
||||
fi
|
||||
git tag -m "$TAGMSG" -s "$RCVERSION" $TARGETSHA
|
||||
git push gerrit $RCVERSION
|
||||
|
@ -65,7 +65,7 @@ $TOOLSDIR/wait_for_tarball.py $REALSHA
|
|||
|
||||
title "Checking tarball is similar to last master.tar.gz"
|
||||
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
|
||||
echo "It will probably be a bit different since target is not HEAD."
|
||||
echo "It will probably be a bit different since target is not HEAD."
|
||||
fi
|
||||
$TOOLSDIR/similar_tarballs.sh $PROJECT master $RCVERSION
|
||||
read -sn 1 -p "Press any key to continue..."
|
||||
|
|
13
tox.ini
13
tox.ini
|
@ -1,6 +1,6 @@
|
|||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = py27,pep8
|
||||
envlist = py27,pep8,bashate
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
|
@ -18,6 +18,17 @@ commands = python setup.py testr --slowest --testr-args='{posargs}'
|
|||
deps = flake8
|
||||
commands = flake8
|
||||
|
||||
[testenv:bashate]
|
||||
deps = bashate
|
||||
whitelist_externals = bash
|
||||
commands = bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs
|
||||
-type f \ # only files
|
||||
-not -name \*~ \ # skip editors, readme, etc
|
||||
-not -name \*.md \
|
||||
-name \*.sh \
|
||||
-print0 | xargs -0 bashate -v"
|
||||
|
||||
[testenv:venv]
|
||||
#commands = {posargs}
|
||||
|
||||
|
|
Loading…
Reference in New Issue