Update gerrit pipelines (#2928)

Update Ubuntu version to 2404. For rbe build disable polygerrit build
and limit rbe tests to javatests.
diff --git a/pipelines/gerrit.yml b/pipelines/gerrit.yml
index 05b4097..3518d3b 100644
--- a/pipelines/gerrit.yml
+++ b/pipelines/gerrit.yml
@@ -8,7 +8,7 @@
       - "--test_tag_filters=-git,-git-protocol-v2,-git-upload-archive,-ssh"
     test_targets:
       - "//..."
-  ubuntu2204:
+  ubuntu2404:
     build_targets:
       - "//:release"
       - "//:api"
@@ -28,7 +28,7 @@
       - "--remote_instance_name=projects/bazel-untrusted/instances/default_instance"
       - "--remote_executor=grpcs://remotebuildexecution.googleapis.com"
     build_targets:
-      - "//:release"
+      - "//:headless"
       - "//:api-skip-javadoc"
     test_flags:
       - "--config=remote"
@@ -37,4 +37,4 @@
       - "--experimental_remote_cache_async"
       - "--remote_download_minimal"
     test_targets:
-      - "//..."
+      - "//javatests/..."