astronomer / astro-cli

CLI that makes it easy to create, test and deploy Airflow DAGs to Astronomer
https://www.astronomer.io
Other
359 stars 70 forks source link

Fix --build-secrets behavior for multiple secrets #1720

Open astro-anand opened 1 month ago

astro-anand commented 1 month ago

Describe the bug

the astro cli --build-secrets flag generates an incorrect docker command when passed multiple secrets. astro dev parse --build-secrets "id=secret1,env=ENV_SECRET" --build-secrets "id=secret2,env=ENV_SECRET2"-> build -t ul_44f240/airflow:latest -f Dockerfile . --secret id=secret1,env=ENV_SECRET,id=secret2,env=ENV_SECRET2

The command should include multiple --secrets flags. build -t ul_44f240/airflow:latest -f Dockerfile . --secret id=secret1,env=ENV_SECRET --secret id=secret2,env=ENV_SECRET2

slack reference: https://astronomer.slack.com/archives/CL44PA4DB/p1726511388479989

What CLI Version did you experience this bug? 1.28.1

This CLI bug is related to which Astronomer Platform?

What Operating System is the above CLI installed on? Affects both Mac and Windows

🪜 Steps To Reproduce

run commands above.

neel-astro commented 1 month ago

A possible workaround if someone stumble on this until this is fixed is to build the docker image manually and pass that in astro dev start command, i.e.

# command to build the custom image via docker cli
docker build -t <image_name>:<image_tag> -f Dockerfile . --secret id=<secret_id1>,env=<secret_env1> --secret id=<secret_id2>,env=<secret_env2>

# command to start the astro project with a custom image
astro dev start --image-name <image_name>:<image_tag>