Fix priority of most important trusted pipelines. (#2795)

- Infra pipelines (create VM/Docker images) run at highest priority 100
since we might need them to fix outages.
- Release builds run at next highest priority 50 - it's the next most
important pipeline which should not be blocked by the backlog of
https://buildkite.com/bazel-trusted/publish-bazel-binaries
- All other pipelines run at default priority 0

Co-authored-by: Xùdōng Yáng <wyverald@gmail.com>
diff --git a/buildkite/terraform/bazel-trusted/pipeline.yml.tpl b/buildkite/terraform/bazel-trusted/pipeline.yml.tpl
index 5bf09b6..3a23b4c 100644
--- a/buildkite/terraform/bazel-trusted/pipeline.yml.tpl
+++ b/buildkite/terraform/bazel-trusted/pipeline.yml.tpl
@@ -6,6 +6,7 @@
   ${key}: "${value}"
 %{ endfor ~}
 
+priority: ${try(priority, 0)}
 steps:
   - command: |-%{ for command in steps.commands }
       ${command}%{ endfor }%{ if try(steps.retry, false) }
diff --git a/buildkite/terraform/bazel-trusted/pipelines_bazel.tf b/buildkite/terraform/bazel-trusted/pipelines_bazel.tf
index c5379cd..b0f84d5 100644
--- a/buildkite/terraform/bazel-trusted/pipelines_bazel.tf
+++ b/buildkite/terraform/bazel-trusted/pipelines_bazel.tf
@@ -198,6 +198,7 @@
   default_branch = "release-8.1.0"
   steps = templatefile("pipeline.yml.tpl", {
     envs = {},
+    priority = 50,
     steps = {
       commands = [
         "bash -c 'set -euo pipefail; curl -s \"https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/pipelines/bazel-release.yml?$(date +%s)\" | tee /dev/tty | buildkite-agent pipeline upload --replace'"
diff --git a/buildkite/terraform/bazel-trusted/pipelines_misc.tf b/buildkite/terraform/bazel-trusted/pipelines_misc.tf
index 8d2e2b6..e22e70a 100644
--- a/buildkite/terraform/bazel-trusted/pipelines_misc.tf
+++ b/buildkite/terraform/bazel-trusted/pipelines_misc.tf
@@ -123,6 +123,7 @@
       BAZEL_VM_NAMES             = "bk-docker,bk-docker-arm64"
       BAZEL_PROD_INSTANCE_GROUPS = "bk-docker,bk-docker-arm64,bk-trusted-docker,bk-trusted-docker-arm64"
     },
+    priority = 100,
     steps = {
       commands = [
         "bash -c 'set -euo pipefail; curl -s \"https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/pipelines/publish-vm-image.yml?$(date +%s)\" | tee /dev/tty | buildkite-agent pipeline upload --replace'"
@@ -185,7 +186,7 @@
   name                       = "Create Linux Docker Images"
   repository                 = "https://github.com/bazelbuild/continuous-integration.git"
   default_branch             = "master"
-  steps                      = "---\nsteps:\n  - command: |-\n      docker builder prune -a -f\n      cd buildkite/docker\n      [ \"$BUILDKITE_BRANCH\" = \"master\" ] || [ \"$BUILDKITE_BRANCH\" = \"testing\" ] && git checkout $BUILDKITE_BRANCH\n      echo \"--- Building docker images...\"\n      ./build.sh\n      echo \"--- Pushing docker images...\"\n      ./push.sh\n    label: \":pipeline: Create images\"\n    agents:\n      - \"queue=default\""
+  steps                      = "---\npriority: 100\nsteps:\n  - command: |-\n      docker builder prune -a -f\n      cd buildkite/docker\n      [ \"$BUILDKITE_BRANCH\" = \"master\" ] || [ \"$BUILDKITE_BRANCH\" = \"testing\" ] && git checkout $BUILDKITE_BRANCH\n      echo \"--- Building docker images...\"\n      ./build.sh\n      echo \"--- Pushing docker images...\"\n      ./push.sh\n    label: \":pipeline: Create images\"\n    agents:\n      - \"queue=default\""
   allow_rebuilds             = true
   cancel_intermediate_builds = false
   skip_intermediate_builds   = false
@@ -261,6 +262,7 @@
       BAZEL_VM_NAMES             = "bk-windows"
       BAZEL_PROD_INSTANCE_GROUPS = "bk-windows,bk-trusted-windows"
     },
+    priority = 100,
     steps = {
       commands = [
         "bash -c 'set -euo pipefail; curl -s \"https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/pipelines/publish-vm-image.yml?$(date +%s)\" | tee /dev/tty | buildkite-agent pipeline upload --replace'"
@@ -343,6 +345,7 @@
   default_branch = "main"
   steps = templatefile("pipeline.yml.tpl", {
     envs = {},
+    priority = 75,
     steps = {
       commands = [
         "curl -sS \"https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazel-central-registry/bcr_postsubmit.py\" -o bcr_postsubmit.py",
diff --git a/pipelines/bazel-release.yml b/pipelines/bazel-release.yml
index f1f88fc..4c011ee 100644
--- a/pipelines/bazel-release.yml
+++ b/pipelines/bazel-release.yml
@@ -1,4 +1,5 @@
 ---
+priority: 50
 steps:
   - label: "Set up"
     agents:
diff --git a/pipelines/publish-vm-image.yml b/pipelines/publish-vm-image.yml
index 966f357..c330057 100644
--- a/pipelines/publish-vm-image.yml
+++ b/pipelines/publish-vm-image.yml
@@ -1,4 +1,5 @@
 ---
+priority: 100
 steps:
   - command: |-
       cd buildkite