I am using CodeDeploy integrated into CodePipeline. I am trying to deploy an image from ecr to ecs.
The whole infrastructure is built with CloudFormation.
The template for the Pipeline deployment group:
ApplicationName=cls.application.ApplicationName,
DeploymentGroupName='DeploymentGroup',
DeploymentConfigName='CodeDeployDefault.ECSAllAtOnce',
ServiceRoleArn=GetAtt(cls.role, 'Arn'),
AutoRollbackConfiguration={
'enabled': True,
'events': ['DEPLOYMENT_FAILURE', 'DEPLOYMENT_STOP_ON_ALARM', 'DEPLOYMENT_STOP_ON_REQUEST']
},
DeploymentStyle={
'deploymentType': 'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'
},
BlueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE',
'terminationWaitTimeInMinutes': 5
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT',
},
},
LoadBalancerInfo= <Some irrelevant config>
EcsServices=[
{
'serviceName': 'WordpressService',
'clusterName': 'WordpressCluster'
},
]
So far - the configuration seems pretty straight-forward. The configuration for the pipeline itself contains 2 stages:
ArtifactStore=ArtifactStore(
Location='SomeS3Location',
Type='S3'
),
Name='WordpressPipeline',
RoleArn=GetAtt(cls.role, 'Arn'),
Stages=[
Stages(
Name='SourceStage',
Actions=[
Actions(
Name='SourceAction',
ActionTypeId=ActionTypeId(
Category='Source',
Owner='AWS',
Version='1',
Provider='ECR'
),
OutputArtifacts=[
OutputArtifacts(
Name='SourceOutput'
)
],
Configuration={
'RepositoryName':'SomeECR'
},
RunOrder='1'
)
]
),
Stages(
Name='DeployStage',
Actions=[
Actions(
Name='DeployAction',
ActionTypeId=ActionTypeId(
Category='Deploy',
Owner='AWS',
Version='1',
Provider='CodeDeploy'
),
InputArtifacts=[
InputArtifacts(
Name='SourceOutput'
)
],
Configuration={
'ApplicationName': 'MyApp',
'DeploymentGroupName': 'MyGroup'
},
RunOrder='1'
)
]
)
]
P.S. dont mind the syntax. I am using Troposphere to create CloudFormation templates.
Firstly, the CloudFormation template ran successfully.
Secondly, Sourcing from ECR succeed.
Thirdly, deployment fails with message:
The deployment specifies that the revision is a null file, but the revision provided is a zip file.
Do you have any idea where might be the problem?
Thank you in advance.
Found out where the issue was. The deploy provider was CodeDeploy which is not valid for my blue/green deployments. I hade to specify CodeDeployToECS instead. Also, I had to change required environment parameters. Here is a nice tutorial by AWS: https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-ecs-ecr-codedeploy.html#tutorials-ecs-ecr-codedeploy-pipeline