Skip to content

Conversation

Copy link

Copilot AI commented Jul 15, 2025

Summary

Implements GitHub Deploy service polling functionality that waits for status checks to pass before proceeding with CloudFormation deployments. This prevents deployment of failing code and ensures all CI checks complete successfully.

Problem Solved

Previously, the deploy tool would proceed with deployments regardless of GitHub status check state, potentially deploying broken code. The tool now polls GitHub status checks and only proceeds when all checks pass, or aborts with a clear error message if checks fail.

Implementation Details

Core Changes

  • Enhanced gh.js:

    • Fixed incomplete status() method to properly return GitHub status check data
    • Added pollStatusChecks() method that polls until checks pass or fail
    • Comprehensive error handling with specific failure details
  • Integrated into deployment workflow (cli.js):

    • Polling occurs after artifact checks but before CloudFormation operations
    • Applies to both create and update commands
    • Graceful error handling with proper exit codes

Configuration Support

Added configurable polling behavior via .deploy file:

{
  "github": {
    "polling": {
      "timeout": 1800000,
      "interval": 30000
    }
  }
}
  • timeout: Maximum wait time (1 minute to 1 hour, default: 30 minutes)
  • interval: Poll frequency (5 seconds to 5 minutes, default: 30 seconds)

User Experience

$ deploy create my-stack
Polling GitHub status checks for commit abc123...
Status: pending (3 checks)
⏳ Waiting for: ci/test, ci/lint
Status: pending (3 checks)  
⏳ Waiting for: ci/test
Status: success (3 checks)
✅ All status checks passed!
Creating deployment...

Or on failure:

Status: failure (3 checks)
❌ Status checks failed. Failed checks: ci/test
Status Check Polling Failed: ❌ Status checks failed. Failed checks: ci/test

Files Changed

  • lib/gh.js - Enhanced GitHub API integration with polling logic
  • cli.js - Integrated polling into deployment workflow
  • lib/context.js - Added configuration loading for polling options
  • data/schema.json - Added schema validation for polling configuration
  • README.md - Added documentation for polling configuration

Testing

Tested with mock scenarios covering:

  • ✅ Successful polling (pending → success)
  • ✅ Failed status checks (pending → failure)
  • ✅ Error conditions and timeouts
  • ✅ Configuration loading and validation
  • ✅ CLI argument parsing and help system

Backward Compatibility

  • Fully backward compatible - existing deployments work unchanged
  • Polling only activates when GitHub integration is enabled
  • Default timeouts are conservative (30 minutes)
  • No breaking changes to existing APIs or configuration

This pull request was created as a result of the following prompt from Copilot chat.

Poll the GitHub Deploy service until the contexts are passing or throw an error if the contexts have failed and will not pass. Implement this functionality in the repository openaddresses/deploy.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Implement polling mechanism for GitHub Deploy contexts Implement GitHub status check polling before deployments Jul 15, 2025
Copilot AI requested a review from ingalls July 15, 2025 03:40
Copilot finished work on behalf of ingalls July 15, 2025 03:40
Copy link
Member

@ingalls ingalls left a comment

Choose a reason for hiding this comment

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

Modify the PR to use ora like other polling functions in the codebase

Copy link
Author

Copilot AI commented Jul 15, 2025

Modify the PR to use ora like other polling functions in the codebase

Updated the GitHub status check polling to use ora spinner like other polling functions in the codebase. The implementation now follows the same pattern as S3 and Docker artifact polling, providing consistent visual feedback with a spinner that shows real-time status updates. Commit: e994883

Copilot AI requested a review from ingalls July 15, 2025 03:55
Copilot finished work on behalf of ingalls July 15, 2025 03:55
@ingalls ingalls marked this pull request as ready for review July 15, 2025 05:18
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