Add client deploy support for RE projects by feluelle · Pull Request #1954 · astronomer/astro-cli

Description

Describe the purpose of this pull request.

This pull request introduces a new "remote deploy" command to support building and pushing client images to a configurable remote registry, along with improvements to Docker authentication and extensive test coverage. The changes include a new command group, a new deploy workflow for client images, enhancements to Docker login for OAuth-based registries, and comprehensive tests for the new functionality.

Major features and improvements:

New Remote Deploy Command

  • Adds a new remote command group with a deploy subcommand (cmd/cloud/remote.go) that allows users to build and deploy client images to a remote registry, supporting custom image names, platforms, and build secrets.

Client Image Deployment Workflow

  • Implements the DeployClientImage function and supporting InputClientDeploy struct in cloud/deploy/deploy.go, enabling image builds (with multi-platform support), tagging, and pushes to a configurable remote registry, with proper error handling and user feedback. [1] [2]
  • Updates CLI flags and documentation for image name usage with the new client deploy workflow.

Docker Authentication Enhancements

  • Introduces a testable DockerLogin function in airflow/docker_registry.go that performs Docker login using a shell command, supporting OAuth/Bearer tokens and integration with custom container runtimes. [1] [2]
  • Removes the "Pushing image to Astronomer registry" print statement from the Docker image push logic, delegating messaging to the caller for more flexible UX. [1] [2] [3]

Testing Improvements

  • Adds comprehensive tests for the new DeployClientImage workflow, including scenarios for successful deploys, authentication failures, missing configuration, build failures, push failures, and custom image name handling (cloud/deploy/deploy_test.go).
  • Adds unit tests for the new DockerLogin function, covering different credential and error scenarios (airflow/docker_registry_test.go).

Dependency and Import Updates

  • Updates imports across affected files to support new functionality and testing, including time handling, error wrapping, and runtime detection. [1] [2] [3]

These changes collectively enhance the CLI's ability to manage and deploy client images to remote registries, improve authentication support, and ensure robust test coverage for new workflows.

🎟 Issue(s)

closes: #1929

🧪 Functional Testing

List the functional testing steps to confirm this feature or fix.

❯ mkdir -p test-proj

❯ cd test-proj/

❯ ../astro dev init --remote-execution-enabled --remote-image-repository quay.io/astronomer/test-re-image
If you want to modify the remote repository down the line, use the `astro config set <config-name> <config-value>` command while being inside the local project
Initialized empty Astro project in /Users/felix.uellendall/Projects/astro-cli/test-proj

❯ docker login quay.io

...

❯ ../astro remote deploy
Authenticated to Astro 

Building client image for host platform
✔ Project image has been updated
Pushing client image to configured remote registry
The push refers to repository [quay.io/astronomer/test-re-image]
db1ec1396cec: Preparing 
250077b8e2f1: Preparing 
ff7ad0ed8843: Preparing 
15495de9b3c9: Preparing 
f53340173a70: Preparing 
bc08155b92b2: Preparing 
e135bfc8d962: Preparing 
d4dbe2768164: Preparing 
aed80eec9d8e: Preparing 
dc99db8fe0f7: Preparing 
5f70bf18a086: Preparing 
463ffe7c4a8c: Preparing 
a5dc7b3351fc: Preparing 
3f277a7e8af5: Preparing 
647becd00dde: Preparing 
4ebcb07c8ff5: Preparing 
8a3e3dd48e16: Preparing 
aec039246eac: Preparing 
aec039246eac: Layer already exists 
e052a77e1b4c: Layer already exists 
bfd674033216: Layer already exists 
3727986a7369: Layer already exists 
f9f463ef0ab6: Layer already exists 
3272b0f1ab5d: Layer already exists 
434f09d4c07c: Layer already exists 
12e54a87ed64: Layer already exists 
1cbba14035d1: Layer already exists 
30ea4d3c81cc: Layer already exists 
897f9bea8fc9: Layer already exists 
4db91a9800d0: Layer already exists 
3a260fc55d56: Layer already exists 
1bda2267e2a0: Layer already exists 
40c1701160ee: Layer already exists 
3fd12b3e124a: Layer already exists 
d266c3e26fa4: Layer already exists 
5db2ff227830: Layer already exists 
d8e87551fda9: Layer already exists 
07d4c428e5bd: Layer already exists 
deploy-2025-10-09T11-59: digest: sha256:48b068d8fd9130f674e1f59a667600cf4a1cb4653540133283393266ac8bafed size: 8448
Successfully pushed client image to quay.io/astronomer/test-re-image:deploy-2025-10-09T11-59

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation