I have a Codepipeline that deploys an ECR image to an ECS cluster using an ECS Blue / Green Deployment action. The pipeline contains two sources: one for the ECR image using an AWS ECR action and another one for fetching the configuration from Github using a ThirdParty Github action. The ECR action outputs an image
artifact while the Github action outputs a config
artifact. Both of these artifacts are provided as an input to the ECS Blue / Green Deployment action.
The pipeline fails at the ECS Blue / Green Deployment action with the following error (visible from AWS console):
Invalid action configuration
Exception while trying to read the task definition artifact file from: config
Here is the structure of the pipeline (some details are edited for anonymity):
$ aws codepipeline get-pipeline --name my-codepipeline
{
"pipeline": {
"name": "my-codepipeline",
"roleArn": "arn:aws:iam::123456789000:role/my-codepipeline-role",
"artifactStore": {
"type": "S3",
"location": "my-codepipeline-s3"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "ImageSource",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "ECR",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ImageTag": "latest",
"RepositoryName": "my-ecr"
},
"outputArtifacts": [
{
"name": "image"
}
],
"inputArtifacts": []
},
{
"name": "ConfigSource",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"runOrder": 1,
"configuration": {
"Branch": "master",
"OAuthToken": "****",
"Owner": "me",
"PollForSourceChanges": "false",
"Repo": "application-config"
},
"outputArtifacts": [
{
"name": "config"
}
],
"inputArtifacts": []
}
]
},
{
"name": "Deploy",
"actions": [
{
"name": "DeployBackend",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"provider": "CodeDeployToECS",
"version": "1"
},
"runOrder": 1,
"configuration": {
"AppSpecTemplateArtifact": "config",
"AppSpecTemplatePath": "production/appspec.yaml",
"ApplicationName": "my-codedeploy",
"DeploymentGroupName": "my-codedeploy-group",
"Image1ArtifactName": "image",
"Image1ContainerName": "IMAGE_NAME",
"TaskDefinitionTemplateArtifact": "config",
"TaskDefinitionTemplatePath": "production/taskdef.json"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "image"
},
{
"name": "config"
}
]
}
]
}
],
"version": 1
},
"metadata": {
"pipelineArn": "arn:aws:codepipeline:ap-northeast-1:123456789000:my-codepipeline",
"created": 1564107543.285,
"updated": 1564107543.285
}
}
I have checked the compressed artifact in the S3 and it definitely contains the configuration files in the Github repository at the location specified by AppSpecTemplatePath
and TaskDefinitionTemplatePath
.
Here is the content of appspec.yaml
:
$ cat production/appspec.yaml
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: <TASK_DEFINITION>
LoadBalancerInfo:
ContainerName: "my-container"
ContainerPort: 80