Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions scripts/fetch-pin-state.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* fetch-pin-state.js
*
* Reads bluefin-lts HWE workflow YAML files from the GitHub Contents API
* and extracts any `kernel-pin` (or future `*-pin`) workflow inputs.
* Reads the active bluefin-lts build workflow YAML from the GitHub Contents
* API and extracts any `kernel_pin` (or future `*_pin`) input passed to the
* shared projectbluefin/actions reusable-build.yml workflow.
* Writes static/data/stream-pins.json consumed by the docs UI to render
* 📌 "Pinned" badges next to intentionally-held component versions.
*
Expand All @@ -17,12 +18,10 @@ const OUTPUT_FILE = path.join(__dirname, "..", "static", "data", "stream-pins.js
const WORKFLOWS_TO_CHECK = [
{
repo: "projectbluefin/bluefin-lts",
path: ".github/workflows/build-regular-hwe.yml",
stream: "bluefin-lts",
},
{
repo: "projectbluefin/bluefin-lts",
path: ".github/workflows/build-dx-hwe.yml",
// bluefin-lts is HWE-only (no separate build-regular-hwe.yml/build-dx-hwe.yml
// since #437); build-regular.yml is the active workflow and passes an optional
// `kernel_pin` input to the shared reusable-build.yml when a kernel is pinned.
path: ".github/workflows/build-regular.yml",
stream: "bluefin-lts",
},
];
Expand All @@ -47,11 +46,11 @@ async function fetchWorkflowContent(repo, filePath) {
}

/**
* Extract `kernel-pin` value from a workflow YAML string.
* Matches the pattern: kernel-pin: <version>
* Extract `kernel_pin` value from a workflow YAML string.
* Matches the pattern: kernel_pin: <version>
*/
function extractKernelPin(yamlContent) {
const match = yamlContent.match(/kernel-pin:\s*([^\s\n#]+)/);
const match = yamlContent.match(/kernel_pin:\s*([^\s\n#]+)/);
return match ? match[1].trim() : null;
}

Expand Down Expand Up @@ -89,7 +88,7 @@ async function main() {
if (kernelPin) {
console.log(` ${stream} hweKernel pin: ${kernelPin}`);
} else {
console.log(` ${stream}: no kernel-pin found (floating)`);
console.log(` ${stream}: no kernel_pin found (floating)`);
}
} catch (err) {
console.warn(` Warning: could not fetch ${repo}/${filePath}: ${err.message}`);
Expand Down
10 changes: 5 additions & 5 deletions scripts/fetch-pin-state.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ const {
extractKernelPin,
} = require("./fetch-pin-state.js");

test("extractKernelPin reads kernel-pin values and ignores missing pins", () => {
assert.equal(extractKernelPin("kernel-pin: 6.12.30-204 # comment"), "6.12.30-204");
assert.equal(extractKernelPin("name: build-regular-hwe"), null);
test("extractKernelPin reads kernel_pin values and ignores missing pins", () => {
assert.equal(extractKernelPin("kernel_pin: 6.12.30-204 # comment"), "6.12.30-204");
assert.equal(extractKernelPin("name: build-regular"), null);
});

test("applyKernelPin stores a stream pin and rejects conflicting values", () => {
const streamPins = {};

applyKernelPin(streamPins, "bluefin-lts", "6.12.30-204", "build-regular-hwe.yml");
applyKernelPin(streamPins, "bluefin-lts", "6.12.30-204", "build-regular.yml");
assert.deepEqual(streamPins, {
"bluefin-lts": { hweKernel: "6.12.30-204" },
});

assert.throws(
() => applyKernelPin(streamPins, "bluefin-lts", "6.12.31-204", "build-dx-hwe.yml"),
() => applyKernelPin(streamPins, "bluefin-lts", "6.12.31-204", "build-regular.yml"),
/Conflicting hweKernel pins/,
);
});
3 changes: 2 additions & 1 deletion static/data/stream-pins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"generatedAt": "2026-07-21T05:48:34.788Z",
"generatedAt": "2026-09-08T15:03:46.365Z",
"streams": {
"bluefin-lts": {},
"bluefin-stable": {}
}
}