Cleanup/update more EOL ubuntu platforms (#2850)

Scoped to bazel_bench.py, docgen/*, doc/*, pipelines/*.
diff --git a/buildkite/bazel-bench/bazel_bench.py b/buildkite/bazel-bench/bazel_bench.py
index 9e47c64..ff33bc7 100644
--- a/buildkite/bazel-bench/bazel_bench.py
+++ b/buildkite/bazel-bench/bazel_bench.py
@@ -61,7 +61,7 @@
         "git_repository": "https://github.com/tensorflow/tensorflow.git",
         "bazel_command": "build --output_filter=^\$ //tensorflow/core:core",
         "bazel_bench_extra_options": {
-            "ubuntu1804": "--env_configure=\"unset PYTHONPATH && yes '' | python3 ./configure.py\"",
+            "ubuntu2404": "--env_configure=\"unset PYTHONPATH && yes '' | python3 ./configure.py\"",
             "macos": ("--env_configure=\"python3 --version && unset PYTHONPATH "
                 "&& pip3 install -U --user pip six numpy wheel setuptools mock 'future>=0.17.1' "
                 "&& pip3 install -U --user keras_applications==1.0.6 --no-deps "
@@ -75,8 +75,8 @@
 DATA_DIRECTORY = os.path.join(TMP, ".bazel-bench", "out")
 BAZEL_BENCH_RESULT_FILENAME = "perf_data.csv"
 AGGR_JSON_PROFILES_FILENAME = "aggr_json_profiles.csv"
-PLATFORMS_WHITELIST = ['macos', 'ubuntu1804']
-REPORT_GENERATION_PLATFORM = 'ubuntu1804'
+PLATFORMS_WHITELIST = ['macos', 'ubuntu2404']
+REPORT_GENERATION_PLATFORM = 'ubuntu2404'
 
 
 def _bazel_bench_env_setup_command(platform, bazel_commits):
diff --git a/docgen/Dockerfile b/docgen/Dockerfile
index 8d01538..00d278c 100644
--- a/docgen/Dockerfile
+++ b/docgen/Dockerfile
@@ -1,9 +1,9 @@
 # Based on:
 # bazelbuild/bazel/scripts/docs/Dockerfile
 # bazel-blog/scripts/Dockerfile
-# bazelbuild/continuous-integration/buildkite/docker/ubuntu1804/Dockerfile
+# bazelbuild/continuous-integration/buildkite/docker/ubuntu2404/Dockerfile
 
-FROM ubuntu:18.04
+FROM ubuntu:24.04
 
 ENV DEBIAN_FRONTEND="noninteractive"
 RUN apt-get -qqy update && \
diff --git a/docgen/docgen.py b/docgen/docgen.py
index 6d5a708..1d1c3a9 100644
--- a/docgen/docgen.py
+++ b/docgen/docgen.py
@@ -25,7 +25,7 @@
 
 DEFAULT_FLAGS = ["--action_env=PATH=/usr/local/bin:/usr/bin:/bin", "--sandbox_tmpfs_path=/tmp"]
 
-PLATFORM = "ubuntu1804"
+PLATFORM = "ubuntu2404"
 
 Settings = collections.namedtuple(
     "Settings",
diff --git a/docs/downstream-testing.md b/docs/downstream-testing.md
index d2ab968..5e164bb 100644
--- a/docs/downstream-testing.md
+++ b/docs/downstream-testing.md
@@ -83,7 +83,7 @@
 eg.
 ```
 PROJECT_NAME=rules_go
-PLATFORM_NAME=ubuntu2004
+PLATFORM_NAME=ubuntu2404
 GOOD_BAZEL_COMMIT=b6ea3b6caa7f379778e74da33d1bd0ff6477f963
 BAD_BAZEL_COMMIT=91eb3d207714af0ab1e5812252a0f10f40d6e4a8
 ```
diff --git a/pipelines/abseil-cpp.yml b/pipelines/abseil-cpp.yml
index c8e4318..89910ad 100644
--- a/pipelines/abseil-cpp.yml
+++ b/pipelines/abseil-cpp.yml
@@ -1,6 +1,6 @@
 ---
 tasks:
-  ubuntu1804:
+  ubuntu2404:
     build_targets:
       - "//absl/..."
     test_flags:
diff --git a/pipelines/abseil-py.yml b/pipelines/abseil-py.yml
index 146137f..acb5892 100644
--- a/pipelines/abseil-py.yml
+++ b/pipelines/abseil-py.yml
@@ -1,6 +1,6 @@
 ---
 tasks:
-  ubuntu1804:
+  ubuntu2404:
     build_targets:
       - "//absl/..."
     test_targets:
diff --git a/pipelines/bazel-custom-release.yml b/pipelines/bazel-custom-release.yml
index 66e7393..c9a5a9d 100644
--- a/pipelines/bazel-custom-release.yml
+++ b/pipelines/bazel-custom-release.yml
@@ -10,7 +10,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu1804-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/bazel-linux-arm64.yml b/pipelines/bazel-linux-arm64.yml
index a2a3819..6a07f76 100644
--- a/pipelines/bazel-linux-arm64.yml
+++ b/pipelines/bazel-linux-arm64.yml
@@ -1,6 +1,6 @@
 ---
 tasks:
-  ubuntu2004_arm64:
+  ubuntu2404_arm64:
     shell_commands:
       # Android SDK NDK not available on Linux ARM64
       # - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
diff --git a/pipelines/bazel-postsubmit.yml b/pipelines/bazel-postsubmit.yml
index fbb96c7..d18d8e1 100644
--- a/pipelines/bazel-postsubmit.yml
+++ b/pipelines/bazel-postsubmit.yml
@@ -79,8 +79,8 @@
     include_json_profile:
       - build
       - test
-  ubuntu2004_clang:
-    platform: ubuntu2004
+  ubuntu2404_clang:
+    platform: ubuntu2404
     environment:
       CC: clang
       CC_CONFIGURE_DEBUG: 1
@@ -103,25 +103,6 @@
     include_json_profile:
       - build
       - test
-  ubuntu2004:
-    shell_commands:
-      - rm -rf $HOME/bazeltest
-      - mkdir $HOME/bazeltest
-      - bazel mod deps --lockfile_mode=update
-    build_flags:
-      - "--config=ci-linux"
-    build_targets:
-      - "//src:bazel"
-      - "//src:bazel_jdk_minimal"
-      - "//src:test_repos"
-      - "//..."
-    test_flags:
-      - "--config=ci-linux"
-    test_targets:
-      - "//..."
-    include_json_profile:
-      - build
-      - test
   macos:
     shards: 5
     shell_commands:
@@ -241,8 +222,8 @@
       - "//src:bazel_nojdk.exe"
     include_json_profile:
       - build
-  rbe_ubuntu2004:
-    platform: ubuntu2004
+  rbe_ubuntu2404:
+    platform: ubuntu2404
     name: "RBE"
     shell_commands:
       - bazel mod deps --lockfile_mode=update
diff --git a/pipelines/bazel-release.yml b/pipelines/bazel-release.yml
index 4c011ee..ba34a25 100644
--- a/pipelines/bazel-release.yml
+++ b/pipelines/bazel-release.yml
@@ -9,7 +9,7 @@
         always-pull: true
         environment:
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
@@ -439,7 +439,7 @@
         always-pull: true
         environment:
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/bazelisk-binaries.yml b/pipelines/bazelisk-binaries.yml
index 5832627..e965007 100644
--- a/pipelines/bazelisk-binaries.yml
+++ b/pipelines/bazelisk-binaries.yml
@@ -16,7 +16,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu1804-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/bcr-integrity.yml b/pipelines/bcr-integrity.yml
index e5e516c..cb8afcc 100644
--- a/pipelines/bcr-integrity.yml
+++ b/pipelines/bcr-integrity.yml
@@ -19,7 +19,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/build-embedded-minimized-jdk.yml b/pipelines/build-embedded-minimized-jdk.yml
index 677b4a7..4fca03b 100644
--- a/pipelines/build-embedded-minimized-jdk.yml
+++ b/pipelines/build-embedded-minimized-jdk.yml
@@ -15,7 +15,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu1804-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/cloud-robotics.yml b/pipelines/cloud-robotics.yml
index c8043cc..a1fff77 100644
--- a/pipelines/cloud-robotics.yml
+++ b/pipelines/cloud-robotics.yml
@@ -1,7 +1,7 @@
 ---
 tasks:
-  ubuntu1804_latest_bazel:
-    platform: ubuntu1804
+  ubuntu2404_latest_bazel:
+    platform: ubuntu2404
     bazel: latest
     shell_commands:
     - |-
diff --git a/pipelines/continuous-integration.yml b/pipelines/continuous-integration.yml
index 0accd49..5522d5a 100644
--- a/pipelines/continuous-integration.yml
+++ b/pipelines/continuous-integration.yml
@@ -1,5 +1,5 @@
 steps:
-  - label: "Unit tests :ubuntu: 18.04"
+  - label: "Unit tests :ubuntu: 24.04"
     command:
       - python3 buildkite/bazelci_test.py
     agents: &linux_agents { queue: default }
@@ -10,7 +10,7 @@
             - "ANDROID_HOME"
             - "ANDROID_NDK_HOME"
             - "BUILDKITE_ARTIFACT_UPLOAD_DESTINATION"
-          image: "gcr.io/bazel-public/ubuntu1804-java11"
+          image: "gcr.io/bazel-public/ubuntu2404"
           network: "host"
           privileged: true
           propagate-environment: true
@@ -23,18 +23,18 @@
             - "/opt/android-sdk-linux:/opt/android-sdk-linux:ro"
             - "/var/lib/buildkite-agent:/var/lib/buildkite-agent"
             - "/var/lib/gitmirrors:/var/lib/gitmirrors:ro"
-  - label: "Project pipeline :ubuntu: 18.04 (JDK 8)"
+  - label: "Project pipeline :ubuntu: 24.04"
     command:
       - python3 buildkite/bazelci.py project_pipeline --file_config=pipelines/tensorflow.yml
     agents: *linux_agents
     plugins: *plugins
-  - label: "Downstream pipeline :ubuntu: 18.04 (JDK 8)"
+  - label: "Downstream pipeline :ubuntu: 24.04"
     command:
       - python3 buildkite/bazelci.py bazel_downstream_pipeline --http_config=https://raw.githubusercontent.com/bazelbuild/bazel/master/.bazelci/presubmit.yml
       - python3 buildkite/bazelci.py bazel_downstream_pipeline --test_disabled_projects --http_config=https://raw.githubusercontent.com/bazelbuild/bazel/master/.bazelci/presubmit.yml
     agents: *linux_agents
     plugins: *plugins
-  - label: "Publish binaries pipeline :ubuntu: 18.04 (JDK 8)"
+  - label: "Publish binaries pipeline :ubuntu: 24.04"
     command:
       - python3 buildkite/bazelci.py bazel_publish_binaries_pipeline --http_config=https://raw.githubusercontent.com/bazelbuild/bazel/master/.bazelci/build_bazel_binaries.yml
     agents: *linux_agents
diff --git a/pipelines/flogger.yml b/pipelines/flogger.yml
index d54fb80..30deadf 100644
--- a/pipelines/flogger.yml
+++ b/pipelines/flogger.yml
@@ -1,6 +1,6 @@
 ---
 platforms:
-  ubuntu2004:
+  ubuntu2404:
     build_targets:
       - "//..."
     test_targets:
diff --git a/pipelines/java_tools-rc.yml b/pipelines/java_tools-rc.yml
index 39152e7..79f7d1f 100644
--- a/pipelines/java_tools-rc.yml
+++ b/pipelines/java_tools-rc.yml
@@ -35,7 +35,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/java_tools-release.yml b/pipelines/java_tools-release.yml
index 7f05537..d206b6e 100644
--- a/pipelines/java_tools-release.yml
+++ b/pipelines/java_tools-release.yml
@@ -23,7 +23,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME 
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host 
         privileged: true 
         propagate-environment: true
diff --git a/pipelines/postsubmit-skymeld.yml b/pipelines/postsubmit-skymeld.yml
index 92b5fff..0091c20 100644
--- a/pipelines/postsubmit-skymeld.yml
+++ b/pipelines/postsubmit-skymeld.yml
@@ -52,53 +52,8 @@
     include_json_profile:
       - build
       - test
-  ubuntu1804:
-    shell_commands:
-      - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
-        android_ndk_repository/android_ndk_repository/' WORKSPACE
-      - rm -f WORKSPACE.bak
-      - rm -rf $HOME/bazeltest
-      - mkdir $HOME/bazeltest
-    build_flags:
-      - "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
-      - "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
-      - "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
-      - "--noremote_accept_cached"
-      - "--experimental_merged_skyframe_analysis_execution"
-      - "--experimental_skymeld_ui"
-      - "--experimental_skyframe_cpu_heavy_skykeys_thread_pool_size=HOST_CPUS*0.5"
-    build_targets:
-      - "//src:bazel"
-      - "//src:bazel_jdk_minimal"
-      - "//src:test_repos"
-    test_flags:
-      - "--sandbox_default_allow_network=false"
-      - "--sandbox_writable_path=$HOME/bazeltest"
-      - "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
-      - "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
-      # Configure and enable tests that require access to the network.
-      - "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
-      - "--experimental_merged_skyframe_analysis_execution"
-      - "--experimental_skymeld_ui"
-      - "--experimental_skyframe_cpu_heavy_skykeys_thread_pool_size=HOST_CPUS*0.5"
-    test_targets:
-      - "//scripts/..."
-      - "//src/java_tools/..."
-      - "//src/test/..."
-      - "//src/tools/execlog/..."
-      - "//src/tools/singlejar/..."
-      - "//src/tools/workspacelog/..."
-      - "//third_party/ijar/..."
-      - "//tools/android/..."
-      - "//tools/aquery_differ/..."
-      - "//tools/python/..."
-      # Re-enable once fixed: https://github.com/bazelbuild/bazel/issues/8162
-      - "-//src/java_tools/import_deps_checker/..."
-    include_json_profile:
-      - build
-      - test
-  ubuntu1804_clang:
-    platform: ubuntu1804
+  ubuntu2404_clang:
+    platform: ubuntu2404
     environment:
       CC: clang
       CC_CONFIGURE_DEBUG: 1
@@ -134,7 +89,7 @@
     include_json_profile:
       - build
       - test
-  ubuntu2004:
+  ubuntu2404:
     shell_commands:
       - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
         android_ndk_repository/android_ndk_repository/' WORKSPACE
@@ -180,15 +135,15 @@
     include_json_profile:
       - build
       - test
-  rbe_ubuntu1804:
-    platform: ubuntu1804
+  rbe_ubuntu2404:
+    platform: ubuntu2404
     shell_commands:
       - sed -i.bak
         -e 's/^# android_sdk_repository/android_sdk_repository/'
         -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE
       - rm -f WORKSPACE.bak
     build_flags:
-      - "--config=ubuntu1804_java11"
+      - "--config=remote"
       - "--remote_executor=grpcs://remotebuildexecution.googleapis.com"
       - "--jobs=200"
       - "--experimental_remote_download_outputs=minimal"
@@ -202,7 +157,7 @@
       - "//src:bazel_jdk_minimal"
       - "//src/main/java/..."
     test_flags:
-      - "--config=ubuntu1804_java11"
+      - "--config=remote"
       - "--remote_executor=grpcs://remotebuildexecution.googleapis.com"
       - "--jobs=200"
       - "--experimental_remote_download_outputs=minimal"
@@ -365,7 +320,7 @@
   #   include_json_profile:
   #     # - build
   #     - test
-  # kythe_ubuntu2004:
+  # kythe_ubuntu2404:
   #   shell_commands:
   #   - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/'
   #     -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE
diff --git a/pipelines/publish-bazel-binaries.yml b/pipelines/publish-bazel-binaries.yml
index e47a550..6513f2c 100644
--- a/pipelines/publish-bazel-binaries.yml
+++ b/pipelines/publish-bazel-binaries.yml
@@ -12,7 +12,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu1804-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host
         privileged: true
         propagate-environment: true
diff --git a/pipelines/re2.yml b/pipelines/re2.yml
index d84c148..801f1a0 100644
--- a/pipelines/re2.yml
+++ b/pipelines/re2.yml
@@ -1,7 +1,7 @@
 ---
 matrix:
   platform:
-  - ubuntu2004
+  - ubuntu2404
   - macos
   - windows
 tasks:
diff --git a/pipelines/rules_java-release.yml b/pipelines/rules_java-release.yml
index c27c839..344445c 100644
--- a/pipelines/rules_java-release.yml
+++ b/pipelines/rules_java-release.yml
@@ -10,7 +10,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME 
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host 
         privileged: true 
         propagate-environment: true
diff --git a/pipelines/rules_platform-release.yml b/pipelines/rules_platform-release.yml
index ca7a1b8..d42c7e9 100644
--- a/pipelines/rules_platform-release.yml
+++ b/pipelines/rules_platform-release.yml
@@ -10,7 +10,7 @@
           - ANDROID_HOME
           - ANDROID_NDK_HOME 
           - BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
-        image: gcr.io/bazel-public/ubuntu2004-java11
+        image: gcr.io/bazel-public/ubuntu2404
         network: host 
         privileged: true 
         propagate-environment: true
diff --git a/pipelines/subpar.yml b/pipelines/subpar.yml
index d54fb80..30deadf 100644
--- a/pipelines/subpar.yml
+++ b/pipelines/subpar.yml
@@ -1,6 +1,6 @@
 ---
 platforms:
-  ubuntu2004:
+  ubuntu2404:
     build_targets:
       - "//..."
     test_targets:
diff --git a/pipelines/tensorflow.yml b/pipelines/tensorflow.yml
index f5ff79e..16c0382 100644
--- a/pipelines/tensorflow.yml
+++ b/pipelines/tensorflow.yml
@@ -1,6 +1,6 @@
 ---
 platforms:
-  ubuntu2004:
+  ubuntu2404:
     environment:
       TF_IGNORE_MAX_BAZEL_VERSION: 1
     shell_commands: