@@ -145,11 +145,7 @@ function initialize_common_environment {
145
145
print_info " Mounting necessary host volumes to Docker"
146
146
print_info
147
147
148
- EXTRA_DOCKER_FLAGS=()
149
-
150
- while IFS= read -r LINE; do
151
- EXTRA_DOCKER_FLAGS+=( " ${LINE} " )
152
- done < <( convert_local_mounts_to_docker_params)
148
+ read -r -a EXTRA_DOCKER_FLAGS <<< " $(convert_local_mounts_to_docker_params)"
153
149
else
154
150
print_info
155
151
print_info " Skip mounting host volumes to Docker"
@@ -244,53 +240,52 @@ function print_info() {
244
240
# By default not the whole airflow sources directory is mounted because there are often
245
241
# artifacts created there (for example .egg-info files) that are breaking the capability
246
242
# of running different python versions in Breeze. So we only mount what is needed by default.
247
- LOCAL_MOUNTS="
248
- .bash_aliases /root/
249
- .bash_history /root/
250
- .coveragerc /opt/airflow/
251
- .dockerignore /opt/airflow/
252
- .flake8 /opt/airflow/
253
- .github /opt/airflow/
254
- .inputrc /root/
255
- .kube /root/
256
- .rat-excludes /opt/airflow/
257
- CHANGELOG.txt /opt/airflow/
258
- Dockerfile.ci /opt/airflow/
259
- LICENSE /opt/airflow/
260
- MANIFEST.in /opt/airflow/
261
- NOTICE /opt/airflow/
262
- airflow /opt/airflow/
263
- backport_packages /opt/airflow/
264
- common /opt/airflow/
265
- dags /opt/airflow/
266
- dev /opt/airflow/
267
- docs /opt/airflow/
268
- files /
269
- dist /
270
- hooks /opt/airflow/
271
- logs /root/airflow/
272
- pylintrc /opt/airflow/
273
- pytest.ini /opt/airflow/
274
- requirements /opt/airflow/
275
- scripts /opt/airflow/
276
- scripts/ci/in_container/entrypoint_ci.sh /
277
- setup.cfg /opt/airflow/
278
- setup.py /opt/airflow/
279
- tests /opt/airflow/
280
- tmp /opt/airflow/
281
- "
243
+ function generate_local_mounts_list {
244
+ local prefix=" $1 "
245
+ LOCAL_MOUNTS=(
246
+ " $prefix " .bash_aliases:/root/.bash_aliases:cached
247
+ " $prefix " .bash_history:/root/.bash_history:cached
248
+ " $prefix " .coveragerc:/opt/airflow/.coveragerc:cached
249
+ " $prefix " .dockerignore:/opt/airflow/.dockerignore:cached
250
+ " $prefix " .flake8:/opt/airflow/.flake8:cached
251
+ " $prefix " .github:/opt/airflow/.github:cached
252
+ " $prefix " .inputrc:/root/.inputrc:cached
253
+ " $prefix " .kube:/root/.kube:cached
254
+ " $prefix " .rat-excludes:/opt/airflow/.rat-excludes:cached
255
+ " $prefix " CHANGELOG.txt:/opt/airflow/CHANGELOG.txt:cached
256
+ " $prefix " Dockerfile.ci:/opt/airflow/Dockerfile.ci:cached
257
+ " $prefix " LICENSE:/opt/airflow/LICENSE:cached
258
+ " $prefix " MANIFEST.in:/opt/airflow/MANIFEST.in:cached
259
+ " $prefix " NOTICE:/opt/airflow/NOTICE:cached
260
+ " $prefix " airflow:/opt/airflow/airflow:cached
261
+ " $prefix " backport_packages:/opt/airflow/backport_packages:cached
262
+ " $prefix " common:/opt/airflow/common:cached
263
+ " $prefix " dags:/opt/airflow/dags:cached
264
+ " $prefix " dev:/opt/airflow/dev:cached
265
+ " $prefix " docs:/opt/airflow/docs:cached
266
+ " $prefix " files:/files:cached
267
+ " $prefix " dist:/dist:cached
268
+ " $prefix " hooks:/opt/airflow/hooks:cached
269
+ " $prefix " logs:/root/airflow/logs:cached
270
+ " $prefix " pylintrc:/opt/airflow/pylintrc:cached
271
+ " $prefix " pytest.ini:/opt/airflow/pytest.ini:cached
272
+ " $prefix " requirements:/opt/airflow/requirements:cached
273
+ " $prefix " scripts:/opt/airflow/scripts:cached
274
+ " $prefix " scripts/ci/in_container/entrypoint_ci.sh:/entrypoint_ci.sh:cached
275
+ " $prefix " setup.cfg:/opt/airflow/setup.cfg:cached
276
+ " $prefix " setup.py:/opt/airflow/setup.py:cached
277
+ " $prefix " tests:/opt/airflow/tests:cached
278
+ " $prefix " tmp:/opt/airflow/tmp:cached
279
+ )
280
+ }
282
281
283
282
# Converts the local mounts that we defined above to the right set of -v
284
283
# volume mappings in docker-compose file. This is needed so that we only
285
284
# maintain the volumes in one place (above)
286
285
function convert_local_mounts_to_docker_params() {
287
- echo " ${LOCAL_MOUNTS} " | sed ' /^$/d' | awk -v AIRFLOW_SOURCES=" ${AIRFLOW_SOURCES} " \
288
- '
289
- function basename(file) {
290
- sub(".*/", "", file)
291
- return file
292
- }
293
- { print "-v"; print AIRFLOW_SOURCES "/" $1 ":" $2 basename($1) ":cached" }'
286
+ generate_local_mounts_list " ${AIRFLOW_SOURCES} /"
287
+ # Bash can't "return" arrays, so we need to quote any special characters
288
+ printf -- ' -v %q ' " ${LOCAL_MOUNTS[@]} "
294
289
}
295
290
296
291
# Fixes a file that is expected to be a file. If - for whatever reason - the local file is not created
0 commit comments