From 7310329f4a6f019e8109b45796ad39373efb8582 Mon Sep 17 00:00:00 2001
From: Kenneth Knowles <klk@google.com>
Date: Thu, 17 Oct 2024 08:26:39 -0400
Subject: [PATCH] Drop Flink 1.15 support

---
 CHANGES.md                                    |  1 +
 gradle.properties                             |  2 +-
 .../runner-concepts/description.md            |  8 ++--
 runners/flink/1.15/build.gradle               | 25 -----------
 .../1.15/job-server-container/build.gradle    | 26 -----------
 runners/flink/1.15/job-server/build.gradle    | 31 -------------
 .../types/CoderTypeSerializer.java            |  0
 .../streaming/MemoryStateBackendWrapper.java  |  0
 .../flink/streaming/StreamSources.java        |  0
 runners/flink/flink_runner.gradle             | 43 ++++++-------------
 .../src/apache_beam/runners/flink.ts          |  2 +-
 settings.gradle.kts                           |  4 --
 .../content/en/documentation/runners/flink.md |  3 +-
 13 files changed, 21 insertions(+), 124 deletions(-)
 delete mode 100644 runners/flink/1.15/build.gradle
 delete mode 100644 runners/flink/1.15/job-server-container/build.gradle
 delete mode 100644 runners/flink/1.15/job-server/build.gradle
 rename runners/flink/{1.15 => 1.16}/src/main/java/org/apache/beam/runners/flink/translation/types/CoderTypeSerializer.java (100%)
 rename runners/flink/{1.15 => 1.16}/src/test/java/org/apache/beam/runners/flink/streaming/MemoryStateBackendWrapper.java (100%)
 rename runners/flink/{1.15 => 1.16}/src/test/java/org/apache/beam/runners/flink/streaming/StreamSources.java (100%)

diff --git a/CHANGES.md b/CHANGES.md
index 840c60fc1149..41f2e74bbeae 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -83,6 +83,7 @@
 
 ## Deprecations
 
+* Removed support for Flink 1.15
 * X behavior is deprecated and will be removed in X versions ([#X](https://github.com/apache/beam/issues/X)).
 
 ## Bugfixes
diff --git a/gradle.properties b/gradle.properties
index f6e143690a34..868c7501ac31 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -39,6 +39,6 @@ docker_image_default_repo_root=apache
 docker_image_default_repo_prefix=beam_
 
 # supported flink versions
-flink_versions=1.15,1.16,1.17,1.18,1.19
+flink_versions=1.16,1.17,1.18,1.19
 # supported python versions
 python_versions=3.8,3.9,3.10,3.11,3.12
diff --git a/learning/tour-of-beam/learning-content/introduction/introduction-concepts/runner-concepts/description.md b/learning/tour-of-beam/learning-content/introduction/introduction-concepts/runner-concepts/description.md
index 6eb1c04e966a..063e7f35f876 100644
--- a/learning/tour-of-beam/learning-content/introduction/introduction-concepts/runner-concepts/description.md
+++ b/learning/tour-of-beam/learning-content/introduction/introduction-concepts/runner-concepts/description.md
@@ -191,8 +191,8 @@ $ wordcount --input gs://dataflow-samples/shakespeare/kinglear.txt \
 {{if (eq .Sdk "java")}}
 
 ##### Portable
-1. Starting with Beam 2.18.0, pre-built Flink Job Service Docker images are available at Docker Hub: `Flink 1.15`, `Flink 1.16`, `Flink 1.17`, `Flink 1.18`.
-2. Start the JobService endpoint: `docker run --net=host apache/beam_flink1.10_job_server:latest`
+1. Starting with Beam 2.18.0, pre-built Flink Job Service Docker images are available at Docker Hub: `Flink 1.16`, `Flink 1.17`, `Flink 1.18`, `Flink 1.19`.
+2. Start the JobService endpoint: `docker run --net=host apache/beam_flink1.19_job_server:latest`
 3. Submit the pipeline to the above endpoint by using the PortableRunner, job_endpoint set to localhost:8099 (this is the default address of the JobService). Optionally set environment_type set to LOOPBACK. For example:
 
 ```
@@ -233,8 +233,8 @@ mvn exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
 {{end}}
 
 {{if (eq .Sdk "python")}}
-1. Starting with Beam 2.18.0, pre-built Flink Job Service Docker images are available at Docker Hub: `Flink 1.10`, `Flink 1.11`, `Flink 1.12`, `Flink 1.13`, `Flink 1.14`.
-2. Start the JobService endpoint: `docker run --net=host apache/beam_flink1.10_job_server:latest`
+1. Starting with Beam 2.18.0, pre-built Flink Job Service Docker images are available at Docker Hub: `Flink 1.16`, `Flink 1.17`, `Flink 1.18`, `Flink 1.19`.
+2. Start the JobService endpoint: `docker run --net=host apache/beam_flink1.19_job_server:latest`
 3. Submit the pipeline to the above endpoint by using the PortableRunner, job_endpoint set to localhost:8099 (this is the default address of the JobService). Optionally set environment_type set to LOOPBACK. For example:
 
 ```
diff --git a/runners/flink/1.15/build.gradle b/runners/flink/1.15/build.gradle
deleted file mode 100644
index 8055cf593ad0..000000000000
--- a/runners/flink/1.15/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * License); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-project.ext {
-  flink_major = '1.15'
-  flink_version = '1.15.0'
-}
-
-// Load the main build script which contains all build logic.
-apply from: "../flink_runner.gradle"
diff --git a/runners/flink/1.15/job-server-container/build.gradle b/runners/flink/1.15/job-server-container/build.gradle
deleted file mode 100644
index afdb68a0fc91..000000000000
--- a/runners/flink/1.15/job-server-container/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * License); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-def basePath = '../../job-server-container'
-
-project.ext {
-  resource_path = basePath
-}
-
-// Load the main build script which contains all build logic.
-apply from: "$basePath/flink_job_server_container.gradle"
diff --git a/runners/flink/1.15/job-server/build.gradle b/runners/flink/1.15/job-server/build.gradle
deleted file mode 100644
index 05ad8feb5b78..000000000000
--- a/runners/flink/1.15/job-server/build.gradle
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * License); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-def basePath = '../../job-server'
-
-project.ext {
-  // Look for the source code in the parent module
-  main_source_dirs = ["$basePath/src/main/java"]
-  test_source_dirs = ["$basePath/src/test/java"]
-  main_resources_dirs = ["$basePath/src/main/resources"]
-  test_resources_dirs = ["$basePath/src/test/resources"]
-  archives_base_name = 'beam-runners-flink-1.15-job-server'
-}
-
-// Load the main build script which contains all build logic.
-apply from: "$basePath/flink_job_server.gradle"
diff --git a/runners/flink/1.15/src/main/java/org/apache/beam/runners/flink/translation/types/CoderTypeSerializer.java b/runners/flink/1.16/src/main/java/org/apache/beam/runners/flink/translation/types/CoderTypeSerializer.java
similarity index 100%
rename from runners/flink/1.15/src/main/java/org/apache/beam/runners/flink/translation/types/CoderTypeSerializer.java
rename to runners/flink/1.16/src/main/java/org/apache/beam/runners/flink/translation/types/CoderTypeSerializer.java
diff --git a/runners/flink/1.15/src/test/java/org/apache/beam/runners/flink/streaming/MemoryStateBackendWrapper.java b/runners/flink/1.16/src/test/java/org/apache/beam/runners/flink/streaming/MemoryStateBackendWrapper.java
similarity index 100%
rename from runners/flink/1.15/src/test/java/org/apache/beam/runners/flink/streaming/MemoryStateBackendWrapper.java
rename to runners/flink/1.16/src/test/java/org/apache/beam/runners/flink/streaming/MemoryStateBackendWrapper.java
diff --git a/runners/flink/1.15/src/test/java/org/apache/beam/runners/flink/streaming/StreamSources.java b/runners/flink/1.16/src/test/java/org/apache/beam/runners/flink/streaming/StreamSources.java
similarity index 100%
rename from runners/flink/1.15/src/test/java/org/apache/beam/runners/flink/streaming/StreamSources.java
rename to runners/flink/1.16/src/test/java/org/apache/beam/runners/flink/streaming/StreamSources.java
diff --git a/runners/flink/flink_runner.gradle b/runners/flink/flink_runner.gradle
index c8f492a901d3..d13e1c5faf6e 100644
--- a/runners/flink/flink_runner.gradle
+++ b/runners/flink/flink_runner.gradle
@@ -173,36 +173,19 @@ dependencies {
   implementation library.java.joda_time
   implementation library.java.args4j
 
-  // Flink 1.15 shades all remaining scala dependencies and therefor does not depend on a specific version of Scala anymore
-  if (flink_version.compareTo("1.15") >= 0) {
-    implementation "org.apache.flink:flink-clients:$flink_version"
-    // Runtime dependencies are not included in Beam's generated pom.xml, so we must declare flink-clients in implementation
-    // configuration (https://issues.apache.org/jira/browse/BEAM-11732).
-    permitUnusedDeclared "org.apache.flink:flink-clients:$flink_version"
-
-    implementation "org.apache.flink:flink-streaming-java:$flink_version"
-    // RocksDB state backend (included in the Flink distribution)
-    provided "org.apache.flink:flink-statebackend-rocksdb:$flink_version"
-    testImplementation "org.apache.flink:flink-statebackend-rocksdb:$flink_version"
-    testImplementation "org.apache.flink:flink-streaming-java:$flink_version:tests"
-    testImplementation "org.apache.flink:flink-test-utils:$flink_version"
-
-    miniCluster "org.apache.flink:flink-runtime-web:$flink_version"
-  } else {
-    implementation "org.apache.flink:flink-clients_2.12:$flink_version"
-    // Runtime dependencies are not included in Beam's generated pom.xml, so we must declare flink-clients in implementation
-    // configuration (https://issues.apache.org/jira/browse/BEAM-11732).
-    permitUnusedDeclared "org.apache.flink:flink-clients_2.12:$flink_version"
-
-    implementation "org.apache.flink:flink-streaming-java_2.12:$flink_version"
-    // RocksDB state backend (included in the Flink distribution)
-    provided "org.apache.flink:flink-statebackend-rocksdb_2.12:$flink_version"
-    testImplementation "org.apache.flink:flink-statebackend-rocksdb_2.12:$flink_version"
-    testImplementation "org.apache.flink:flink-streaming-java_2.12:$flink_version:tests"
-    testImplementation "org.apache.flink:flink-test-utils_2.12:$flink_version"
-
-    miniCluster "org.apache.flink:flink-runtime-web_2.12:$flink_version"
-  }
+  implementation "org.apache.flink:flink-clients:$flink_version"
+  // Runtime dependencies are not included in Beam's generated pom.xml, so we must declare flink-clients in implementation
+  // configuration (https://issues.apache.org/jira/browse/BEAM-11732).
+  permitUnusedDeclared "org.apache.flink:flink-clients:$flink_version"
+
+  implementation "org.apache.flink:flink-streaming-java:$flink_version"
+  // RocksDB state backend (included in the Flink distribution)
+  provided "org.apache.flink:flink-statebackend-rocksdb:$flink_version"
+  testImplementation "org.apache.flink:flink-statebackend-rocksdb:$flink_version"
+  testImplementation "org.apache.flink:flink-streaming-java:$flink_version:tests"
+  testImplementation "org.apache.flink:flink-test-utils:$flink_version"
+
+  miniCluster "org.apache.flink:flink-runtime-web:$flink_version"
 
   implementation "org.apache.flink:flink-core:$flink_version"
   implementation "org.apache.flink:flink-metrics-core:$flink_version"
diff --git a/sdks/typescript/src/apache_beam/runners/flink.ts b/sdks/typescript/src/apache_beam/runners/flink.ts
index e21876c0d517..b68d3070a720 100644
--- a/sdks/typescript/src/apache_beam/runners/flink.ts
+++ b/sdks/typescript/src/apache_beam/runners/flink.ts
@@ -28,7 +28,7 @@ import { JavaJarService } from "../utils/service";
 const MAGIC_HOST_NAMES = ["[local]", "[auto]"];
 
 // These should stay in sync with gradle.properties.
-const PUBLISHED_FLINK_VERSIONS = ["1.15", "1.16", "1.17", "1.18", "1.19"];
+const PUBLISHED_FLINK_VERSIONS = ["1.16", "1.17", "1.18", "1.19"];
 
 const defaultOptions = {
   flinkMaster: "[local]",
diff --git a/settings.gradle.kts b/settings.gradle.kts
index b71ed1ede134..67e499e1ea31 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -125,10 +125,6 @@ include(":runners:extensions-java:metrics")
   * verify versions in website/www/site/content/en/documentation/runners/flink.md
   * verify version in sdks/python/apache_beam/runners/interactive/interactive_beam.py
  */
-// Flink 1.15
-include(":runners:flink:1.15")
-include(":runners:flink:1.15:job-server")
-include(":runners:flink:1.15:job-server-container")
 // Flink 1.16
 include(":runners:flink:1.16")
 include(":runners:flink:1.16:job-server")
diff --git a/website/www/site/content/en/documentation/runners/flink.md b/website/www/site/content/en/documentation/runners/flink.md
index 2c28aa7062ec..9bf99cf9e4c2 100644
--- a/website/www/site/content/en/documentation/runners/flink.md
+++ b/website/www/site/content/en/documentation/runners/flink.md
@@ -196,7 +196,6 @@ The optional `flink_version` option may be required as well for older versions o
 
 {{< paragraph class="language-portable" >}}
 Starting with Beam 2.18.0, pre-built Flink Job Service Docker images are available at Docker Hub:
-[Flink 1.15](https://hub.docker.com/r/apache/beam_flink1.15_job_server).
 [Flink 1.16](https://hub.docker.com/r/apache/beam_flink1.16_job_server).
 [Flink 1.17](https://hub.docker.com/r/apache/beam_flink1.17_job_server).
 [Flink 1.18](https://hub.docker.com/r/apache/beam_flink1.18_job_server).
@@ -350,7 +349,7 @@ To find out which version of Flink is compatible with Beam please see the table
 <tr>
   <td>1.15.x</td>
   <td>beam-runners-flink-1.15</td>
-  <td>&ge; 2.40.0</td>
+  <td>2.40.0 - 2.60.0</td>
 </tr>
 <tr>
   <td>1.14.x</td>