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 #204: Add a task for interacting with Acquia #442

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,18 @@ includes:

See below for CI specific integrations for hosting providers.

### Acquia
Acquia specific tasks are contained in [`tasks/pantheon.yml`](tasks/pantheon.yml).
justafish marked this conversation as resolved.
Show resolved Hide resolved
Add the following to your `Taskfile.yml`'s `includes` section to use them:
```yml
includes:
acquia: ./vendor/lullabot/drainpipe/tasks/acquia.yml
```
| | |
|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `task acquia:fetch-db` | Fetches a database from Pantheon. Set `ACQUIA_ENVIRONMENT_ID` in Taskfile `vars`, along with `ACQUIA_API_KEY` and `ACQUIA_API_SECRET` as environment variables |
justafish marked this conversation as resolved.
Show resolved Hide resolved


## GitHub Actions Integration

Add the following to `composer.json` for generic GitHub Actions that will be
Expand Down
19 changes: 19 additions & 0 deletions tasks/acquia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'

tasks:
fetch-db:
desc: "Fetches a database from Acquia"
env:
DB_DIR: '{{default "/var/www/html/files/db" .DB_DIR}}'
justafish marked this conversation as resolved.
Show resolved Hide resolved
cmds:
- mkdir -p $DB_DIR
- rm -f $DB_DIR/db.sql.gz $DB_DIR/db.sql
- if [ -z "$ACQUIA_API_KEY" ]; then echo "ACQUIA_API_KEY is empty, please add it to your .env file"; exit 1; fi
- if [ -z "$ACQUIA_API_SECRET" ]; then echo "ACQUIA_API_SECRET is empty, please add it to your .env file"; exit 1; fi
- echo "💧 Authorising with Acquia"
- acli auth:login --no-interaction --key=${ACQUIA_API_KEY} --secret=${ACQUIA_API_SECRET}
- echo "💧 Fetching database from Acquia"
- acli pull:database {{.ACQUIA_ENVIRONMENT_ID}} default --no-import --no-interaction
justafish marked this conversation as resolved.
Show resolved Hide resolved
- |
DB=$(ls -t /tmp/*.sql.gz | head -1)
mv $DB $DB_DIR/db.sql.gz
Loading