Skip to content

Instantly share code, notes, and snippets.

@dosaboy
Created March 21, 2016 21:48
Show Gist options
  • Save dosaboy/7ae026a632c86933a4ab to your computer and use it in GitHub Desktop.
Save dosaboy/7ae026a632c86933a4ab to your computer and use it in GitHub Desktop.
#!/bin/bash -eu
#
# Build hardening.io test charm from layer
#
(($# > 0)) || { echo "USAGE: `basename $0` os|ssh|mysql|apache"; exit 1; }
set -x
mod=$1
target=charms/hardening-$mod-tests-charm
layer=layers/hardening-$mod-tests
results=/tmp/charm_build_results
mkdir -p $results
result=$results/trusty/`basename $layer`
url=git+ssh://git.launchpad.net/~openstack-charmers/charms/+source/hardening-$mod-tests-charm
if [ -d "$result" ]; then
(cd $result; git pull origin master;)
else
create=false
git clone git+ssh://git.launchpad.net/~openstack-charmers/charms/+source/hardening-$mod-tests-charm $result || create=true
if $create; then
mkdir -p $result
(cd $result; git init; git remote add origin $url;)
fi
fi
# Build charm from layer
(cd $layer; git pull origin master; charm generate -o $results;)
# Push charm to launchpad
(cd $result; git add *; git commit -m "build of hardening-$mod-tests";
git push origin master;)
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment