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 (11)
......@@ -31,8 +31,17 @@ bootstrap:
- bazelisk run --stamp --embed_label="${CI_COMMIT_SHA}" -- //bazelisk/push:tagged
artifacts: {}
version:
.job:
extends: .bazelisk
cache:
- !reference [.bazelisk, cache]
- key: "bazel-cache-${CI_PROJECT_ID}"
paths:
- ".cache/bazel/disk"
- ".cache/bazel/repo"
version:
extends: .job
needs:
- bootstrap
script:
......@@ -40,13 +49,13 @@ version:
artifacts: {}
test:
extends: .bazelisk
extends: .job
needs:
- bootstrap
deploy:
stage: deploy
extends: .bazelisk
extends: .job
needs:
- test
script:
......@@ -57,13 +66,13 @@ deploy:
# TODO: switch this out for `rules_semantic_release`
semantic-release:
extends: .bazelisk
extends: .job
stage: .post
needs:
- deploy
image: node:lts
cache:
- !reference [.bazelisk, cache]
- !reference [.job, cache]
- key:
prefix: "node"
files:
......
......@@ -20,11 +20,36 @@ plugins:
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- filepath: "templates/ruleset/.job.yml"
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- filepath: "templates/ruleset/version.yml"
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- filepath: "templates/ruleset/config.yml"
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- filepath: "templates/ruleset/template.yml"
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- filepath: "templates/ruleset/semantic-release.yml"
frontMatter: "process"
expression: |-
.spec.inputs.tag.default = "${nextRelease.version}"
- path: "@semantic-release/git"
assets:
- "MODULE.bazel"
- "CHANGELOG.md"
- "templates/bazelisk.yml"
- "templates/ruleset/.job.yml"
- "templates/ruleset/version.yml"
- "templates/ruleset/config.yml"
- "templates/ruleset/template.yml"
- "templates/ruleset/semantic-release.yml"
- path: "@semantic-release/bzlmod"
source:
prefix: "${CI_PROJECT_NAME}-v${version}"
......
# [1.0.0-beta.6](https://git.gitlab.arm.com/ci/component/bazelisk/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2024-12-04)
### Bug Fixes
- **bazelisk:** only warn when a variable is in run command ([cd63ce1](https://git.gitlab.arm.com/ci/component/bazelisk/commit/cd63ce1bb9d307c9b96578f0aca8373892ed6b41))
- gracefully warn on missing run commands environment variables ([0697d69](https://git.gitlab.arm.com/ci/component/bazelisk/commit/0697d69eb177a0896398ed5f81413d6da66c960d))
- **ruleset:** make the `semantic-release` job depende on `config`/`version` jobs ([d553cba](https://git.gitlab.arm.com/ci/component/bazelisk/commit/d553cba6a81bf56b8dac68a1b8d7266d56ce9451))
- use ROOT as base directory for test logs ([b4128d4](https://git.gitlab.arm.com/ci/component/bazelisk/commit/b4128d4092b22aa35939c8a0ef151a02696724dc))
### Features
- add `ruleset` template ([3619cd4](https://git.gitlab.arm.com/ci/component/bazelisk/commit/3619cd47eb1ae7cd5beb191a50b2baad996cc83f))
# [1.0.0-beta.5](https://git.gitlab.arm.com/ci/component/bazelisk/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2024-10-10)
### Bug Fixes
......
module(
name = "bazelisk",
version = "1.0.0-beta.5",
version = "1.0.0-beta.6",
bazel_compatibility = [
">=7.0.0",
],
......
......@@ -2,28 +2,39 @@ spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.5
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
stage:
default: test
description: "`.bazelisk` job stage."
src:
default: .bazelrc.ci
description: "Bazel run commands to perform variable replacement on."
dst:
default: .bazelrc.user
description: "Destination file for the Bazel run commands variable replacement."
bazelisk:
default: bazelisk
description: "The `bazelisk` CLI location."
command:
default: test
description: "The `bazelisk` CLI command."
target:
default: //...
description: "The `bazelisk` CLI target."
root:
default: .
description: "The root directory of the Bazel module."
key:
default: "bazelisk-1"
description: "The GitLab CI cache key."
variables:
default: |
CI_PROJECT_DIR
CI_PROJECT_ID
description: "Variables to perform environment variable replacement in the Bazel run commands."
---
.bazelisk-fragment:
rc:
......@@ -33,6 +44,12 @@ spec:
VARIABLES="${VARIABLES-$[[inputs.variables]]}"
while IFS= read -r LINE; do
for VARIABLE in ${VARIABLES}; do
if test -z ${!VARIABLE+x}; then
if test "${LINE/\$\{${VARIABLE}\}/}" != "${LINE}"; then
printf >&2 '\e[1;33mWarning:\e[0m `\e[1;35m%s\e[0m` is not available in the environment for run commands replacement: \e[1;35m%s\e[0m\n' "${VARIABLE}" "${LINE}"
fi
continue
fi
LINE="${LINE//\$\{${VARIABLE}\}/${!VARIABLE}}"
done
printf '%s\n' "${LINE}" >> "${ROOT}/$[[inputs.dst]]"
......@@ -45,7 +62,7 @@ spec:
set -euo pipefail
shopt -s extglob globstar nullglob
for SRC in "${ROOT}/bazel-testlogs/"**"/test."@(xml|log); do
DST="${DST}/bazel-testlogs~/${SRC#bazel-testlogs}"
DST="${ROOT}/bazel-testlogs~/${SRC#bazel-testlogs}"
mkdir -p "${DST%/*}"
cp "${SRC}" "${DST}"
done
......
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
config:
default: local
description: "The default `--config` to use for the `.job` template."
regex: ^\w+$
lockfile:
default: error
description: "The value for `CI_LOCKFILE_MODE` environment variable."
options:
- off
- refresh
- update
- error
---
include:
- local: "/templates/bazelisk.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
variables: |
CI_PROJECT_DIR
CI_PROJECT_ID
CI_REMOTE_EXECUTOR
CI_REMOTE_CACHE
CI_REMOTE_HEADER
CI_REMOTE_JOBS
CI_BES_RESULTS_URL
CI_BES_BACKEND
CI_PROJECT_URL
CI_COMMIT_REF_NAME
CI_COMMIT_SHA
CI_SERVER_HOST
CI_LOCKFILE_MODE
.job:
extends: .bazelisk
cache:
- !reference [.bazelisk, cache]
- key: "bazel-cache-${CI_PROJECT_ID}"
paths:
- ".cache/bazel/disk"
- ".cache/bazel/repo"
variables:
CI_LOCKFILE_MODE: "$[[inputs.lockfile]]"
CONFIG: "$[[inputs.config]]"
script:
- cd "${ROOT}"; bazelisk test --config="${CONFIG}" //...
# `ruleset`
> An opinionated set of jobs for testing and releasing a Bazel ruleset
## Getting Started
```yaml
include:
- component: "${CI_SERVER_HOST}/ci/component/bazelisk/ruleset@<version>"
```
Select a `<version>` according to [CI component versions].
## Requirements
- There are `local`/`remote` configurations in `.bazelrc.ci`
- The `e2e` directory exists for end-to-end testing of the ruleset
- `semantic-release` is configured for the project
[CI component versions]: https://docs.gitlab.com/ee/ci/components/#component-versions
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
---
include:
- local: "/templates/ruleset/.job.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
config:
extends: .job
parallel:
matrix:
- ROOT:
- .
- e2e
CONFIG:
- local
- remote
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
needs:
type: array
default:
- config
- version
description: "Jobs to run before the `semantic-release` job."
---
include:
- local: "/templates/ruleset/.job.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
# TODO: switch this out for `rules_semantic_release`
semantic-release:
extends: .job
stage: .post
image: node:lts
needs: $[[inputs.needs]]
cache:
- key:
prefix: "node"
files:
- package-lock.json
paths:
- node_modules
- .cache/npm
- !reference [.job, cache]
before_script:
- npm config --location project set cache "${CI_PROJECT_DIR}/.cache/npm"
- npm ci --prefer-offline
script:
- !reference [.bazelisk-fragment, rc]
- npx semantic-release
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_REF_PROTECTED == "true"
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
minimum:
default: 7.4.0
description: "The minimum Bazel version tested."
regex: ^\d+\.\d+\.\d+$
needs:
type: array
default:
- config
- version
description: "Jobs to run before the `semantic-release` job."
---
include:
- local: "/templates/ruleset/version.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
minimum: "$[[inputs.minimum]]"
- local: "/templates/ruleset/config.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
- local: "/templates/ruleset/semantic-release.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
needs: $[[inputs.needs]]
spec:
inputs:
image:
default: registry.gitlab.arm.com/ci/component/bazelisk
description: "Open container image (OCI) to use."
tag:
default: 1.0.0-beta.6
description: "Open container image (OCI) tag for the image."
minimum:
default: 7.4.0
description: "The minimum Bazel version tested."
regex: ^\d+\.\d+\.\d+$
---
include:
- local: "/templates/ruleset/.job.yml"
inputs:
image: "$[[inputs.image]]"
tag: "$[[inputs.tag]]"
version:
extends: .job
variables:
CI_LOCKFILE_MODE: "off"
parallel:
matrix:
- ROOT:
- .
- e2e
USE_BAZEL_VERSION:
- "$[[inputs.minimum]]"
- 7.x
- last_rc