potiuk commented on a change in pull request #9219:
URL: https://github.com/apache/airflow/pull/9219#discussion_r438435306
##########
File path: scripts/ci/prepare_tool_scripts.sh
##########
@@ -72,25 +132,36 @@ function prepare_terraform_script() {
cat >"${TARGET_TOOL_PATH}" <<EOF
#!/usr/bin/env bash
-docker run --rm -it \
- -v "\${HOST_AIRFLOW_SOURCES}/tmp:/tmp" \
- -v "\${HOST_AIRFLOW_SOURCES}/files:/files" \
- -v "\${HOST_AIRFLOW_SOURCES}:/opt/airflow" \
- -v "\${HOST_HOME}/.aws:/root/.aws" \
- -v "\${HOST_HOME}/.azure:/root/.azure" \
- -v "\${HOST_HOME}/.config/gcloud:/root/.config/gcloud" \
- -w /opt/airflow \
- --env-file <(env | grep TF) \
- "${IMAGE}" "\$@"
+
+DOCKER_ARGS=(
+ -v "\${HOST_AIRFLOW_SOURCES}/tmp:/tmp" \\
+ -v "\${HOST_AIRFLOW_SOURCES}/files:/files" \\
+ -v "\${HOST_AIRFLOW_SOURCES}:/opt/airflow" \\
+ -v "\${HOST_HOME}/.aws:/root/.aws" \\
+ -v "\${HOST_HOME}/.azure:/root/.azure" \\
+ -v "\${HOST_HOME}/.config/gcloud:/root/.config/gcloud" \\
+ -w /opt/airflow \\
+ --env-file <(env | grep TF) \\
+ -e GOOGLE_APPLICATION_CREDENTIALS \\
+ -e CLOUDSDK_CONFIG \\
Review comment:
Instead of having separate functions we should have one with:
```
-v "\${HOST_AIRFLOW_SOURCES}/tmp:/tmp" \\
-v "\${HOST_AIRFLOW_SOURCES}/files:/files" \\
-v "\${HOST_AIRFLOW_SOURCES}:/opt/airflow" \\
-v "\${HOST_HOME}/.aws:/root/.aws" \\
-v "\${HOST_HOME}/.azure:/root/.azure" \\
-v "\${HOST_HOME}/.config/gcloud:/root/.config/gcloud" \\
-w /opt/airflow \\
--env-file <(env ) \\
```
That should do the job for all the tools (and any undocumented variables)
The:
```
--env-file <(env )
```
Will pass all the environment variables that are exported - making it
equivalent to the way it is run locally.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]