Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #336: Allow site environment to be parameterized in pantheon:fetch-db. #583

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ includes:
| | |
|--------------------------|-----------------------------------------------------------------------------|
| `task pantheon:fetch-db` | Fetches a database from Pantheon. Set `PANTHEON_SITE_ID` in Taskfile `vars` |
| | and optionally `ENVIRONMENT` to override the default value of `live` |

See below for CI specific integrations for hosting providers.

Expand Down
3 changes: 2 additions & 1 deletion tasks/pantheon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ tasks:
desc: "Fetches a database from Pantheon"
env:
DB_DIR: '{{default "/var/www/html/files/db" .DB_DIR}}'
ENVIRONMENT: '{{default "live" .ENVIRONMENT}}'
cmds:
- rm -f $DB_DIR/db.sql.gz $DB_DIR/db.sql
- if [ -z "$PANTHEON_TOKEN" ]; then echo "PANTHEON_TOKEN is empty, please add it to your .env file"; exit 1; fi
- echo "⚡ Authorising with Pantheon"
- terminus auth:login --machine-token="${PANTHEON_TOKEN}"
- echo "⚡ Fetching database from Pantheon"
- terminus backup:get {{.PANTHEON_SITE_ID}}.live --element=db --to=$DB_DIR/db.sql.gz
- terminus backup:get {{.PANTHEON_SITE_ID}}.$ENVIRONMENT --element=db --to=$DB_DIR/db.sql.gz
Loading