From 48807c90ec0674eb9550934a911fcb1fc91acd30 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 4 May 2025 01:10:09 +0300 Subject: [PATCH] fix(ops/gerrit-tvl): query buildkite-status endpoint and re-enable This points our own gerrit check to the deployed buildkite-api-proxy, updates the URL and stops sending an outdated token. Fixes #118. Change-Id: Ic7ace4d67a6bd05c408ac14fe988ae3fe829a49b Reviewed-on: https://cl.snix.dev/c/snix/+/30406 Tested-by: besadii Autosubmit: Florian Klink Reviewed-by: edef --- ops/gerrit-tvl/static/tvl.js | 29 ++--------------------------- ops/modules/monorepo-gerrit.nix | 4 +++- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/ops/gerrit-tvl/static/tvl.js b/ops/gerrit-tvl/static/tvl.js index e88df63fb..dc9c2141b 100644 --- a/ops/gerrit-tvl/static/tvl.js +++ b/ops/gerrit-tvl/static/tvl.js @@ -1,17 +1,5 @@ // vim: set noai ts=2 sw=2 et: */ -// This is a read-only Buildkite token: it was generated and installed by flokli@ and has -// read_builds, read_build_logs, and read_pipelines permissions. -const BUILDKITE_TOKEN = 'bkua_fbb743ba597d89caf522876289705f6571bb599d'; - -function encodeParams(p) { - const pieces = []; - for (let k of Object.getOwnPropertyNames(p)) { - pieces.push(`${encodeURIComponent(k)}=${encodeURIComponent(p[k])}`); - } - return pieces.join('&'); -} - function formatDuration(from, to) { const millisecondsTook = Math.floor(to.valueOf() - from.valueOf()); if (millisecondsTook < 2000) return `${millisecondsTook} ms`; @@ -81,26 +69,13 @@ const snixChecksProvider = { async fetch(change) { let {patchsetSha, repo} = change; - const experiments = window.ENABLED_EXPERIMENTS || []; - if (experiments.includes("UiFeature__snix_check_debug")) { - patchsetSha = '76692104f58b849b1503a8d8a700298003fa7b5f'; - repo = 'snix'; - } - if (repo !== 'snix') { // We only handle snix's depot at the moment. return {responseCode: 'OK'}; } - const params = { - commit: patchsetSha, - }; - const url = `https://api.buildkite.com/v2/organizations/snix/pipelines/snix/builds?${encodeParams(params)}`; - const resp = await fetch(url, { - headers: { - Authorization: `Bearer ${BUILDKITE_TOKEN}`, - }, - }); + const url = `https://cl.snix.dev/buildkite-status/${encodeURIComponent(patchsetSha)}`; + const resp = await fetch(url, { }); const respJSON = await resp.json(); const runs = []; diff --git a/ops/modules/monorepo-gerrit.nix b/ops/modules/monorepo-gerrit.nix index 4f98436c3..0ef56dc47 100644 --- a/ops/modules/monorepo-gerrit.nix +++ b/ops/modules/monorepo-gerrit.nix @@ -34,7 +34,9 @@ in plugins = with gerritPlugins; [ code-owners oauth - # depot.ops.gerrit-tvl # #118 + (depot.ops.gerrit-tvl { + gerrit = gerritPackage; + }) ]; package = gerritPackage;