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
  • semantic-release/bazelisk
1 result
Show changes
Commits on Source (4)
## [1.0.1](https://git.gitlab.arm.com/semantic-release/bazelisk/compare/v1.0.0...v1.0.1) (2024-04-04)
### Bug Fixes
- default to unlimited timeout
([fa97a24](https://git.gitlab.arm.com/semantic-release/bazelisk/commit/fa97a243080c60009caa3e34c028236ef6b61943))
# 1.0.0 (2024-03-21)
### Features
......
......@@ -69,27 +69,28 @@ plugins:
Can be a string as a convenience for a single element array.
Otherwise, an array of arguments to use for the command portion
Otherwise, an array of arguments to use for the command portion of
`bazelisk <command> -- <arguments>`.
Defaults to `run`.
The command can consume [lodash template] that accept [substitutions].
The command can consume [substitutions] in a [lodash template].
## `stages[*].arguments`
Can be a string as a convenience for a single element array.
Otherwise, an array of arguments to use for the arguments portion
Otherwise, an array of arguments to use for the arguments portion of
`bazelisk <command> -- <arguments>`.
Defaults to `//release:<stage-name>`.
The arguments can consume [lodash template] that accept [substitutions].
The arguments can consume [substitutions] in a [lodash template].
# `stages[*].query`
Determines if `bazelisk query -- <target>` is ran to detect if the targe exists.
Determines if `bazelisk query -- <target>` is ran to detect if the target
exists. If the target is not available, the stage does nothing.
The default is `true`.
......@@ -100,10 +101,10 @@ exist.
Sets the timeout for `bazelisk` executions.
Can be anything that [ms] understands (such as `"60s"`, `"1m"`) or the number of
milliseconds.
Can be anything that [ms] understands (such as `"60s"`, `"1m"`), the number of
milliseconds, `"infinity"` or `"∞"`.
Defaults to 60 seconds.
Defaults to an unlimited timeout.
[bazelisk]: https://github.com/bazelbuild/bazelisk
[lodash template]: https://docs-lodash.com/v4/template/
......
{
"name": "@semantic-release/bazelisk",
"version": "1.0.0",
"version": "1.0.1",
"description": "A `semantic release` plugin for `bazelisk`",
"exports": {
"import": "./plugin.mjs",
......
......@@ -39,11 +39,24 @@ export default class Stage {
);
}
const {arguments: args, command, timeout = '60s', query = true} = value;
const {arguments: args, command, timeout = '', query = true} = value;
this.#arguments = new Arguments(args);
this.#command = new Command(command);
this.#timeout = typeof timeout === 'number' ? timeout : ms(timeout);
this.#query = query;
if (typeof timeout === 'number') {
this.#timeout = timeout;
} else if (['infinity', ''].includes(timeout)) {
this.#timeout = undefined;
} else if (typeof timeout === 'string') {
this.#timeout = ms(timeout);
} else {
throw new SemanticReleaseError(
'A `stages[*].timeout` is invalid.',
'EBAZELISKCFG',
`${timeout} (${typeof timeout})`,
);
}
}
get name() {
......
......@@ -111,6 +111,17 @@ test('Throws `EBAZELISKCFG` error when a `stage` value must be an object', failu
};
});
test('Throws `EBAZELISKCFG` error when `stages\\[\\*\\].timeout` is invalid', failure, async t => {
t.context.cfg = {
stages: {
prepare: {
arguments: '//release:prepare',
timeout: {},
},
},
};
});
test('Throws `EBAZELISKCFG` error when `stages\\[\\*\\].arguments\\[\\*\\]` must be a string', failure, async t => {
t.context.cfg = {
stages: {
......@@ -189,13 +200,27 @@ test('Successful operation with `prepare` build', success, async t => {
stages: {
prepare: {
command: 'build',
timeout: 120 * 1000,
arguments: '//release:prepare',
},
},
};
});
for (const timeout of [120_000, '1m', 'infinity', '']) {
test(`Successful operation with \`${timeout}\` timeout`, success, async t => {
t.context.stages = ['verify', 'publish', 'notify'];
t.context.cfg = {
stages: {
prepare: {
command: 'build',
timeout,
arguments: '//release:prepare',
},
},
};
});
}
test('Successful operation without `prepare` target array', success, async t => {
t.context.stages = ['verify', 'publish', 'notify'];
t.context.cfg = {
......