Thursday, November 28, 2013

Gradle - Release Script on Jenkins

You just put the following this to the Execute shell of the Post Steps on Jenkins.
APP_HOME=/usr/local/app
APP_NAME=appName
APP_JAR=appName.jar
APP_ZIP=appName.zip
for ip in ${IP_ADDRESS}
do
scp -o StrictHostKeyChecking=no ${WORKSPACE}/build/distributions/${APP_ZIP} user_id@${ip}:${APP_HOME}/
ssh -o StrictHostKeyChecking=no user_id@${ip} /usr/bin/unzip -o ${APP_HOME}/${APP_ZIP} -d ${APP_HOME}/${APP_NAME}/
ssh -o StrictHostKeyChecking=no user_id@${ip} /bin/mv -v ${APP_HOME}/${APP_NAME}/${APP_JAR} ${APP_HOME}/${APP_NAME}/bin/
done
view raw release.sh hosted with ❤ by GitHub

Also, you need to configure the following option on Jenkins.
Build > invoke Gradle script > Invoke Gradle Gradle Version >> Default
Build > invoke Gradle script > Tasks >> zip

No comments:

Post a Comment