Revision a9fd6243
Added by Dominic Cleal over 10 years ago
build_modules | ||
---|---|---|
#!/bin/bash
|
||
|
||
for d in modules/*; do
|
||
[ -d $d ] || continue
|
||
[ -e $d/Modulefile ] || continue
|
||
egrep -q "^name.*theforeman" $d/Modulefile || continue
|
||
pushd $d
|
||
if ! puppet module build .; then
|
||
echo "ERROR: failed to build $d" >&2
|
||
exit 1
|
||
fi
|
||
popd
|
||
done
|
||
|
||
[ -d pkg ] || mkdir pkg
|
||
mv modules/*/pkg/theforeman*gz pkg/
|
||
|
||
exit 0
|
bump_modules | ||
---|---|---|
#!/bin/bash
|
||
#
|
||
# bump_modules 1.3.0 1.4.0-rc1
|
||
#
|
||
[ -z "$1" -o -z "$2" ] && echo "Usage: $0 from to" && exit
|
||
|
||
for MODFILE in $(grep source modules/*/Modulefile | grep theforeman | awk -F':' '{ print $1 }'); do
|
||
echo Working on $MODFILE
|
||
pushd $(dirname $MODFILE)
|
||
git checkout master && \
|
||
git pull && \
|
||
sed -i "s/$1/$2/" $(basename $MODFILE) && \
|
||
git diff && \
|
||
echo "Okay to commit and push? (ENTER or Ctrl-C)" && read && \
|
||
git commit -a -m "Release $2" && git pull --rebase && git push origin master
|
||
popd
|
||
done
|
release_module | ||
---|---|---|
#!/bin/bash -e
|
||
|
||
die() {
|
||
echo $* >&2
|
||
exit 1
|
||
}
|
||
|
||
if [ $# -ne 2 -o x$1 = "x-h" -o x$1 = "x--help" ]; then
|
||
echo "usage: $0 <module name> <version>"
|
||
echo
|
||
echo " update CHANGELOG.md before running this script and git add or commit it"
|
||
echo " only local changes will be made, no git pushes"
|
||
echo
|
||
die "incorrect arguments supplied"
|
||
fi
|
||
|
||
MODULE=$1
|
||
VERSION=$2
|
||
|
||
test -d modules/$MODULE || die "no such module $MODULE"
|
||
test -e modules/$MODULE/CHANGELOG.md || die "no CHANGELOG.md found in $MODULE"
|
||
test -e modules/$MODULE/Modulefile || die "no Modulefile found in $MODULE"
|
||
grep -q '^version' modules/$MODULE/Modulefile || die "no version found in Modulefile"
|
||
grep -xq "## ${VERSION}" modules/$MODULE/CHANGELOG.md || die "no '## ${VERSION}' found in CHANGELOG. Do this first, and add to your index or commit it."
|
||
(cd modules/$MODULE && git rev-parse $VERSION >/dev/null 2>&1) && die "tag for ${VERSION} already exists"
|
||
(cd modules/$MODULE && [ x$(git rev-parse --abbrev-ref HEAD) = xmaster ] ) || die "$MODULE isn't on master branch"
|
||
(cd modules/$MODULE && [ x$(git diff --shortstat -- CHANGELOG.md | wc -l) = x0 ] ) || die "CHANGELOG.md isn't in the git index or committed"
|
||
[[ "$VERSION" =~ ^[0-9\.]+$ ]] || die "invalid version number"
|
||
type puppet >/dev/null 2>&1 || die "puppet not installed"
|
||
|
||
TMPDIR=$(mktemp -d)
|
||
trap "rm -rf $TMPDIR" EXIT ERR
|
||
|
||
pushd modules/$MODULE >/dev/null
|
||
sed -i "/^version/ s/ .*/ '${VERSION}'/" Modulefile
|
||
git add Modulefile
|
||
git ci -m "Release ${VERSION}"
|
||
git tag -m "Release ${VERSION}" $VERSION
|
||
git archive $VERSION | (cd $TMPDIR && tar -xf -)
|
||
popd >/dev/null
|
||
|
||
# Use a clean copy, as p-m-build isn't good at ignoring files
|
||
puppet module build $TMPDIR
|
||
PKGS=$(cd $TMPDIR/pkg && echo *.tar.gz)
|
||
cp -a $TMPDIR/pkg/* pkg/
|
||
|
||
echo
|
||
echo Built pkgs/$PKGS
|
||
echo
|
||
echo 'Next steps:'
|
||
echo " 1. cd modules/${MODULE} && git push origin master && git push origin ${VERSION}"
|
||
echo " 2. visit http://forge.puppetlabs.com/theforeman/${MODULE} and log in"
|
||
echo " 3. click Upload a New Release, and upload $(pwd)/pkgs/$PKGS"
|
Also available in: Unified diff
Add new script to tag and build modules consistently