Skip to content

Instantly share code, notes, and snippets.

@jdorrance
Last active December 18, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jdorrance/5826119 to your computer and use it in GitHub Desktop.
Save jdorrance/5826119 to your computer and use it in GitHub Desktop.
#GLOBAL
HTTPRESPONSE="json"
SUCCESS="success"
#TEST
#UIARTFCT="org.acs.cq-code-476"
#UILOC="/appl/bamboo-home/xml-data/build-dir/393217/CQ5-MASTER-JOB1/ui/target/"
#AUTHORHOST="cmsautdev.acs.org"
#AUTHORPORT="443"
#AUTHORPROTOCOL="https://"
#USER="admin"
#PASSWORD="admin"
#VERSION="1.0-SNAPSHOT"
#Deploy
UIARTFCT="org.acs.cq-code"
UILOC="./"
AUTHORHOST="${bamboo.cqAuthorHost}"
AUTHORPORT="${bamboo.cqAuthorPort}"
AUTHORPROTOCOL="${bamboo.cqProtocol}"
USER="${bamboo.cqAuthorUser}"
PASSWORD="${bamboo.cqAuthorPassword}"
VERSION="${bamboo.mvnVersion}"
cd ${UILOC}
echo
echo 'Listing Directory Contents'
pwd
ls -lah
echo
echo
echo 'Uploading Package'
echo "package file name : ${UIARTFCT}-${VERSION}.jar"
echo "posting to ${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/?cmd=upload"
UPLOAD=$(curl -u "${USER}":"${PASSWORD}" -F package=@"${UIARTFCT}-${VERSION}.jar" -F force=true "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/?cmd=upload")
echo $UPLOAD
if [[ $UPLOAD =~ .*uploaded* ]]
then
echo "Upload Successful"
else
echo "Upload Unsuccessful"
exit 1
fi
echo
#DONE check for {"success":true,"msg":"Package uploaded","path":"/etc/packages/org.acs.cq-code-476.zip"}
echo 'Installing Package:'
echo "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}-${VERSION}.zip?cmd=install"
INSTALL=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}-${VERSION}.zip?cmd=install")
echo $INSTALL
if [[ $INSTALL =~ .*installed* ]]
then
echo "Installation Successful"
else
echo "Installation Unsuccessful"
exit 1
fi
echo
#DONE check for {"success":true,"msg":"Package installed"} response
echo 'Replicating Package:'
echo "posting to ${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}-${VERSION}.zip?cmd=replicate"
REPLICATE=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}-${VERSION}.zip?cmd=replicate")
echo $REPLICATE
if [[ $REPLICATE =~ .*replicated* ]]
then
echo "Replication Successful"
else
echo "Replication Unsuccessful"
exit 1
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment