Skip to content

Commit

Permalink
Changes [build image]
Browse files Browse the repository at this point in the history
  • Loading branch information
Electroid committed Nov 14, 2024
1 parent 78a6e90 commit a2774cb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .buildkite/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { writeFileSync } from "node:fs";
import { join } from "node:path";
import {
getBootstrapVersion,
getBuildNumber,
getCanaryRevision,
getChangedFiles,
Expand Down Expand Up @@ -229,6 +230,8 @@ function getPipeline(options) {
let image = `${os}-${arch}-${distro}-${release}`;
if (buildImages) {
image += `-build-${getBuildNumber()}`;
} else {
image += `-v${getBootstrapVersion()}`;
}
return {
robobun: true,
Expand Down Expand Up @@ -462,6 +465,44 @@ function getPipeline(options) {
};
};

/**
* Input
*/

/**
* @typedef SelectField
* @property {string} key
* @property {{label: string, value: string}[]} options
* @property {string} [default]
* @property {string} [hint]
* @property {boolean} [required]
* @property {boolean} [multiple]
*/

/**
* @typedef Input
* @property {string} key
* @property {string} prompt
* @property {string[]} [depends_on]
* @property {SelectField[]} fields
*/

/**
* @param {Platform[]} platforms
* @returns {Input}
*/
const getPublishImageInput = platforms => {
return {
key: "publish-image",
prompt: "Should the build images be published?",
multiple: true,
fields: platforms.map(platform => ({
label: getPlatformLabel(platform),
value: getPlatformKey(platform),
})),
};
};

/**
* Config
*/
Expand Down
1 change: 1 addition & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ install_build_essentials() {
apk)
install_packages \
build-base \
linux-headers \
ninja \
go \
xz
Expand Down
1 change: 0 additions & 1 deletion scripts/machine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
getBuildNumber,
getSecret,
isCI,
isMacOS,
readFile,
spawn,
spawnSafe,
Expand Down
16 changes: 16 additions & 0 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,22 @@ export function getBuildLabel() {
}
}

/**
* @returns {number}
*/
export function getBootstrapVersion() {
if (isWindows) {
return 0; // TODO
}
const scriptPath = join(import.meta.dirname, "bootstrap.sh");
const scriptContent = readFile(scriptPath, { cache: true });
const match = /# Version: (\d+)/.exec(scriptContent);
if (match) {
return parseInt(match[1]);
}
return 0;
}

/**
* @typedef {object} BuildArtifact
* @property {string} [job]
Expand Down

0 comments on commit a2774cb

Please sign in to comment.