[emscripten-releases] Pass revision and build info to build script

Pass the standard buildbucket info to the script using the pre-existing
buildbot environment variables and a made-up master name.
Also simplifiy the wasm_llvm config by just hardcoding the master name.

Bug: v8:8921
Change-Id: If239bfbd378bb520adea8ead6ab49ebd99b95ea8
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/build/+/1617711
Commit-Queue: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
diff --git a/scripts/slave/recipes/emscripten_releases.expected/linux.json b/scripts/slave/recipes/emscripten_releases.expected/linux.json
index 1c7a7e9..b0ee6bf 100644
--- a/scripts/slave/recipes/emscripten_releases.expected/linux.json
+++ b/scripts/slave/recipes/emscripten_releases.expected/linux.json
@@ -45,7 +45,7 @@
       "ensure-directory",
       "--mode",
       "0777",
-      "[GOMA_CACHE]/data"
+      "[GOMA_CACHE]/data/linux"
     ],
     "infra_step": true,
     "name": "preprocess_for_goma.goma cache directory",
@@ -62,7 +62,7 @@
     ],
     "env": {
       "GOMACTL_CRASH_REPORT_ID_FILE": "[TMP_BASE]/crash_report_id",
-      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data",
+      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data/linux",
       "GOMA_DUMP_COUNTERZ_FILE": "[TMP_BASE]/goma_counterz",
       "GOMA_DUMP_STATS_FILE": "[TMP_BASE]/goma_stats",
       "GOMA_ENABLE_COUNTERZ": "true",
@@ -146,7 +146,7 @@
       "--output_json",
       "/path/to/tmp/json",
       "--revision",
-      "emscripten-releases@HEAD"
+      "emscripten-releases@2d72510e447ab60a9728aeea2362d8be2cbd7789"
     ],
     "cwd": "[BUILDER_CACHE]",
     "env_suffixes": {
@@ -161,7 +161,7 @@
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"did_run\": true, @@@",
       "@@@STEP_LOG_LINE@json.output@  \"fixed_revisions\": {@@@",
-      "@@@STEP_LOG_LINE@json.output@    \"emscripten-releases\": \"HEAD\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"emscripten-releases\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\"@@@",
       "@@@STEP_LOG_LINE@json.output@  }, @@@",
       "@@@STEP_LOG_LINE@json.output@  \"manifest\": {@@@",
       "@@@STEP_LOG_LINE@json.output@    \"emscripten-releases\": {@@@",
@@ -224,6 +224,11 @@
       "--build-include=wabt"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -248,6 +253,11 @@
       "--build-include=binaryen"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -272,6 +282,11 @@
       "--build-include=v8"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -297,6 +312,11 @@
       "--no-tool-tests"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -321,6 +341,11 @@
       "--build-include=fastcomp"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -345,6 +370,11 @@
       "--build-include=emscripten"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -367,8 +397,13 @@
       "[TMP_BASE]/goma_jsonstatus.json"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMACTL_CRASH_REPORT_ID_FILE": "[TMP_BASE]/crash_report_id",
-      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data",
+      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data/linux",
       "GOMA_DIR": "[GOMA_CACHE]/client",
       "GOMA_DUMP_COUNTERZ_FILE": "[TMP_BASE]/goma_counterz",
       "GOMA_DUMP_STATS_FILE": "[TMP_BASE]/goma_stats",
@@ -405,8 +440,13 @@
       "stat"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMACTL_CRASH_REPORT_ID_FILE": "[TMP_BASE]/crash_report_id",
-      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data",
+      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data/linux",
       "GOMA_DIR": "[GOMA_CACHE]/client",
       "GOMA_DUMP_COUNTERZ_FILE": "[TMP_BASE]/goma_counterz",
       "GOMA_DUMP_STATS_FILE": "[TMP_BASE]/goma_stats",
@@ -432,8 +472,13 @@
       "stop"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMACTL_CRASH_REPORT_ID_FILE": "[TMP_BASE]/crash_report_id",
-      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data",
+      "GOMA_CACHE_DIR": "[GOMA_CACHE]/data/linux",
       "GOMA_DIR": "[GOMA_CACHE]/client",
       "GOMA_DUMP_COUNTERZ_FILE": "[TMP_BASE]/goma_counterz",
       "GOMA_DUMP_STATS_FILE": "[TMP_BASE]/goma_stats",
@@ -477,11 +522,20 @@
       "[TMP_BASE]/goma_counterz",
       "--goma-crash-report-id-file",
       "[TMP_BASE]/crash_report_id",
+      "--build-id",
+      "8945511751514863184",
       "--builder-id-json",
-      "{\"bucket\": \"\", \"builder\": \"\", \"project\": \"\"}",
-      "--is-luci"
+      "{\"bucket\": \"ci\", \"builder\": \"linux\", \"project\": \"emscripten-releases\"}",
+      "--is-luci",
+      "--buildbot-buildername",
+      "linux"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -514,6 +568,11 @@
       "[TMP_BASE]/cloudtail.pid"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -542,6 +601,11 @@
       "--test-include=emtest"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
@@ -566,6 +630,11 @@
       "--test-include=emtest-asm"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
diff --git a/scripts/slave/recipes/emscripten_releases.expected/linux_buildfail.json b/scripts/slave/recipes/emscripten_releases.expected/linux_buildfail.json
index 4cc69c2..83c5f92 100644
--- a/scripts/slave/recipes/emscripten_releases.expected/linux_buildfail.json
+++ b/scripts/slave/recipes/emscripten_releases.expected/linux_buildfail.json
@@ -25,11 +25,20 @@
       "[TMP_BASE]/goma_counterz",
       "--goma-crash-report-id-file",
       "[TMP_BASE]/crash_report_id",
+      "--build-id",
+      "8945511751514863184",
       "--builder-id-json",
-      "{\"bucket\": \"\", \"builder\": \"\", \"project\": \"\"}",
-      "--is-luci"
+      "{\"bucket\": \"ci\", \"builder\": \"linux\", \"project\": \"emscripten-releases\"}",
+      "--is-luci",
+      "--buildbot-buildername",
+      "linux"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
diff --git a/scripts/slave/recipes/emscripten_releases.expected/linux_emtest_fail.json b/scripts/slave/recipes/emscripten_releases.expected/linux_emtest_fail.json
index 3e76cc8..fde0b72 100644
--- a/scripts/slave/recipes/emscripten_releases.expected/linux_emtest_fail.json
+++ b/scripts/slave/recipes/emscripten_releases.expected/linux_emtest_fail.json
@@ -14,6 +14,11 @@
       "--test-include=emtest-asm"
     ],
     "env": {
+      "BUILDBOT_BUCKET": "ci",
+      "BUILDBOT_BUILDERNAME": "linux",
+      "BUILDBOT_BUILDNUMBER": "42",
+      "BUILDBOT_MASTERNAME": "emscripten-releases",
+      "BUILDBOT_REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789",
       "GOMA_DIR": "[GOMA_CACHE]/client"
     },
     "env_suffixes": {
diff --git a/scripts/slave/recipes/emscripten_releases.py b/scripts/slave/recipes/emscripten_releases.py
index a9b1b3a..2335e9f 100644
--- a/scripts/slave/recipes/emscripten_releases.py
+++ b/scripts/slave/recipes/emscripten_releases.py
@@ -23,6 +23,11 @@
   api.gclient.set_config('emscripten_releases')
   goma_dir = api.goma.ensure_goma()
   env = {
+      'BUILDBOT_MASTERNAME': 'emscripten-releases',
+      'BUILDBOT_BUILDERNAME': api.buildbucket.builder_name,
+      'BUILDBOT_REVISION': api.buildbucket.gitiles_commit.id,
+      'BUILDBOT_BUILDNUMBER': api.buildbucket.build.number,
+      'BUILDBOT_BUCKET': api.buildbucket.build.builder.bucket,
       'GOMA_DIR': goma_dir,
   }
   api.goma.start()
@@ -87,6 +92,11 @@
     return (
         api.test(name) +
         api.properties(path_config='kitchen') +
+        api.buildbucket.ci_build(
+            project='emscripten-releases',
+            builder='linux',
+            build_number=42,
+        ) +
         api.runtime(is_luci=True, is_experimental=False)
     )
 
diff --git a/scripts/slave/recipes/wasm_llvm.expected/linux.json b/scripts/slave/recipes/wasm_llvm.expected/linux.json
index 6a421ac..4082d44 100644
--- a/scripts/slave/recipes/wasm_llvm.expected/linux.json
+++ b/scripts/slave/recipes/wasm_llvm.expected/linux.json
@@ -313,9 +313,7 @@
       "{\"bucket\": \"ci\", \"builder\": \"linux\", \"project\": \"wasm\"}",
       "--is-luci",
       "--buildbot-buildername",
-      "linux",
-      "--buildbot-mastername",
-      "client.wasm.llvm"
+      "linux"
     ],
     "name": "postprocess_for_goma.upload_log",
     "~followup_annotations": [
diff --git a/scripts/slave/recipes/wasm_llvm.expected/linux_fail.json b/scripts/slave/recipes/wasm_llvm.expected/linux_fail.json
index 7d0f218..0796d01 100644
--- a/scripts/slave/recipes/wasm_llvm.expected/linux_fail.json
+++ b/scripts/slave/recipes/wasm_llvm.expected/linux_fail.json
@@ -316,9 +316,7 @@
       "{\"bucket\": \"ci\", \"builder\": \"linux\", \"project\": \"wasm\"}",
       "--is-luci",
       "--buildbot-buildername",
-      "linux",
-      "--buildbot-mastername",
-      "client.wasm.llvm"
+      "linux"
     ],
     "name": "postprocess_for_goma.upload_log",
     "~followup_annotations": [
diff --git a/scripts/slave/recipes/wasm_llvm.py b/scripts/slave/recipes/wasm_llvm.py
index 74bdcf6..055dca8 100644
--- a/scripts/slave/recipes/wasm_llvm.py
+++ b/scripts/slave/recipes/wasm_llvm.py
@@ -32,7 +32,7 @@
   got_revision = result.presentation.properties['got_waterfall_revision']
   goma_dir = api.goma.ensure_goma()
   env = {
-      'BUILDBOT_MASTERNAME': api.properties['mastername'],
+      'BUILDBOT_MASTERNAME': 'client.wasm.llvm',
       'BUILDBOT_BUILDERNAME': api.buildbucket.builder_name,
       'BUILDBOT_REVISION': api.buildbucket.gitiles_commit.id,
       'BUILDBOT_BUILDNUMBER': api.buildbucket.build.number,
@@ -64,7 +64,6 @@
     return (
         api.test(name) +
         api.properties(
-          mastername='client.wasm.llvm',
           path_config='kitchen',
           **kwargs
         ) +