Skip to content

Instantly share code, notes, and snippets.

@jdorrance
Forked from asabaylus/gist:5831604
Created June 21, 2013 14:36
Show Gist options
  • Save jdorrance/5831608 to your computer and use it in GitHub Desktop.
Save jdorrance/5831608 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"
#Deploy
UIARTFCT="org.acs.cq-code-SNAPSHOT"
UILOC="./"
AUTHORHOST="${bamboo.cqAuthorHost}"
AUTHORPORT="${bamboo.cqAuthorPort}"
AUTHORPROTOCOL="${bamboo.cqProtocol}"
USER="${bamboo.cqAuthorUser}"
PASSWORD="${bamboo.cqAuthorPassword}"
cd ${UILOC}
echo
echo 'Listing Directory Contents'
ls -lah
echo
echo
echo 'Uploading Package'
UPLOAD=$(curl -u "${USER}":"${PASSWORD}" -F package=@"${UIARTFCT}.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'
INSTALL=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}.zip?cmd=install")
echo $INSTALL
if [[ $INSTALL =~ .*installed* ]]
then
echo "Upload Successful"
else
echo "Upload Unsuccessful"
exit 1
fi
echo
#DONE check for {"success":true,"msg":"Package installed"} response
echo 'Replicating Package'
REPLICATE=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}.zip?cmd=replicate")
echo $REPLICATE
if [[ $REPLICATE =~ .*replicated* ]]
then
echo "Upload Successful"
else
echo "Upload Unsuccessful"
exit 1
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment