From fa62c1e3043aff5d1b01e34ca17624d487cebfb7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 14:18:17 +0200 Subject: [PATCH 01/12] Add buildbarn test --- .github/buildbarn/.bazelrc.template | 7 ++ .github/buildbarn/cleanup.sh | 18 +++ .github/buildbarn/config/common.libsonnet | 42 +++++++ .github/buildbarn/config/frontend.jsonnet | 36 ++++++ .../config/runner-ubuntu22-04.jsonnet | 10 ++ .github/buildbarn/config/scheduler.jsonnet | 42 +++++++ .github/buildbarn/config/storage.jsonnet | 75 ++++++++++++ .../config/worker-fuse-ubuntu22-04.jsonnet | 103 ++++++++++++++++ .github/buildbarn/docker-compose.yml | 113 ++++++++++++++++++ .github/buildbarn/runner-img/Dockerfile | 40 +++++++ .github/buildbarn/setup.sh | 24 ++++ .github/workflows/buildbarn.yaml | 67 +++++++++++ .gitignore | 2 + 13 files changed, 579 insertions(+) create mode 100644 .github/buildbarn/.bazelrc.template create mode 100755 .github/buildbarn/cleanup.sh create mode 100644 .github/buildbarn/config/common.libsonnet create mode 100644 .github/buildbarn/config/frontend.jsonnet create mode 100644 .github/buildbarn/config/runner-ubuntu22-04.jsonnet create mode 100644 .github/buildbarn/config/scheduler.jsonnet create mode 100644 .github/buildbarn/config/storage.jsonnet create mode 100644 .github/buildbarn/config/worker-fuse-ubuntu22-04.jsonnet create mode 100644 .github/buildbarn/docker-compose.yml create mode 100644 .github/buildbarn/runner-img/Dockerfile create mode 100755 .github/buildbarn/setup.sh create mode 100644 .github/workflows/buildbarn.yaml diff --git a/.github/buildbarn/.bazelrc.template b/.github/buildbarn/.bazelrc.template new file mode 100644 index 00000000..9b4f15c0 --- /dev/null +++ b/.github/buildbarn/.bazelrc.template @@ -0,0 +1,7 @@ +build --remote_executor=grpc://localhost:8980 +build --remote_timeout=3600 +build --spawn_strategy=remote,local +build --strategy=CppCompile=remote +build --remote_instance_name=fuse +build --remote_default_exec_properties=OSFamily=linux +build --remote_default_exec_properties=container-image=docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448 diff --git a/.github/buildbarn/cleanup.sh b/.github/buildbarn/cleanup.sh new file mode 100755 index 00000000..89ca7d02 --- /dev/null +++ b/.github/buildbarn/cleanup.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -eu + +worker_fuse="worker-fuse-ubuntu22-04" +worker_hardlinking="worker-hardlinking-ubuntu22-04" +fuse_dir_to_unmount="volumes/${worker_fuse}/build" +sudo -v + +cleanup() { + EXIT_STATUS=$? + local - + set -x + + sudo fusermount -u "$fuse_dir_to_unmount" || true + exit "$EXIT_STATUS" +} + +cleanup diff --git a/.github/buildbarn/config/common.libsonnet b/.github/buildbarn/config/common.libsonnet new file mode 100644 index 00000000..7f1efd5e --- /dev/null +++ b/.github/buildbarn/config/common.libsonnet @@ -0,0 +1,42 @@ +{ + blobstore: { + contentAddressableStorage: { + sharding: { + shards: { + "0": { + backend: { grpc: { address: 'storage-0:8981' } }, + weight: 1, + }, + }, + }, + }, + actionCache: { + completenessChecking: { + backend: { + sharding: { + shards: { + "0": { + backend: { grpc: { address: 'storage-0:8981' } }, + weight: 1, + }, + }, + }, + }, + maximumTotalTreeSizeBytes: 64 * 1024 * 1024, + }, + }, + }, + browserUrl: 'http://localhost:7984', + maximumMessageSizeBytes: 2 * 1024 * 1024, + global: { + diagnosticsHttpServer: { + httpServers: [{ + listenAddresses: [':80'], + authenticationPolicy: { allow: {} }, + }], + enablePrometheus: true, + enablePprof: true, + enableActiveSpans: true, + }, + }, +} diff --git a/.github/buildbarn/config/frontend.jsonnet b/.github/buildbarn/config/frontend.jsonnet new file mode 100644 index 00000000..1ebe0fa1 --- /dev/null +++ b/.github/buildbarn/config/frontend.jsonnet @@ -0,0 +1,36 @@ +local common = import 'common.libsonnet'; + +{ + grpcServers: [{ + listenAddresses: [':8980'], + authenticationPolicy: { allow: {} }, + }], + schedulers: { + '': { + endpoint: { + address: 'scheduler:8982', + addMetadataJmespathExpression: { + expression: ||| + { + "build.bazel.remote.execution.v2.requestmetadata-bin": incomingGRPCMetadata."build.bazel.remote.execution.v2.requestmetadata-bin" + } + |||, + }, + }, + }, + }, + maximumMessageSizeBytes: common.maximumMessageSizeBytes, + global: common.global, + contentAddressableStorage: { + backend: common.blobstore.contentAddressableStorage, + getAuthorizer: { allow: {} }, + putAuthorizer: { allow: {} }, + findMissingAuthorizer: { allow: {} }, + }, + actionCache: { + backend: common.blobstore.actionCache, + getAuthorizer: { allow: {} }, + putAuthorizer: { allow: {} }, + }, + executeAuthorizer: { allow: {} }, +} diff --git a/.github/buildbarn/config/runner-ubuntu22-04.jsonnet b/.github/buildbarn/config/runner-ubuntu22-04.jsonnet new file mode 100644 index 00000000..7f08b6da --- /dev/null +++ b/.github/buildbarn/config/runner-ubuntu22-04.jsonnet @@ -0,0 +1,10 @@ +local common = import 'common.libsonnet'; + +{ + buildDirectoryPath: '/worker/build', + global: common.global, + grpcServers: [{ + listenPaths: ['/worker/runner'], + authenticationPolicy: { allow: {} }, + }], +} diff --git a/.github/buildbarn/config/scheduler.jsonnet b/.github/buildbarn/config/scheduler.jsonnet new file mode 100644 index 00000000..895ea908 --- /dev/null +++ b/.github/buildbarn/config/scheduler.jsonnet @@ -0,0 +1,42 @@ +local common = import 'common.libsonnet'; + +{ + adminHttpServers: [{ + listenAddresses: [':7982'], + authenticationPolicy: { allow: {} }, + }], + clientGrpcServers: [{ + listenAddresses: [':8982'], + authenticationPolicy: { allow: {} }, + }], + workerGrpcServers: [{ + listenAddresses: [':8983'], + authenticationPolicy: { allow: {} }, + }], + buildQueueStateGrpcServers: [{ + listenAddresses: [':8984'], + authenticationPolicy: { allow: {} }, + }], + browserUrl: common.browserUrl, + contentAddressableStorage: common.blobstore.contentAddressableStorage, + maximumMessageSizeBytes: common.maximumMessageSizeBytes, + global: common.global, + executeAuthorizer: { allow: {} }, + modifyDrainsAuthorizer: { allow: {} }, + killOperationsAuthorizer: { allow: {} }, + synchronizeAuthorizer: { allow: {} }, + actionRouter: { + simple: { + platformKeyExtractor: { action: {} }, + invocationKeyExtractors: [ + { correlatedInvocationsId: {} }, + { toolInvocationId: {} }, + ], + initialSizeClassAnalyzer: { + defaultExecutionTimeout: '1800s', + maximumExecutionTimeout: '7200s', + }, + }, + }, + platformQueueWithNoWorkersTimeout: '900s', +} diff --git a/.github/buildbarn/config/storage.jsonnet b/.github/buildbarn/config/storage.jsonnet new file mode 100644 index 00000000..30c8040c --- /dev/null +++ b/.github/buildbarn/config/storage.jsonnet @@ -0,0 +1,75 @@ +local common = import 'common.libsonnet'; + +{ + grpcServers: [{ + listenAddresses: [':8981'], + authenticationPolicy: { allow: {} }, + }], + maximumMessageSizeBytes: common.maximumMessageSizeBytes, + global: common.global, + contentAddressableStorage: { + backend: { + 'local': { + keyLocationMapOnBlockDevice: { + file: { + path: '/storage-cas/key_location_map', + sizeBytes: 400 * 1024 * 1024, + }, + }, + keyLocationMapMaximumGetAttempts: 16, + keyLocationMapMaximumPutAttempts: 64, + oldBlocks: 8, + currentBlocks: 24, + newBlocks: 3, + blocksOnBlockDevice: { + source: { + file: { + path: '/storage-cas/blocks', + sizeBytes: 32 * 1024 * 1024 * 1024, + }, + }, + spareBlocks: 3, + }, + persistent: { + stateDirectoryPath: '/storage-cas/persistent_state', + minimumEpochInterval: '300s', + }, + }, + }, + getAuthorizer: { allow: {} }, + putAuthorizer: { allow: {} }, + findMissingAuthorizer: { allow: {} }, + }, + actionCache: { + backend: { + 'local': { + keyLocationMapOnBlockDevice: { + file: { + path: '/storage-ac/key_location_map', + sizeBytes: 1024 * 1024, + }, + }, + keyLocationMapMaximumGetAttempts: 16, + keyLocationMapMaximumPutAttempts: 64, + oldBlocks: 8, + currentBlocks: 24, + newBlocks: 1, + blocksOnBlockDevice: { + source: { + file: { + path: '/storage-ac/blocks', + sizeBytes: 20 * 1024 * 1024, + }, + }, + spareBlocks: 3, + }, + persistent: { + stateDirectoryPath: '/storage-ac/persistent_state', + minimumEpochInterval: '300s', + }, + }, + }, + getAuthorizer: { allow: {} }, + putAuthorizer: { allow: {} }, + }, +} diff --git a/.github/buildbarn/config/worker-fuse-ubuntu22-04.jsonnet b/.github/buildbarn/config/worker-fuse-ubuntu22-04.jsonnet new file mode 100644 index 00000000..be468532 --- /dev/null +++ b/.github/buildbarn/config/worker-fuse-ubuntu22-04.jsonnet @@ -0,0 +1,103 @@ +local common = import 'common.libsonnet'; + +// The FUSE worker is the most efficient configuration. +// This is preferred to the hardlinking configuration. +{ + blobstore: { + actionCache: common.blobstore.actionCache, + contentAddressableStorage: { + readCaching: { + slow: common.blobstore.contentAddressableStorage, + fast: { + 'local': { + keyLocationMapOnBlockDevice: { + file: { + path: '/worker/cas/key_location_map', + sizeBytes: 400 * 1024 * 1024, + }, + }, + keyLocationMapMaximumGetAttempts: 16, + keyLocationMapMaximumPutAttempts: 64, + oldBlocks: 8, + currentBlocks: 24, + newBlocks: 3, + blocksOnBlockDevice: { + source: { + file: { + path: '/worker/cas/blocks', + sizeBytes: 32 * 1024 * 1024 * 1024, + }, + }, + spareBlocks: 3, + dataIntegrityValidationCache: { + cacheSize: 50000, + cacheDuration: '14400s', + cacheReplacementPolicy: 'LEAST_RECENTLY_USED', + }, + }, + persistent: { + stateDirectoryPath: '/worker/cas/persistent_state', + minimumEpochInterval: '300s', + }, + }, + }, + replicator: { deduplicating: { 'local': {} } }, + }, + }, + }, + browserUrl: common.browserUrl, + maximumMessageSizeBytes: common.maximumMessageSizeBytes, + scheduler: { address: 'scheduler:8983' }, + global: common.global, + buildDirectories: [{ + virtual: { + maximumExecutionTimeoutCompensation: '3600s', + shuffleDirectoryListings: true, + maximumWritableFileUploadDelay: '60s', + mount: { + mountPath: '/worker/build', + fuse: { + directoryEntryValidity: '300s', + inodeAttributeValidity: '300s', + allowOther: true, + mountMethod: 'DIRECT', + }, + }, + }, + runners: [{ + endpoint: { address: 'unix:///worker/runner' }, + concurrency: 8, + instanceNamePrefix: 'fuse', + platform: { + properties: [ + { name: 'OSFamily', value: 'linux' }, + { name: 'container-image', value: 'docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448' }, + ], + }, + maximumFilePoolFileCount: 100000, + maximumFilePoolSizeBytes: 1 * 1024 * 1024 * 1024, + workerId: { + datacenter: 'amsterdam', + rack: '3', + slot: '10', + hostname: 'ubuntu-worker.example.com', + }, + }], + }], + filePool: { + blockDevice: { + file: { + path: '/worker/filepool', + // concurrency * maximumFilePoolSizeBytes + sizeBytes: 8 * 1024 * 1024 * 1024, + }, + }, + }, + inputDownloadConcurrency: 10, + outputUploadConcurrency: 11, + directoryCache: { + maximumCount: 1000, + maximumSizeBytes: 1000 * 1024, + cacheReplacementPolicy: 'LEAST_RECENTLY_USED', + }, +} diff --git a/.github/buildbarn/docker-compose.yml b/.github/buildbarn/docker-compose.yml new file mode 100644 index 00000000..f9b5991e --- /dev/null +++ b/.github/buildbarn/docker-compose.yml @@ -0,0 +1,113 @@ +version: '3' +services: + frontend: + image: ghcr.io/buildbarn/bb-storage:20250819T193852Z-fd11d3e + command: + - /config/frontend.jsonnet + expose: + - 9980 + ports: + - 8980:8980 + volumes: + - ./config:/config + + storage-0: + image: ghcr.io/buildbarn/bb-storage:20250819T193852Z-fd11d3e + command: + - /config/storage.jsonnet + expose: + - 8981 + - 9980 + volumes: + - ./config:/config + - ./volumes/storage-ac-0:/storage-ac + - ./volumes/storage-cas-0:/storage-cas + + scheduler: + image: ghcr.io/buildbarn/bb-scheduler:20250820T081613Z-efef252 + command: + - /config/scheduler.jsonnet + expose: + - 8982 + - 8983 + - 8984 + - 9980 + ports: + - 7982:7982 + - 8983:8983 + - 8984:8984 + volumes: + - ./config:/config + + runner-installer: + image: ghcr.io/buildbarn/bb-runner-installer:20250820T081613Z-efef252 + volumes: + - ./volumes/bb:/bb + + # The FUSE worker is the most efficient configuration. + worker-fuse-ubuntu22-04: + image: ghcr.io/buildbarn/bb-worker:20250820T081613Z-efef252 + command: + - /config/worker-fuse-ubuntu22-04.jsonnet + # Need to be privileged for the FUSE mounting to work. + privileged: true + volumes: + - ./config:/config + - type: bind + source: ./volumes/worker-fuse-ubuntu22-04 + target: /worker + bind: + # Bidirectional mount to expose the FUSE mount. + propagation: shared + + runner-fuse-ubuntu22-04: + image: metalg091/bb-codechecker-runner:1.0 + command: + - sh + - -c + - | + while ! test -f /bb/installed; do + sleep 1; + done; + exec /bb/tini -v -- /bb/bb_runner /config/runner-ubuntu22-04.jsonnet + network_mode: none + volumes: + - ./config:/config + - ./volumes/bb:/bb + - type: bind + source: ./volumes/worker-fuse-ubuntu22-04 + target: /worker + bind: + # HostToContainer mount to use the FUSE mount. + propagation: slave + depends_on: + - runner-installer + + # For situations where the more efficient FUSE worker is not supported, + # the classic hardlinking example is shown here. + #worker-hardlinking-ubuntu22-04: + # image: ghcr.io/buildbarn/bb-worker:20250820T081613Z-efef252 + # command: + # - /config/worker-hardlinking-ubuntu22-04.jsonnet + # privileged: false + # volumes: + # - ./config:/config + # - ./volumes/worker-hardlinking-ubuntu22-04:/worker + + #runner-hardlinking-ubuntu22-04: + # image: metalg091/bb-codechecker-runner:1.0 + # command: + # - sh + # - -c + # - | + # while ! test -f /bb/installed; do + # sleep 1; + # done; + # exec /bb/tini -v -- /bb/bb_runner /config/runner-ubuntu22-04.jsonnet + # network_mode: none + # volumes: + # - ./config:/config + # - ./volumes/bb:/bb + # - ./volumes/worker-hardlinking-ubuntu22-04:/worker + # depends_on: + # - runner-installer diff --git a/.github/buildbarn/runner-img/Dockerfile b/.github/buildbarn/runner-img/Dockerfile new file mode 100644 index 00000000..ce7b6712 --- /dev/null +++ b/.github/buildbarn/runner-img/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:22.04 + +# Set noninteractive mode for apt +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install essential tools +RUN apt update && apt install -y \ + build-essential \ + clang \ + clang-tidy \ + clang-tools \ + libc6-dev \ + lld \ + gcc-11 \ + g++-11 \ + cmake \ + python3 \ + python3-pip \ + python3-venv \ + git \ + curl \ + wget \ + unzip && \ + rm -rf /var/lib/apt/lists/* + +# Setup python virtual enviroments +RUN python3 -m venv /venv + +# Set py vevn as always active +ENV VIRTUAL_ENV=/venv +ENV PATH=/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/snap/bin + +# Install CodeChecker and any other dependencies +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install --no-cache-dir codechecker + +RUN ln -s /venv/bin/CodeChecker /usr/bin/CodeChecker + +WORKDIR /worker + diff --git a/.github/buildbarn/setup.sh b/.github/buildbarn/setup.sh new file mode 100755 index 00000000..89ef8676 --- /dev/null +++ b/.github/buildbarn/setup.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -eu + +worker_fuse="worker-fuse-ubuntu22-04" +worker_hardlinking="worker-hardlinking-ubuntu22-04" +fuse_dir_to_unmount="volumes/${worker_fuse}/build" +sudo -v + +setup () { + local - + set -x + + { sudo fusermount -u "$fuse_dir_to_unmount" && sleep 1; } || true + sudo rm -rf volumes/bb "volumes/${worker_fuse}" "volumes/${worker_hardlinking}" + + mkdir -p volumes + mkdir -m 0777 "volumes/${worker_fuse}" "volumes/${worker_fuse}"/{build,cas,cas/persistent_state} + mkdir -m 0777 "volumes/${worker_hardlinking}" "volumes/${worker_hardlinking}"/{build,cas,cas/persistent_state} + mkdir -m 0700 "volumes/${worker_fuse}/cache" "volumes/${worker_hardlinking}/cache" + mkdir -p volumes/storage-{ac,cas}-{0,1}/persistent_state + chmod 0700 volumes/storage-{ac,cas}-{0,1}/{,persistent_state} +} + +setup diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml new file mode 100644 index 00000000..d68365c8 --- /dev/null +++ b/.github/workflows/buildbarn.yaml @@ -0,0 +1,67 @@ +# Copyright 2023 Ericsson AB +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: codechecker-bazel-buildbarn-tests + +# Triggers the workflow on push or pull request events. +on: [push, pull_request] + +permissions: read-all + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + buildbarn_test: + name: Unit tests on BuildBarn + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/platform_environment_setup/ubuntu + + - name: Set up Docker Compose + uses: docker/setup-compose-action@v1 + with: + version: latest + + - name: Setup BuildBarn + working-directory: .github/buildbarn + run: | + ./setup.sh + docker compose up -d + timeout 30 bash -c 'until nc -z localhost 8980; do sleep 1; done' + + - name: Setup remote for Bazel + run: | + cat .github/buildbarn/.bazelrc.template >> .bazelrc + + - name: Run Bazel tests + run: bazel test //... \ + + - name: Run unit tests + run: | + cd test + python3 -m unittest discover unit -vvv + + - name: Stop BuildBarn + if: always() + working-directory: .github/buildbarn + run: | + docker compose down -v + ./cleanup.sh diff --git a/.gitignore b/.gitignore index 8bdb1869..1808085d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ venv # Ignore FOSS project clone dirs /test/foss/*/test-proj/ +# Ignore BuildBarn cache +.github/buildbarn/volumes From 5663f0f188f3e79cc5895166559e6e4d9d409d58 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 15:36:03 +0200 Subject: [PATCH 02/12] Hardcode CodeChecker bin as 'CodeChecker' (must be found in $PATH) --- src/codechecker.bzl | 4 ++-- src/tools.bzl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index 187e04e6..f0d77de9 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -77,7 +77,7 @@ def _copy_config_to_default(config_file, ctx): outputs = [ctx.outputs.codechecker_config], mnemonic = "CopyFile", progress_message = "Copying CodeChecker config file", - executable = "cp", + executable = "/usr/bin/cp", arguments = [ config_file.path, ctx.outputs.codechecker_config.path, @@ -199,7 +199,7 @@ def _codechecker_impl(ctx): arguments = [], mnemonic = "CodeChecker", progress_message = "CodeChecker %s" % str(ctx.label), - # use_default_shell_env = True, + use_default_shell_env = True, ) # List all files required at build and run (test) time diff --git a/src/tools.bzl b/src/tools.bzl index 32ad4207..c9606a84 100644 --- a/src/tools.bzl +++ b/src/tools.bzl @@ -82,7 +82,8 @@ def _codechecker_local_repository_impl(repository_ctx): if not codechecker_bin_path: fail("ERROR! CodeChecker is not detected") - defs = "CODECHECKER_BIN_PATH = '{}'\n".format(codechecker_bin_path) + defs = "CODECHECKER_BIN_PATH = 'CodeChecker'" + repository_ctx.file( repository_ctx.path("defs.bzl"), content = defs, From f397846965848a350a1e9a9afff8327f36b33d2f Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 16:11:42 +0200 Subject: [PATCH 03/12] Fix Docker img --- .github/buildbarn/runner-img/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/buildbarn/runner-img/Dockerfile b/.github/buildbarn/runner-img/Dockerfile index ce7b6712..8d475fdb 100644 --- a/.github/buildbarn/runner-img/Dockerfile +++ b/.github/buildbarn/runner-img/Dockerfile @@ -23,6 +23,13 @@ RUN apt update && apt install -y \ unzip && \ rm -rf /var/lib/apt/lists/* +RUN update-alternatives --install \ + /usr/bin/clang-extdef-mapping \ + clang-extdef-mapping \ + /usr/bin/clang-extdef-mapping-$(clang --version | head -n 1 | \ + sed -E 's/.*version ([0-9]+)\..*/\1/') \ + 100 + # Setup python virtual enviroments RUN python3 -m venv /venv From 474c6650e7cf70c8ce1017de94d4fb456b3a7da7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 16:11:49 +0200 Subject: [PATCH 04/12] Update workflow --- .github/workflows/buildbarn.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml index d68365c8..8528c9b4 100644 --- a/.github/workflows/buildbarn.yaml +++ b/.github/workflows/buildbarn.yaml @@ -51,8 +51,11 @@ jobs: run: | cat .github/buildbarn/.bazelrc.template >> .bazelrc + - name: Run single Bazel tests + run: bazel build //test/unit/legacy:codechecker_pass + - name: Run Bazel tests - run: bazel test //... \ + run: bazel test //... - name: Run unit tests run: | From 7d65bca67125bf0d312a2e6d6ec0e4c7cd0f7169 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 16:18:25 +0200 Subject: [PATCH 05/12] Add distributed test case --- .github/workflows/buildbarn.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml index 8528c9b4..ca093ff9 100644 --- a/.github/workflows/buildbarn.yaml +++ b/.github/workflows/buildbarn.yaml @@ -51,6 +51,9 @@ jobs: run: | cat .github/buildbarn/.bazelrc.template >> .bazelrc + - name: Run single Bazel tests + run: bazel build //test/unit/legacy:code_checker_pass + - name: Run single Bazel tests run: bazel build //test/unit/legacy:codechecker_pass From d9cc1fc4d9639fd2149f0b8043c1017b30daa43a Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 16:22:12 +0200 Subject: [PATCH 06/12] Try env enable --- src/codechecker.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index f0d77de9..832cd5f1 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -115,7 +115,7 @@ def _codechecker_impl(ctx): ], mnemonic = "CodeCheckerConvertFlaccToClang", progress_message = "Filtering %s" % str(ctx.label), - # use_default_shell_env = True, + use_default_shell_env = True, ) # Create CodeChecker skip (ignore) file From 1056a2d0ffae0162bdb3bde022c44254e2aff45b Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 1 Sep 2025 16:25:25 +0200 Subject: [PATCH 07/12] Remove remote host restriction --- src/codechecker.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index 832cd5f1..2fc45cf8 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -254,7 +254,7 @@ codechecker = rule( "_compile_commands_filter": attr.label( allow_files = True, executable = True, - cfg = "host", + cfg = "exec", default = ":compile_commands_filter", ), "_codechecker_script_template": attr.label( @@ -341,7 +341,7 @@ _codechecker_test = rule( "_compile_commands_filter": attr.label( allow_files = True, executable = True, - cfg = "host", + cfg = "exec", default = ":compile_commands_filter", ), "_codechecker_script_template": attr.label( From e69b3305536f87d6e45b9b9c4592605ac7af867a Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Sep 2025 09:01:16 +0200 Subject: [PATCH 08/12] Add debug --- .github/workflows/buildbarn.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml index ca093ff9..45971f60 100644 --- a/.github/workflows/buildbarn.yaml +++ b/.github/workflows/buildbarn.yaml @@ -55,7 +55,7 @@ jobs: run: bazel build //test/unit/legacy:code_checker_pass - name: Run single Bazel tests - run: bazel build //test/unit/legacy:codechecker_pass + run: bazel build //test/unit/legacy:codechecker_pass --verbose_failures - name: Run Bazel tests run: bazel test //... From fdb8e0c4c9f775665e6cc81d7d02d3968d78be25 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Sep 2025 09:50:43 +0200 Subject: [PATCH 09/12] Add pre fetching docker images --- .github/workflows/buildbarn.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml index 45971f60..66cee6ce 100644 --- a/.github/workflows/buildbarn.yaml +++ b/.github/workflows/buildbarn.yaml @@ -40,6 +40,10 @@ jobs: with: version: latest + - name: Pre-pull images + working-directory: .github/buildbarn + run: docker compose pull + - name: Setup BuildBarn working-directory: .github/buildbarn run: | From c09e70f1c0e767603d2ba6d02d9c03c48a96d568 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Sep 2025 14:43:13 +0200 Subject: [PATCH 10/12] Redisable default shell --- src/codechecker.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index 2fc45cf8..cbdf71c7 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -115,7 +115,7 @@ def _codechecker_impl(ctx): ], mnemonic = "CodeCheckerConvertFlaccToClang", progress_message = "Filtering %s" % str(ctx.label), - use_default_shell_env = True, + #use_default_shell_env = True, ) # Create CodeChecker skip (ignore) file From bccd2b5466449f9af3d76a5cfe168dd8b8019a78 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Sep 2025 14:51:48 +0200 Subject: [PATCH 11/12] Add sandbox_debug flag --- .github/workflows/buildbarn.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildbarn.yaml b/.github/workflows/buildbarn.yaml index 66cee6ce..8cc7d2be 100644 --- a/.github/workflows/buildbarn.yaml +++ b/.github/workflows/buildbarn.yaml @@ -59,7 +59,7 @@ jobs: run: bazel build //test/unit/legacy:code_checker_pass - name: Run single Bazel tests - run: bazel build //test/unit/legacy:codechecker_pass --verbose_failures + run: bazel build //test/unit/legacy:codechecker_pass --sandbox_debug --verbose_failures - name: Run Bazel tests run: bazel test //... From 357257dabd010889a7f234c541000a0b037f9a76 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 12 Sep 2025 11:31:32 +0200 Subject: [PATCH 12/12] Add script to inputs --- src/codechecker.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index cbdf71c7..ae3f3ba2 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -105,7 +105,8 @@ def _codechecker_impl(ctx): # Convert flacc calls to clang in compile_commands.json # and save to codechecker_commands.json ctx.actions.run( - inputs = [ctx.outputs.compile_commands], + inputs = [ctx.outputs.compile_commands, + ctx.executable._compile_commands_filter], outputs = [ctx.outputs.codechecker_commands], executable = ctx.executable._compile_commands_filter, arguments = [