astro-cli icon indicating copy to clipboard operation
astro-cli copied to clipboard

`astro dev upgrade-test` doesn't work with `.env` file having multi-line secret

Open manmeetkaur opened this issue 1 year ago • 0 comments

Describe the bug

In my local env, I have a .env file with a secret for Google's service account which is a multiline json enclosed in quotes. This .env file works perfectly with all astro commands but when I run DAG test using astro dev upgrade-test --dag-test --runtime-version 8.7.0, the test fails.

Running parse test
docker: poorly formatted environment: variable '"type": "service_account",' contains whitespaces.
See 'docker run --help'.
Error: No such object: astro-pytest
Error response from daemon: No such container: astro-pytest
Error response from daemon: No such container: astro-pytest
Error: something went wrong while parsing your DAGs: failed to execute cmd: exit status 1

What CLI Version did you experience this bug? The astro binary that is to be released v1.18.0

This CLI bug is related to which Astronomer Platform?

  • [X] Astro
  • [ ] Software
  • [ ] None/Unknown

What Operating System is the above CLI installed on? Mac M1

🪜 Steps To Reproduce

  1. use a .env file with the following contents:
VAULT_ADDR='http://host.docker.internal:8200'
VAULT_URL='http://host.docker.internal:8200'
SECRET_VAR_SERVICE_ACCOUNT='{
  "type": "service_account",
  "project_id": "astronomer-field",
  "private_key_id": "6a3eb45c19b840ae9f6de91592e6981cdf6f211c",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgoYp6+jitNQ=\n-----END PRIVATE KEY-----\n",
  "client_email": "[email protected]",
  "client_id": "1061414681023423458887157",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/astro-fe-access-secrets%40astronomer-field.iam.gserviceaccount.com"
}
'
ENVIRONMENT='dev'
  1. run astro dev upgrade-test --dag-test --runtime-version 8.7.0

📸 Screenshots

manmeetkaur avatar Aug 03 '23 15:08 manmeetkaur