Created
April 6, 2017 04:52
-
-
Save Kuchitama/4cb317060075a3ef10acab40d6d86d98 to your computer and use it in GitHub Desktop.
redash_backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
stage('dump redash postgre') { | |
sh ''' | |
cid=`/usr/local/bin/docker ps | grep redash_postgres | /usr/bin/awk '{print $1}'` | |
if [ -z "${cid}" ] | |
then | |
return 1; | |
else | |
ts=`date +%Y%m%d` | |
/usr/local/bin/docker exec ${cid} /bin/bash -c 'pg_dump -U postgres postgres | gzip > /usr/local/redash.gz' | |
/usr/local/bin/docker cp ${cid}:/usr/local/redash.gz redash.gz | |
fi | |
''' | |
archiveArtifacts artifacts: 'redash.gz', onlyIfSuccessful: true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment