Skip to content

Instantly share code, notes, and snippets.

@facine
Last active May 4, 2020 17:00
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 facine/d8a8e92f2f9d8344ad689408758c5886 to your computer and use it in GitHub Desktop.
Save facine/d8a8e92f2f9d8344ad689408758c5886 to your computer and use it in GitHub Desktop.
Import a fresh database from jenkins
#!/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