You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/27 10:58:26 UTC

[GitHub] [flink-docker] zentol commented on a change in pull request #17: [FLINK-17367] Add configurable download URL

zentol commented on a change in pull request #17:
URL: https://github.com/apache/flink-docker/pull/17#discussion_r415714665



##########
File path: add-version.sh
##########
@@ -95,19 +99,46 @@ fi
 
 mkdir "$flink_release"
 
+function generate() {
+    dir=$1
+    binary_download_url=$2
+    asc_download_url=$3
+    gpg_key=$4
+    skip_gpg=$5
+    source_variant=$6
+
+    mkdir "$dir"
+    cp docker-entrypoint.sh "$dir/docker-entrypoint.sh"
+
+    # '&' has special semantics in sed replacement patterns
+    escaped_binary_download_url=$(echo "$binary_download_url" | sed 's/&/\\\&/')
+
+    sed \
+        -e "s,%%BINARY_DOWNLOAD_URL%%,${escaped_binary_download_url}," \
+        -e "s,%%ASC_DOWNLOAD_URL%%,$asc_download_url," \
+        -e "s/%%GPG_KEY%%/$gpg_key/" \
+        -e "s/%%SKIP_GPG%%/${skip_gpg}/" \
+        "Dockerfile-$source_variant.template" > "$dir/Dockerfile"
+}
+
 echo -n >&2 "Generating Dockerfiles..."
 for source_variant in "${source_variants[@]}"; do
     for scala_version in "${scala_versions[@]}"; do
         dir="$flink_release/scala_${scala_version}-${source_variant}"
 
-        mkdir "$dir"
-        cp docker-entrypoint.sh "$dir/docker-entrypoint.sh"
+        flink_url_file_path=flink/flink-${flink_version}/flink-${flink_version}-bin-scala_${scala_version}.tgz
+
+        flink_tgz_url="https://www.apache.org/dyn/closer.cgi?action=download&filename=${flink_url_file_path}"
+        # Not all mirrors have the .asc files
+        flink_asc_url=https://www.apache.org/dist/${flink_url_file_path}.asc
 
-        sed \
-            -e "s/%%FLINK_VERSION%%/$flink_version/" \
-            -e "s/%%SCALA_VERSION%%/$scala_version/" \
-            -e "s/%%GPG_KEY%%/$gpg_key/" \
-            "Dockerfile-$source_variant.template" > "$dir/Dockerfile"
+        generate "${dir}" "${flink_tgz_url}" "${flink_asc_url}" ${gpg_key} false ${source_variant}
     done
+
+    if [ -n "${binary_download_url}" ]; then
+        dir="$flink_release/custom-${source_variant}"
+
+        generate "${dir}" "${binary_download_url}" "" "" true ${source_variant}

Review comment:
       That's a fair point. I did not want to change any existing code path (to ensure it still works), but at the same time not introduce multiple files; so we end up with this mixed bag.
   
   I'll try an approach with separate files.




----------------------------------------------------------------
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:
users@infra.apache.org