Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 13:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sample Jenkins build script to generate output via DITA-OT & copy results to web server
# This script is run by Jenkins to execute all tests.
# It gets passed two parameters, the first one is either "ci" or "nightly" to
# indicate what kind of tests should be run. The second one is the branch that
# is being tested. This script should either work for all branches (makes
# merging easier) or each branch contains code that is specific for this branch,
# in which case you might want to double check that everything works after
# merging.
# Call this script (`build-files/jenkins`) in the Build section of the Jenkins
# job configuration via Add build step > Execute shell > command:
# BRANCH=$(basename $GIT_BRANCH)
# ./build-files/jenkins ci $BRANCH
if [ "$1" == "ci" ]; then
echo "Continuous integration check for branch $2"
set +e # if one command fails then exit
# Run documentation build script, which sets up the DITA-OT environment & runs Ant tasks to build output
bash build-files/
BRANCH=$(basename $GIT_BRANCH)
# Clean & re-create target output directory before moving the new generated output
rm -r /var/www/$BRANCH/manual
mkdir /var/www/$BRANCH/manual
# Copy all `output` subfolders to Web server "as-is"
cp -r output/* /var/www/$BRANCH/manual
exit $RET
elif [ "$1" == "nightly" ]; then
echo "Nightly check for branch $2"
#make || RET=1
exit $RET
echo "Unknown parameter: $1" && exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment