[FLINK-19408] Update add-version.sh for cross-releasing Java 8 and 11
diff --git a/add-version.sh b/add-version.sh
index 78e5bb9..e379bfe 100755
--- a/add-version.sh
+++ b/add-version.sh
@@ -58,20 +58,25 @@
error "Missing GPG key ID in gpg_keys.txt file for release $statefun_version"
fi
-if [ -d "$statefun_version" ]; then
- error "Directory $statefun_version already exists; delete before continuing"
-fi
+function generate_dockerfile() {
+ local java_version="$1"
+ local dir="$statefun_version-java$java_version"
-echo -n >&2 "Generating Dockerfiles..."
-dir="$statefun_version"
-mkdir "$dir"
+ echo -n >&2 "Generating Dockerfiles for StateFun version=$statefun_version, Flink version=$flink_version, Java version=$java_version ..."
+ rm -rf $dir
+ mkdir "$dir"
-cp -r template/* "$dir"
+ cp -r template/* "$dir"
-sed \
- -e "s/%%STATEFUN_VERSION%%/$statefun_version/" \
- -e "s/%%FLINK_VERSION%%/$flink_version/" \
- -e "s/%%GPG_KEY%%/$gpg_key/" \
- "template/Dockerfile" > "$dir/Dockerfile"
+ sed \
+ -e "s/%%STATEFUN_VERSION%%/$statefun_version/" \
+ -e "s/%%FLINK_VERSION%%/$flink_version/" \
+ -e "s/%%JAVA_VERSION%%/$java_version/" \
+ -e "s/%%GPG_KEY%%/$gpg_key/" \
+ "template/Dockerfile" > "$dir/Dockerfile"
-echo >&2 " done."
\ No newline at end of file
+ echo >&2 " done."
+}
+
+generate_dockerfile 8
+generate_dockerfile 11
diff --git a/template/Dockerfile b/template/Dockerfile
index 12ce302..f0b52de 100644
--- a/template/Dockerfile
+++ b/template/Dockerfile
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM flink:%%FLINK_VERSION%%
+FROM flink:%%FLINK_VERSION%%-scala_2.12-java%%JAVA_VERSION%%
ENV STATEFUN_VERSION=%%STATEFUN_VERSION%% \
GPG_KEY=%%GPG_KEY%%