mik-laj commented on a change in pull request #7065: [AIRFLOW-6475] Remove
duplication of volume mount specs in Breeze.
URL: https://github.com/apache/airflow/pull/7065#discussion_r363753041
##########
File path: scripts/ci/_utils.sh
##########
@@ -78,6 +78,59 @@ function print_info() {
fi
}
+# shellcheck disable=SC1087
+# Simple (?) no-dependency needed Yaml PARSER
+# From
https://stackoverflow.com/questions/5014632/how-can-i-parse-a-yaml-file-from-a-linux-shell-script
+function parse_yaml {
+
+ if [[ -z $1 ]]; then
+ echo "Please provide yaml filename as first parameter."
+ exit 1
+ fi
+ local prefix=$2
+ local s='[[:space:]]*' w='[a-zA-Z0-9_-]*' FS
+ FS=$(echo @|tr @ '\034')
+ sed -ne "s|,$s\]$s\$|]|" \
+ -e ":1;s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s,$s\(.*\)$s\]|\1\2: [\3]\n\1
- \4|;t1" \
+ -e "s|^\($s\)\($w\)$s:$s\[$s\(.*\)$s\]|\1\2:\n\1 - \3|;p" "${1}" | \
+ sed -ne "s|,$s}$s\$|}|" \
+ -e ":1;s|^\($s\)-$s{$s\(.*\)$s,$s\($w\)$s:$s\(.*\)$s}|\1- {\2}\n\1
\3: \4|;t1" \
+ -e "s|^\($s\)-$s{$s\(.*\)$s}|\1-\n\1 \2|;p" | \
+ sed -ne "s|^\($s\):|\1|" \
+ -e "s|^\($s\)-$s[\"']\(.*\)[\"']$s\$|\1$FS$FS\2|p" \
+ -e "s|^\($s\)-$s\(.*\)$s\$|\1$FS$FS\2|p" \
+ -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$FS\2$FS\3|p" \
+ -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$FS\2$FS\3|p" | \
+ awk -F"${FS}" '{
+ indent = length($1)/2;
+ vname[indent] = $2;
+ for (i in vname) {if (i > indent) {delete vname[i]; idx[i]=0}}
+ if(length($2)== 0){ vname[indent]= ++idx[indent] };
+ if (length($3) > 0) {
+ vn=""; for (i=0; i<indent; i++) { vn=(vn)(vname[i])("_")}
+ printf("%s%s%s=\"%s\"\n", "'"${prefix}"'",vn, vname[indent], $3);
+ }
+ }'
+}
+
+# parse docker-compose-local.yaml file to convert volumes entries
+# from airflow-testing section to "-v" "volume mapping" series of options
+function convert_docker_mounts_to_docker_params() {
+ ESCAPED_AIRFLOW_SOURCES=$(echo "${AIRFLOW_SOURCES}" | sed -e
's/[\/&]/\\&/g')
Review comment:
No. It doesn't work.
----------------------------------------------------------------
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]
With regards,
Apache Git Services