Jenkins shell script for anyone interested


#1

This is the shell script Jenkins executes for a project I’m working on. It first pulls an update from our internal meteor packages repository, then securely copies settings.json (as it may contain keys, so we don’t store these on GitHub) from a remote server, then builds/deploys using mup. I’ve xxx’d out private stuff.

Of course if anyone has any ideas to improve, I’m all ears. Otherwise, just sharing in case it helps anyone!

#!/bin/sh

set -ex

if [ ! -d $JENKINS_HOME/meteor-packages ]; then
  git clone git@github.com:<xxx>/meteor-packages.git $JENKINS_HOME/meteor-packages
else
  cd $JENKINS_HOME/meteor-packages
  git pull
fi

export PACKAGE_DIRS=$JENKINS_HOME/meteor-packages

cd $WORKSPACE/deploy-prod
scp deploy@meteor-prod.<xxx>.com:mup-settings/<xxx>/settings.json .
mup setup
mup deploy

#2

Thanks for sharing! We are working on this task in a project currently :smile:


#3

No problem, glad it helped!