Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ci/component/bazelisk
1 result
Show changes
Commits on Source (13)
last_rc
# TODO: relax this once we have `use_rule_repo`
7.0.0rc3
# TODO: this is broken in 7.0.0rc4 and 7.0.0, see https://github.com/bazel-contrib/rules_oci/issues/425
include:
- component: "${CI_SERVER_HOST}/${CI_PROJECT_PATH}@${CI_COMMIT_SHA}"
- component: "${CI_SERVER_HOST}/${CI_PROJECT_PATH}/bazelisk@${CI_COMMIT_SHA}"
inputs:
tag: "${CI_COMMIT_SHA}"
......
......@@ -7,67 +7,79 @@ import debug from "debug";
debug("semantic-release:tag");
const FILEPATH = "template.yml";
const FILEPATHS = Object.freeze(["templates/bazelisk.yml", "bazelisk/template.yml"]);
const REGEX = /(tag:\n\s+default: )(\S+)/m;
export async function verifyConditions(pluginConfig, context) {
const { filepath = FILEPATH, regex = REGEX } = pluginConfig;
const { filepaths = FILEPATHS, regex = REGEX } = pluginConfig;
const { cwd, logger } = context;
if (typeof filepath !== "string") {
if (!Array.isArray(filepaths)) {
throw new SemanticReleaseError(
"`filepath` must be a string",
"`filepaths` must be an array",
"ETAGCFG",
`\`${filepath}\` (\`${typeof filepath}\`)`,
`\`${filepaths}\` (\`${typeof filepaths}\`)`,
);
}
const template = path.join(cwd, filepath);
for (const filepath of filepaths) {
if (typeof filepath !== "string") {
throw new SemanticReleaseError(
"`filepath` must be a string",
"ETAGCFG",
`\`${filepath}\` (\`${typeof filepath}\`)`,
);
}
const template = path.join(cwd, filepath);
const data = await (async () => {
try {
debug("Reading `%s`", template);
return await readFile(template, { encoding: "utf8" });
} catch (error) {
throw new SemanticReleaseError(`Failed to read \`${template}\``, "ETAGREAD", `${error}`);
}
})();
debug("Finding `%s` in `%s`", regex, template);
if (!regex.test(data)) {
throw new SemanticReleaseError(`\`${template}\` \`${regex}\` does not exist`, "ETAGREGEX");
}
const data = await (async () => {
try {
debug("Reading `%s`", template);
return await readFile(template, { encoding: "utf8" });
debug("Writing `%s`", template);
await writeFile(template, data);
} catch (error) {
throw new SemanticReleaseError(`Failed to read \`${template}\``, "ETAGREAD", `${error}`);
throw new SemanticReleaseError(`Failed to write \`${template}\``, "ETAGWRITE", `${error}`);
}
})();
debug("Finding `%s` in `%s`", regex, template);
if (!regex.test(data)) {
throw new SemanticReleaseError(`\`${template}\` \`${regex}\` does not exist`, "ETAGREGEX");
logger.success("Validated `%s`", template);
}
try {
debug("Writing `%s`", template);
await writeFile(template, data);
} catch (error) {
throw new SemanticReleaseError(`Failed to write \`${template}\``, "ETAGWRITE", `${error}`);
}
logger.success("Validated `%s`", template);
}
export async function prepare(pluginConfig, context) {
const { filepath = FILEPATH, regex = REGEX } = pluginConfig;
const { filepaths = FILEPATHS, regex = REGEX } = pluginConfig;
const {
cwd,
logger,
nextRelease: { version },
} = context;
const template = path.join(cwd, filepath);
for (const filepath of filepaths) {
const template = path.join(cwd, filepath);
debug("Reading `%s`", template);
const data = await readFile(template, { encoding: "utf8" });
debug("Reading `%s`", template);
const data = await readFile(template, { encoding: "utf8" });
debug("Setting `%s` in `%s`", regex, template);
const updated = data.replace(REGEX, (_, prefix, current) => {
logger.log("Replacing `%s` with `%s`", current, version);
return `${prefix}${version}`;
});
debug("Setting `%s` in `%s`", regex, template);
const updated = data.replace(REGEX, (_, prefix, current) => {
logger.log("Replacing `%s` with `%s`", current, version);
return `${prefix}${version}`;
});
debug("Writing `%s`", template);
await writeFile(template, updated);
logger.success("Wrote `%s`", template);
debug("Writing `%s`", template);
await writeFile(template, updated);
logger.success("Wrote `%s`", template);
}
}
......@@ -19,7 +19,8 @@ plugins:
assets:
- "MODULE.bazel"
- "CHANGELOG.md"
- "template.yml"
- "templates/bazelisk.yml"
- "bazelisk/template.yml"
- path: "@semantic-release/bzlmod"
source:
prefix: "${CI_PROJECT_NAME}-v${version}"
......
# [1.0.0-beta.2](https://git.gitlab.arm.com/ci/component/bazelisk/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2024-01-04)
### Bug Fixes
- add stage to `.bazelisk` job ([8282d71](https://git.gitlab.arm.com/ci/component/bazelisk/commit/8282d7129fad6a36d28f1c7dc78364161a109562))
- commit to new component directory structure ([c5ced29](https://git.gitlab.arm.com/ci/component/bazelisk/commit/c5ced293dbed2c4371f544c529130a1b14c86f1d))
- pin bazel version ([f992954](https://git.gitlab.arm.com/ci/component/bazelisk/commit/f992954e8ad96bab04d5b61736389b2956cbb859))
- **release:** correct JavaScript `Object.freeze` usage ([38465a1](https://git.gitlab.arm.com/ci/component/bazelisk/commit/38465a17485a0f1d0bd16c8c8e372d60a556b15e))
### BREAKING CHANGES
- The component must be included via the `bazelisk` name.
The nameless include in `1.0.0-beta.1` is no longer supported.
```
include:
- component: "${CI_SERVER_HOST}/ci/component/bazelisk@1.0.0-beta.1"
```
Add the `/bazelisk` named CI component:
```
include:
- component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@1.0.0-beta.2"
```
This is due to GitLab CI components being stabilised and the nameless component
support being removed.
# 1.0.0-beta.1 (2023-12-20)
### Bug Fixes
......
module(
name = "bazelisk",
version = "1.0.0-beta.1",
version = "1.0.0-beta.2",
bazel_compatibility = [
">=6.4.0",
],
)
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.0.0-rc1")
bazel_dep(name = "aspect_bazel_lib", version = "2.1.0")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_oci", version = "1.4.3")
bazel_dep(name = "rules_oci", version = "1.5.1")
bazel_dep(name = "rules_pkg", version = "0.9.1")
bazel_dep(name = "container_structure_test", version = "1.16.0")
bazel_dep(name = "rules_download", version = "1.0.0-alpha.2")
......
This diff is collapsed.
......@@ -8,7 +8,7 @@ Add the CI component to the `.gitlab-ci.yml`:
```yaml
include:
- component: gitlab.arm.com/ci/component/bazelisk@<version>
- component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@<version>"
```
Add a job that extends the `.bazelisk` template to recursively test the project:
......
# TODO: delete this file once `gitlab.arm.com` is upgraded to 16.5+
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
tag:
default: 1.0.0-beta.2
stage:
default: test
src:
default: .bazelrc.ci
dst:
default: .bazelrc.user
bazelisk:
default: bazelisk
command:
default: test
target:
default: //...
root:
default: .
key:
default: "bazelisk-1"
variables:
default: |
CI_PROJECT_DIR
CI_PROJECT_ID
---
include:
- local: "/templates/bazelisk.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
stage: "$[[inputs.stage]]"
src: "$[[inputs.src]]"
dst: "$[[inputs.dst]]"
bazelisk: "$[[inputs.bazelisk]]"
command: "$[[inputs.command]]"
target: "$[[inputs.target]]"
root: "$[[inputs.root]]"
key: "$[[inputs.key]]"
variables: "$[[inputs.variables]]"
# TODO: anything added here must also be added in `bazelisk/template.yml` until `gitlab.arm.com` upgrades to 16.5+
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
tag:
default: 1.0.0-beta.1
default: 1.0.0-beta.2
stage:
default: test
src:
......@@ -64,6 +65,7 @@ spec:
.bazelisk:
image: "$[[inputs.image]]:$[[inputs.tag]]"
needs: []
stage: "$[[inputs.stage]]"
variables:
ROOT: "$[[inputs.root]]"
BAZELISK_HOME: "${CI_PROJECT_DIR}/.cache/bazelisk"
......