Skip to content

Data tasks

Data tasks #13

Workflow file for this run

# Run various tasks, usually related to the report aggregations
name: Data tasks
on:
workflow_dispatch:
inputs:
Task:
type: choice
description: "The data task to perform"
required: true
options:
- "report/refresh"
- "report/fast_recreate"
- "report/create_from_scratch"
Environment:
type: choice
description: "The environment to target"
required: true
default: 'qa'
options:
- 'qa'
- 'prod'
Region:
type: choice
description: "The AWS region to target"
required: true
default: 'all'
options:
- 'all'
- 'ca-central-1'
- 'us-west-1'
Destructive:
description: Check to confirm you are happy to proceed with a destructive operation
type: boolean
required: false
default: false
jobs:
check_for_danger:
runs-on: ubuntu-latest
name: "Check for approval for dangerous actions"
steps:
- name: "Approval not given!"
if: contains(fromJson('["report/fast_recreate", "report/create_from_scratch"]'), inputs.Task) && inputs.Destructive == false
run: |
echo "::error::'${{ inputs.Task }}' needs destructive option"
exit 1
run_task:
needs: check_for_danger
name: "Run '${{ inputs.Task }}' data task in ${{ inputs.Environment }} / ${{ inputs.Region }}"
uses: hypothesis/workflows/.github/workflows/eb-task.yml@main
with:
App: ${{ github.event.repository.name }}
Env: ${{ inputs.Environment }}
Timeout: 7200
Region: ${{ inputs.Region }}
Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/app.ini --task ${{ inputs.Task }}'
secrets: inherit