-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.26 KB
/
run-dbt-runner-task.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Run current installed DBT Runner task
on:
workflow_call:
inputs:
environment:
type: string
required: true
description: 'Environment which to deploy to (testi/tuotanto)'
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Environment which to deploy to'
options:
- testi
- tuotanto
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Run current installed DBT Runner task
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Configure AWS credentials
if: ${{ inputs.environment == 'testi' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OVARA_TESTI_ROLE_ARN }}
role-session-name: testi-dbt-runner-deploy
aws-region: eu-west-1
- name: Configure AWS credentials
if: ${{ inputs.environment == 'tuotanto' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OVARA_TUOTANTO_ROLE_ARN }}
role-session-name: tuotanto-dbt-runner-deploy
aws-region: eu-west-1
- name: Configure ENV parameters
if: ${{ inputs.environment == 'testi' }}
run: |
echo "FAMILY_PREFIX=testiEcsStacktestidbttaskScheduledTaskDef" >> $GITHUB_ENV
echo "ECS_CLUSTER_NAME=testi-ecs-cluster" >> $GITHUB_ENV
- name: Configure ENV parameters
if: ${{ inputs.environment == 'tuotanto' }}
run: |
echo "FAMILY_PREFIX=DUMMY" >> $GITHUB_ENV
echo "ECS_CLUSTER_NAME=DUMMY" >> $GITHUB_ENV
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition `aws ecs list-task-definition-families --family-prefix ${{ env.FAMILY_PREFIX }} | jq -r '.families[0]'` --query taskDefinition > task-definition.json
- name: Run Task on Amazon ECS
uses: smitp/amazon-ecs-run-task@v1
with:
task-definition: task-definition.json
cluster: ${{ env.FAMILY_PREFIX }}
count: 1
started-by: github-actions-${{ github.actor }}
wait-for-finish: true