Skip to content

Conversation

@ToshihitoKon
Copy link

@ToshihitoKon ToshihitoKon commented Jun 11, 2025

Summary

  • Add new wait_all_deployment_successful method to wait for ECS service deployments to reach SUCCESSFUL status
  • Add ecs_wait_for_deployment_success configuration option to control wait behavior
  • Integrate the new option into Capistrano deploy and rollback tasks

Background

Currently, wait_all_running method considers deployment complete when running_count matches desired_count. However, this doesn't guarantee that the ECS service deployment has actually completed successfully. This PR adds an option to wait for the deployment status to become SUCCESSFUL instead.

Changes

  • New method: wait_all_deployment_successful - waits for deployment status to be SUCCESSFUL and running_count to match desired_count
  • Configuration: ecs_wait_for_deployment_success option (default: false for backward compatibility)
  • Capistrano integration: Deploy and rollback tasks now conditionally use the appropriate wait method
  • Tests: Comprehensive test coverage for the new deployment success detection logic

Usage

# deploy.rb
set :ecs_wait_for_deployment_success, true

🤖 Generated with Claude Code

ToshihitoKon and others added 6 commits June 11, 2025 16:32
Add new method to wait for ECS service deployments to reach SUCCESSFUL status
instead of just waiting for running_count to match desired_count.

- Add wait_all_deployment_successful class method
- Add deployment_successful? private helper method
- Method waits for deployment status to be SUCCESSFUL and running_count to match desired_count

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add new configuration option to control whether to wait for deployment
success status or just running count matching desired count.

- Add ecs_wait_for_deployment_success attribute
- Default value is false to maintain backward compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update deploy and rollback tasks to use new wait_all_deployment_successful
method when ecs_wait_for_deployment_success is enabled.

- Add ecs_wait_for_deployment_success configuration reading
- Conditionally use wait_all_deployment_successful or wait_all_running
- Apply to both deploy and rollback tasks
- Maintain backward compatibility with default behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive test cases for the new deployment_successful? private method
to ensure correct behavior in various scenarios:

- Single successful deployment with matching counts
- Non-successful deployment status
- Multiple deployments (should return false)
- Mismatched running/desired counts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ployments API

Replace basic deployment status check with comprehensive ServiceDeployments API usage:

- Use ListServiceDeployments to get latest deployment ARNs
- Use DescribeServiceDeployments to monitor deployment status
- Check for SUCCESSFUL/ROLLBACK_SUCCESSFUL status instead of just running_count
- Handle deployment failure states (STOPPED, ROLLBACK_FAILED, STOP_REQUESTED)
- Maintain parallel processing with Thread + each_slice pattern
- Add proper error handling and logging for edge cases

This provides more accurate deployment completion detection compared to
just checking running_count == desired_count.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants