Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeployBlueGreenAction class to handle CodeDeploy deployments #121

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

joaoricardo000
Copy link

  • Add a new option for ecs deploy function.
  • Code Deploy Application Name --cd-application-name AppECS-service-name
  • If --cd-application-name is given, a DeployBlueGreenAction instance is created to handle the creation and monitoring of the CodeDeploy deployment process.

Example call/output:

$ ecs deploy cluster-name service-name --task task-def-name --image docker_image --cd-application-name AppECS-cd-service-name  
  
Deploying based on task definition: task-def-name:99

Updating task definition
Changed image of container "container-name" to: "docker_image" (was: "old_docker_image")

Creating new task definition revision
Successfully created revision: 100

Updating service

Deployment created: d-LAAKLJFF0
	https://us-east-1.console.aws.amazon.com/codesuite/codedeploy/deployments/d-LAAKLJFF0

Successfully changed task definition to: task-def-name:100

Deploying new task definition..............................................................................
Deployment successful

Deregister task definition revision
Successfully deregistered revision: 99

Related to #120


message = 'Successfully changed task definition to: %s:%s\n' % (
task_definition.family,
task_definition.revision
)

if type(deployment) == DeployBlueGreenAction:
_cd_deploy_url = 'https://us-east-1.console.aws.amazon.com/codesuite/codedeploy/deployments/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaoricardo000 Will it always be us-east-1? Or should it be the same region as you are deploying to?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this needs to be configurable, like the regions are in the deploy, scale, etc. commands.
In addition this should be configured and falling back to a default inside the Action, not in the CLI controller, please.

'Properties': {
'TaskDefinition': task_definition.arn,
'LoadBalancerInfo': {
'ContainerName': self.service['loadBalancers'][0]['containerName'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this imply, that a task definition does not have more than one containers?

return self._deployment_target_id

def deploy(self, task_definition):
response = self.client.codedeploy.create_deployment(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this like makes the class to a "codedeploy-deploy" tool, rather then an "ecs-deploy" too.
I'm still thinking, if this use-case might be a bit out of the scope of the project.


message = 'Successfully changed task definition to: %s:%s\n' % (
task_definition.family,
task_definition.revision
)

if type(deployment) == DeployBlueGreenAction:
_cd_deploy_url = 'https://us-east-1.console.aws.amazon.com/codesuite/codedeploy/deployments/'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this needs to be configurable, like the regions are in the deploy, scale, etc. commands.
In addition this should be configured and falling back to a default inside the Action, not in the CLI controller, please.

@quinn
Copy link

quinn commented Jun 13, 2023

Anything I can do to get this over the finish line? or, another option would be to have a flag to disable the deploy after updating the task def.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants