Skip to content

DB Restore for dev and feature branches #5

DB Restore for dev and feature branches

DB Restore for dev and feature branches #5

name: DB Restore for dev and feature branches
on:
workflow_dispatch:
inputs:
sourceFile:
type: string
description: |
The sourceFile of the backup in the bucket to restore, e.g.
ecamp-aws-setup-ecamp3devbucket58b42731-1kxz0xdiuxni8/dev/2023-07-17-12-55-33-dev.sql.gz.gpg
required: true
default: latest
pr_number:
type: number
description: |
The pr number if it is a pr (3898), else null
required: false
env:
type: environment
description: The environment, if name is dev then dev, else feature-branch
required: true
default: dev
jobs:
log_env:
name: log environment
runs-on: ubuntu-latest
steps:
- name: log environment
id: log-environment
run: |
REF=$(git rev-parse HEAD)
echo "Git SHA: $REF"
echo "sha=$REF" | tr -d "\n" >> $GITHUB_OUTPUT
echo "github:"
cat <<-HEREDOC
${{ toJSON(github) }}
HEREDOC
echo ""
echo "inputs:"
cat <<-HEREDOC
${{ toJSON(inputs) }}
HEREDOC
echo ""
echo "job:"
cat <<-HEREDOC
${{ toJSON(job) }}
HEREDOC
echo ""
echo "needs:"
cat <<-HEREDOC
${{ toJSON(needs) }}
HEREDOC
echo ""
echo "env:"
cat <<-HEREDOC
${{ toJSON(env) }}
HEREDOC
echo ""
echo "vars:"
cat <<-HEREDOC
${{ toJSON(vars) }}
HEREDOC
echo ""
echo "secrets:"
cat <<-HEREDOC
${{ toJSON(secrets) }}
HEREDOC
build-and-push:
if: contains(github.event.pull_request.labels.*.name, 'deploy!')
name: Build and push docker images
uses: ./.github/workflows/reusable-build-and-push.yml
with:
sha: ${{ github.event.pull_request.head.sha }}
secrets:
DOCKER_HUB_USERNAME: ${{ vars.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
upgrade-or-install-deployment:
name: Upgrade or install deployment
needs: build-and-push
uses: ./.github/workflows/reusable-dev-deployment.yml

Check failure on line 85 in .github/workflows/restore-backup-dev-pr.yml

View workflow run for this annotation

GitHub Actions / DB Restore for dev and feature branches

Invalid workflow file

The workflow is not valid. In .github/workflows/restore-backup-dev-pr.yml (Line: 85, Col: 11): Error from called workflow BacLuc/ecamp3/.github/workflows/reusable-dev-deployment.yml@3099cd7102f91ab076d7f4bb6d0bcb5011d5116a (Line: 71, Col: 14): Unexpected symbol: '"'{0}'"'. Located at position 44 within expression: inputs.restoreSourceFile != null && format("'{0}'", inputs.restoreSourceFile) || null
with:
name: ${{ inputs.pr_number == null && 'dev' || format('pr{0}', inputs.pr_number) }}
sha: ${{ github.event.pull_request.head.sha }}
env: ${{ inputs.env }}
pr_number: ${{ inputs.pr_number }}
dropDBOnUninstall: ${{ inputs.pr_number != null }}
secrets: inherit