GitHub Actions and GitLab CI

Run a drill on a cron schedule in your own repository. The job reads the backup with credentials you control, restores it into a throwaway database on the runner, and reports the metadata.

Full example: GitHub Actions with AWS OIDC

This workflow runs daily, obtains short-lived AWS credentials through OIDC, and runs the prod-postgres drill from restoreproof.yml. No long-lived AWS keys are stored in GitHub.

name: restore-drill

on:
  schedule:
    - cron: "17 3 * * *"          # daily at 03:17 UTC; pick a time after your backup window
  workflow_dispatch:               # allow manual runs

permissions:
  id-token: write                  # required for OIDC
  contents: read

concurrency:
  group: restore-drill-prod-postgres
  cancel-in-progress: false

jobs:
  drill:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - name: Check out this repository
        uses: actions/checkout@v4

      - name: Assume the drill role with OIDC
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/restoreproof-drill
          role-session-name: restoreproof-drill
          aws-region: eu-central-1

      - name: Run restore drill
        uses: restoreproof/runner@v1
        with:
          config: restoreproof.yml
          drill: prod-postgres
          api-key: ${{ secrets.RESTOREPROOF_API_KEY }}

Action inputs

InputRequiredDescription
configNoPath to the config file, relative to the repository root. Default restoreproof.yml.
drillNoName of one drill to run. If omitted, all drills in the file run.
api-keyNoYour RestoreProof API key. Pass it from a repository secret. Without it, the drill runs and the report is only printed.

IAM role for the drill

The drill role needs read access to the backup prefix and nothing more. It does not need write access to production storage.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": "arn:aws:s3:::my-backups",
      "Condition": { "StringLike": { "s3:prefix": ["pg/prod/*"] } }
    },
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::my-backups/pg/prod/*"
    }
  ]
}

Trust the GitHub OIDC provider (token.actions.githubusercontent.com) and restrict the trust policy sub claim to this repository and branch.

Failures and reruns

  • A failed drill makes the job fail, and RestoreProof sends a failure alert.
  • The job reports results even when the restore fails, so the failure is visible in the dashboard.
  • Use Re-run jobs in GitHub to repeat a drill after you fix the cause. The next passing run clears the failure.

GitLab CI

The same drill in GitLab CI, using a pipeline schedule. Add RESTOREPROOF_API_KEY as a masked, protected CI/CD variable and use your GitLab runner’s cloud identity or stored credentials for storage access.

restore-drill:
  image: ghcr.io/restoreproof/runner:0.1.0   # runner image with the restoreproof CLI and Docker access
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
  variables:
    RESTOREPROOF_API_KEY: $RESTOREPROOF_API_KEY
  script:
    - restoreproof validate --config restoreproof.yml
    - restoreproof drill --config restoreproof.yml --drill prod-postgres

The runner needs Docker, or a privileged Docker service, to start the throwaway database. If your runners cannot provide Docker, use the Kubernetes sidecar mode on a cluster instead.

Pin the version. Use @v1 for the major version, or a full tag such as @v1.2.0 if you want to review each release before it runs against your backups.