Skip to content

Data tasks

Data tasks #32

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/create_from_scratch"
Environment:
type: choice
description: "The environment to target"
required: true
default: 'staging'
options:
- 'staging'
- '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/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: 3600
Region: ${{ inputs.Region }}
Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/production.ini --task ${{ inputs.Task }}'
secrets: inherit