Skip to content

Instantly share code, notes, and snippets.

@Kuchitama
Created April 6, 2017 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kuchitama/4cb317060075a3ef10acab40d6d86d98 to your computer and use it in GitHub Desktop.
Save Kuchitama/4cb317060075a3ef10acab40d6d86d98 to your computer and use it in GitHub Desktop.
redash_backup
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