feat: enhance 403 error messaging for Docker image push failures by coleheflin · Pull Request #1925 · astronomer/astro-cli

added 6 commits

August 28, 2025 09:42
- Add specific error messaging for 403 Forbidden errors during image push
- Provide actionable troubleshooting steps for common causes:
  * Invalid cached Docker credentials
  * Incompatible containerd snapshotter configuration
- Include link to detailed support documentation
- Add comprehensive tests for error detection and messaging
- Support error detection in both pushWithClient and pushWithBash flows

Resolves common pain point for new users encountering authentication
issues during astro deploy operations.
Follow Go error message convention by starting with lowercase letter
to address stylecheck linter warning ST1005.
- Move 403 error detection to only trigger after both pushWithClient
  and pushWithBash methods fail
- Remove overly broad 'unauthorized' pattern from 403 detection
- Ensure bash fallback is always attempted for failed pushWithClient
- Update tests to reflect more specific error detection

This fixes a regression where the enhanced 403 error messaging was
interfering with the normal Docker push fallback mechanism.
Update test expectation to reflect that 403 error detection now only
occurs after both pushWithClient and pushWithBash methods fail, which
is the correct behavior.
- Modify pushWithBash to capture stderr output and include it in error
- Enhance is403Error to check entire error chain using errors.Unwrap
- Remove debug logging for clean production code

This ensures that Docker push errors containing '403 Forbidden' are
properly captured and detected, allowing enhanced error messaging
to display helpful troubleshooting guidance to users.

@coleheflin

jeremybeard