-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Run DBT Runner | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
description: 'Environment (testi/tuotanto)' | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: choice | ||
description: 'Environment (testi/tuotanto)' | ||
options: | ||
- testi | ||
- tuotanto | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Run DBT Runner | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Configure AWS credentials (TESTI) | ||
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 (TUOTANTO) | ||
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: Run scheduled task (TESTI) | ||
if: ${{ inputs.environment == 'testi' }} | ||
run: | | ||
ci-tools/run-testi-dbt-runner.sh | ||
- name: Run scheduled task (TUOTANTO) | ||
if: ${{ inputs.environment == 'tuotanto' }} | ||
run: | | ||
ci-tools/run-tuotanto-dbt-runner.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Run Lampi-siirtäjä | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
description: 'Environment (testi/tuotanto)' | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: choice | ||
description: 'Environment (testi/tuotanto)' | ||
options: | ||
- testi | ||
- tuotanto | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Run Lampi-siirtäjä | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Configure AWS credentials (TESTI) | ||
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 (TUOTANTO) | ||
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: Run scheduled task (TESTI) | ||
if: ${{ inputs.environment == 'testi' }} | ||
run: | | ||
ci-tools/run-testi-lampi-siirtaja.sh | ||
- name: Run scheduled task (TUOTANTO) | ||
if: ${{ inputs.environment == 'tuotanto' }} | ||
run: | | ||
ci-tools/run-tuotanto-lampi-siirtaja.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
echo "Käynnistetään testin DBT Runner" | ||
|
||
ecscluster=$(aws ecs list-clusters | jq -r '.clusterArns | .[0]' | cut -d "/" -f2) | ||
taskdefinition=$(aws ecs list-task-definitions --family-prefix testiEcsStacktestidbttaskScheduledTaskDef029C43B9 --sort DESC | jq -r '.taskDefinitionArns | .[0]' | cut -d "/" -f2) | ||
assignpublicip=$(aws events list-targets-by-rule --rule testi-scheduledFargateTaskRule | jq -r '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.AssignPublicIp') | ||
securitygroups=$(aws events list-targets-by-rule --rule testi-scheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.SecurityGroups') | ||
subnets=$(aws events list-targets-by-rule --rule testi-scheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.Subnets') | ||
awsvpcconfiguration=$(jq -c -n --argjson subnets "$subnets" \ | ||
--argjson securityGroups "$securitygroups" \ | ||
--arg assignPublicIp "$assignpublicip" \ | ||
'$ARGS.named') | ||
networkconfiguration=$(jq -c -n --argjson awsvpcConfiguration "$awsvpcconfiguration" '$ARGS.named') | ||
command="aws ecs run-task --cluster $ecscluster --task-definition $taskdefinition --launch-type="FARGATE" --network-configuration '$networkconfiguration'" | ||
echo "$command" | ||
|
||
eval "$command" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
echo "Käynnistetään testin Lampi-siirtäjä" | ||
|
||
ecscluster=$(aws ecs list-clusters | jq -r '.clusterArns | .[0]' | cut -d "/" -f2) | ||
taskdefinition=$(aws ecs list-task-definitions --family-prefix testiEcsStacktestiovaralampisiirtajaScheduledTaskDef9D6D6A5C --sort DESC | jq -r '.taskDefinitionArns | .[0]' | cut -d "/" -f2) | ||
assignpublicip=$(aws events list-targets-by-rule --rule testi-lampiSiirtajaScheduledFargateTaskRule | jq -r '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.AssignPublicIp') | ||
securitygroups=$(aws events list-targets-by-rule --rule testi-lampiSiirtajaScheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.SecurityGroups') | ||
subnets=$(aws events list-targets-by-rule --rule testi-lampiSiirtajaScheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.Subnets') | ||
awsvpcconfiguration=$(jq -c -n --argjson subnets "$subnets" \ | ||
--argjson securityGroups "$securitygroups" \ | ||
--arg assignPublicIp "$assignpublicip" \ | ||
'$ARGS.named') | ||
networkconfiguration=$(jq -c -n --argjson awsvpcConfiguration "$awsvpcconfiguration" '$ARGS.named') | ||
command="aws ecs run-task --cluster $ecscluster --task-definition $taskdefinition --launch-type="FARGATE" --network-configuration '$networkconfiguration'" | ||
echo "$command" | ||
|
||
eval "$command" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
echo "Käynnistetään tuotannon DBT Runner" | ||
|
||
ecscluster=$(aws ecs list-clusters | jq -r '.clusterArns | .[0]' | cut -d "/" -f2) | ||
taskdefinition=$(aws ecs list-task-definitions --family-prefix tuotantoEcsStacktuotantodbttaskScheduledTaskDef96224624 --sort DESC | jq -r '.taskDefinitionArns | .[0]' | cut -d "/" -f2) | ||
assignpublicip=$(aws events list-targets-by-rule --rule tuotanto-scheduledFargateTaskRule | jq -r '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.AssignPublicIp') | ||
securitygroups=$(aws events list-targets-by-rule --rule tuotanto-scheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.SecurityGroups') | ||
subnets=$(aws events list-targets-by-rule --rule tuotanto-scheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.Subnets') | ||
awsvpcconfiguration=$(jq -c -n --argjson subnets "$subnets" \ | ||
--argjson securityGroups "$securitygroups" \ | ||
--arg assignPublicIp "$assignpublicip" \ | ||
'$ARGS.named') | ||
networkconfiguration=$(jq -c -n --argjson awsvpcConfiguration "$awsvpcconfiguration" '$ARGS.named') | ||
command="aws ecs run-task --cluster $ecscluster --task-definition $taskdefinition --launch-type="FARGATE" --network-configuration '$networkconfiguration'" | ||
echo "$command" | ||
|
||
eval "$command" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
echo "Käynnistetään tuotannon Lampi-siirtäjä" | ||
|
||
ecscluster=$(aws ecs list-clusters | jq -r '.clusterArns | .[0]' | cut -d "/" -f2) | ||
taskdefinition=$(aws ecs list-task-definitions --family-prefix tuotantoEcsStacktuotantoovaralampisiirtajaScheduledTaskDef44BFAB1B --sort DESC | jq -r '.taskDefinitionArns | .[0]' | cut -d "/" -f2) | ||
assignpublicip=$(aws events list-targets-by-rule --rule tuotanto-lampiSiirtajaScheduledFargateTaskRule | jq -r '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.AssignPublicIp') | ||
securitygroups=$(aws events list-targets-by-rule --rule tuotanto-lampiSiirtajaScheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.SecurityGroups') | ||
subnets=$(aws events list-targets-by-rule --rule tuotanto-lampiSiirtajaScheduledFargateTaskRule | jq -c '.Targets | map(select(.Id == "Target0")) | .[0] | .EcsParameters.NetworkConfiguration.awsvpcConfiguration.Subnets') | ||
awsvpcconfiguration=$(jq -c -n --argjson subnets "$subnets" \ | ||
--argjson securityGroups "$securitygroups" \ | ||
--arg assignPublicIp "$assignpublicip" \ | ||
'$ARGS.named') | ||
networkconfiguration=$(jq -c -n --argjson awsvpcConfiguration "$awsvpcconfiguration" '$ARGS.named') | ||
command="aws ecs run-task --cluster $ecscluster --task-definition $taskdefinition --launch-type="FARGATE" --network-configuration '$networkconfiguration'" | ||
echo "$command" | ||
|
||
eval "$command" |