Last active
May 4, 2020 17:00
-
-
Save facine/d8a8e92f2f9d8344ad689408758c5886 to your computer and use it in GitHub Desktop.
Import a fresh database from jenkins
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
#!/bin/bash | |
## Description: Import a fresh database from jenkins | |
## Usage: pull-db | |
## Go to https://jenkins.example.org/user/YOUR_USER/configure and add a new token | |
USER="JENKINS_USER" | |
TOKEN="JENKINS_TOKEN" | |
ARTIFACT="LAST_SUCCESSFUL_ARTIFACT_URL" | |
EXTRACT_PATH="" | |
case $OSTYPE in | |
linux-gnu | "darwin"* ) | |
FILENAME=$(basename $ARTIFACT) | |
$(wget --auth-no-challenge --http-user=$USER --http-password=$TOKEN $ARTIFACT -O /tmp/$FILENAME) | |
if [ $? -ne 0 ]; then | |
echo "Error pulling the database..." | |
else | |
ddev import-db --src /tmp/$FILENAME --extract-path $EXTRACT_PATH | |
rm /tmp/$FILENAME | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment