129 lines
4.8 KiB
JSON
129 lines
4.8 KiB
JSON
{
|
|
"Comment": "実消化&アルトマーク メルク施設マスタステートマシン",
|
|
"StartAt": "params",
|
|
"States": {
|
|
"params": {
|
|
"Comment": "パラメータ設定",
|
|
"Type": "Pass",
|
|
"Parameters": {
|
|
"ecs": {
|
|
"LaunchType": "FARGATE",
|
|
"Cluster": "arn:aws:ecs:#{REGION_AP_NORTHEAST_1}:#{AWS_ACCOUNT_ID}:cluster/mbj-newdwh2021-#{ENV_NAME}-jskult-batch-mst-inst-all-ecs",
|
|
"TaskDefinition": "arn:aws:ecs:#{REGION_AP_NORTHEAST_1}:#{AWS_ACCOUNT_ID}:task-definition/mbj-newdwh2021-#{ENV_NAME}-task-jskult-batch-mst-inst-all",
|
|
"NetworkConfiguration": {
|
|
"AwsvpcConfiguration": {
|
|
"Subnets": [
|
|
"#{SUBNET_PRI_1A}",
|
|
"#{SUBNET_PRI_1D}"
|
|
],
|
|
"SecurityGroups": [
|
|
"#{SG_ECS_ALL}",
|
|
"#{SG_MST_INST_ALL}"
|
|
],
|
|
"AssignPublicIp": "DISABLED"
|
|
}
|
|
},
|
|
"Overrides": {
|
|
"ContainerOverrides": [
|
|
{
|
|
"Name": "mbj-newdwh2021-#{ENV_NAME}-container-jskult-batch-mst-inst-all",
|
|
"Environment": [
|
|
{
|
|
"Name": "BATCH_EXECUTION_ID",
|
|
"Value.$": "$$.Execution.Id"
|
|
},
|
|
{
|
|
"Name": "MAX_RUN_COUNT",
|
|
"Value.$": "$.maxRunCount"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"ResultPath": "$.params",
|
|
"Next": "exec-ecs-task"
|
|
},
|
|
"exec-ecs-task": {
|
|
"Type": "Task",
|
|
"Resource": "arn:aws:states:::ecs:runTask.sync",
|
|
"Parameters": {
|
|
"LaunchType.$": "$.params.ecs.LaunchType",
|
|
"Cluster.$": "$.params.ecs.Cluster",
|
|
"TaskDefinition.$": "$.params.ecs.TaskDefinition",
|
|
"NetworkConfiguration.$": "$.params.ecs.NetworkConfiguration",
|
|
"Overrides.$": "$.params.ecs.Overrides"
|
|
},
|
|
"ResultPath": "$.result",
|
|
"Retry": [
|
|
{
|
|
"ErrorEquals": [
|
|
"States.ALL"
|
|
],
|
|
"BackoffRate": 2,
|
|
"IntervalSeconds": 3,
|
|
"MaxAttempts": 3
|
|
}
|
|
],
|
|
"Catch": [
|
|
{
|
|
"ErrorEquals": [
|
|
"States.ALL"
|
|
],
|
|
"Next": "ErrorEnd",
|
|
"ResultPath": "$.result"
|
|
}
|
|
],
|
|
"Next": "scan-jskult-batch-run-manage",
|
|
"Comment": "ECSタスク起動"
|
|
},
|
|
"scan-jskult-batch-run-manage": {
|
|
"Type": "Task",
|
|
"Resource": "arn:aws:states:::dynamodb:getItem",
|
|
"Parameters": {
|
|
"TableName": "mbj-newdwh2021-#{ENV_NAME}-jskult-batch-run-manage",
|
|
"Key": {
|
|
"execution_id": {
|
|
"S.$": "$$.Execution.Id"
|
|
}
|
|
}
|
|
},
|
|
"Next": "Choice",
|
|
"ResultPath": "$.scan"
|
|
},
|
|
"Choice": {
|
|
"Type": "Choice",
|
|
"Choices": [
|
|
{
|
|
"Variable": "$.scan.Item",
|
|
"IsPresent": false,
|
|
"Next": "ErrorEnd",
|
|
"Comment": "バッチ実行管理テーブルにデータが存在しない場合"
|
|
},
|
|
{
|
|
"Variable": "$.scan.Item.batch_run_status.S",
|
|
"StringEquals": "retry",
|
|
"Next": "wait-for-retry",
|
|
"Comment": "バッチ実行管理テーブルのスターテスがリトライの場合"
|
|
}
|
|
],
|
|
"Default": "NormalEnd"
|
|
},
|
|
"wait-for-retry": {
|
|
"Type": "Wait",
|
|
"SecondsPath": "$.retryIntervalSecond",
|
|
"Next": "exec-ecs-task"
|
|
},
|
|
"NormalEnd": {
|
|
"Comment": "正常終了",
|
|
"Type": "Succeed"
|
|
},
|
|
"ErrorEnd": {
|
|
"Comment": "異常終了",
|
|
"Type": "Fail",
|
|
"Error": "StatesError",
|
|
"Cause": "StepFunctions ErrorEnd"
|
|
}
|
|
}
|
|
} |