diff --git a/MODULE.bazel b/MODULE.bazel index 98f343b8772..8aa1665b252 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,6 +16,13 @@ bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "rules_rust", version = "0.49.3") bazel_dep(name = "rules_python", version = "0.37.0") bazel_dep(name = "rules_uv", version = "0.42.0") +# TODO: Check if term issue is fixed: +# https://github.com/theoremlp/rules_uv/pull/167 +single_version_override( + module_name = "rules_uv", + patch_strip = 1, + patches = ["//bazel/patches:rules_uv_term.patch"], +) # TODO: how to sync this with the PYTHON_VERSION in package_versions.bzl? PYTHON_VERSION = "3.12.3" diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index dc1fc3f7b92..f2bda28940c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 6, - "moduleFileHash": "43f42b08c4dcf243c489512c67649886eb2f20145b59f60143be339c055be311", + "moduleFileHash": "bd03e2ee530b21293774afaedc374e727a791ed711f3e0e47c06750f2a921bbc", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -63,7 +63,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 82, + "line": 89, "column": 25 } }, @@ -97,7 +97,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 105, + "line": 112, "column": 13 } }, @@ -115,7 +115,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 135, + "line": 142, "column": 13 } } @@ -129,7 +129,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 26, + "line": 33, "column": 23 }, "imports": {}, @@ -144,7 +144,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 27, + "line": 34, "column": 17 } } @@ -158,7 +158,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 53, + "line": 60, "column": 20 }, "imports": { @@ -181,7 +181,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 54, + "line": 61, "column": 10 } } @@ -195,7 +195,7 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 68, + "line": 75, "column": 22 }, "imports": { @@ -213,7 +213,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 69, + "line": 76, "column": 19 } } @@ -774,7 +774,14 @@ "integrity": "sha256-UqSv85vnPZM28/TYSZZTcODpxiTYK90aFM75HqCeiyI=", "strip_prefix": "rules_uv-0.42.0", "remote_patches": {}, - "remote_patch_strip": 0 + "remote_patch_strip": 0, + "patches": [ + "@@//bazel/patches:rules_uv_term.patch" + ], + "patch_cmds": [], + "patch_args": [ + "-p1" + ] } } }, diff --git a/bazel/patches/BUILD b/bazel/patches/BUILD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/bazel/patches/rules_uv_term.patch b/bazel/patches/rules_uv_term.patch new file mode 100644 index 00000000000..7c44ebf41a8 --- /dev/null +++ b/bazel/patches/rules_uv_term.patch @@ -0,0 +1,33 @@ +From 2f9c114e1fd7fc7aff2cb7fe58187c127a3d1c4f Mon Sep 17 00:00:00 2001 +From: Timotheus Bachinger +Date: Sat, 30 Nov 2024 03:43:30 +0100 +Subject: [PATCH 1/1] Enable create_venv for non-interactive runs (#167) + +When using `create_venv` in non-interactive docker container runs, we +would get: +``` +tput: No value for $TERM and no -T specified +``` +This sets `TERM` in case it isn't and enables such runs. +--- + uv/private/create_venv.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/uv/private/create_venv.sh b/uv/private/create_venv.sh +index 10edaf4..b88b2d4 100644 +--- a/uv/private/create_venv.sh ++++ b/uv/private/create_venv.sh +@@ -8,6 +8,10 @@ REQUIREMENTS_TXT="{{requirements_txt}}" + + PYTHON="$(realpath "$RESOLVED_PYTHON")" + ++if [ -z ${TERM} ] || [ ${TERM} == "dumb" ]; then ++ export TERM=xterm ++fi ++ + bold="$(tput bold)" + normal="$(tput sgr0)" + +-- +2.43.0 + diff --git a/buildscripts/scripts/stages.yml b/buildscripts/scripts/stages.yml index 3a3ff57c5be..bbbd93c51ba 100644 --- a/buildscripts/scripts/stages.yml +++ b/buildscripts/scripts/stages.yml @@ -424,7 +424,7 @@ STAGES: - NAME: "Package cmk-agent-based" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_AGENT_BASED_FILES DIR: "packages/cmk-agent-based" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-agent-based.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-agent-based.txt" TEXT_ON_SKIP: "No cmk-agent-based files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-agent-based.txt" @@ -438,91 +438,91 @@ STAGES: - NAME: "Package cmk-agent-receiver" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_AGENT_RECEIVER_FILES DIR: "packages/cmk-agent-receiver" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-agent-receiver.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-agent-receiver.txt" TEXT_ON_SKIP: "No cmk-agent-receiver files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-agent-receiver.txt" - NAME: "Package cmk-ccc" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_CCC_FILES DIR: "packages/cmk-ccc" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-ccc.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-ccc.txt" TEXT_ON_SKIP: "No cmk-ccc files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-ccc.txt" - NAME: "Package cmk-crypto" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_CRYPTO_FILES DIR: "packages/cmk-crypto" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-crypto.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-crypto.txt" TEXT_ON_SKIP: "No cmk-crypto files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-crypto.txt" - NAME: "Package cmk-events" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_EVENTS_FILES DIR: "packages/cmk-mkp-tool" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-events.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-events.txt" TEXT_ON_SKIP: "No cmk-events files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-events.txt" - NAME: "Package cmk-graphing" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_GRAPHING_FILES DIR: "packages/cmk-graphing" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-graphing.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-graphing.txt" TEXT_ON_SKIP: "No cmk-graphing files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-graphing.txt" - NAME: "Package cmk-livestatus-client" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_LIVESTATUS_CLIENT_FILES DIR: "packages/cmk-livestatus-client" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-livestatus-client.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-livestatus-client.txt" TEXT_ON_SKIP: "No cmk-livestatus-client files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-livestatus-client.txt" - NAME: "Package cmk-messaging" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_MESSAGING_FILES DIR: "packages/cmk-messaging" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-messaging.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-messaging.txt" TEXT_ON_SKIP: "No cmk-messaging files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-messaging.txt" - NAME: "Package cmk-mkp-tool" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_MKP_TOOL_FILES DIR: "packages/cmk-mkp-tool" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-mkp-tool.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-mkp-tool.txt" TEXT_ON_SKIP: "No cmk-mkp-tool files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-mkp-tool.txt" - NAME: "Package cmk-otel-collector" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_OTEL_FILES DIR: "non-free/packages/cmk-otel-collector" - COMMAND: "../../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-otel-collector.txt" + COMMAND: "../../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-otel-collector.txt" TEXT_ON_SKIP: "No cmk-otel-collector files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-otel-collector.txt" - NAME: "Package cmk-rulesets" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_RULESETS_FILES DIR: "packages/cmk-rulesets" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-rulesets.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-rulesets.txt" TEXT_ON_SKIP: "No cmk-rulesets files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-rulesets.txt" - NAME: "Package cmk-server-side-calls" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_SERVER_SIDE_CALLS_FILES DIR: "packages/cmk-server-side-calls" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-server-side-calls.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-server-side-calls.txt" TEXT_ON_SKIP: "No cmk-server-side-calls files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-server-side-calls.txt" - NAME: "Package cmk-werks" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_WERKS_FILES DIR: "packages/cmk-werks" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-werks.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-werks.txt" TEXT_ON_SKIP: "No cmk-werks package files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-werks.txt" - NAME: "Package cmk-trace" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_CMK_TRACE_FILES DIR: "packages/cmk-trace" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --all &> ${RESULTS}/cmk-trace.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --all &> ${RESULTS}/cmk-trace.txt" TEXT_ON_SKIP: "No cmk-trace package files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-trace.txt" @@ -536,7 +536,7 @@ STAGES: - NAME: "Package cmk-shared-typing" ONLY_WHEN_NOT_EMPTY: CHANGED_REFERENCE_IMAGE,CHANGED_PYPROJECT_TOML_FILE,CHANGED_SHARED_TYPING_FILES DIR: "packages/cmk-shared-typing" - COMMAND: "../../scripts/run-in-docker.sh TERM=xterm ./run --clean --all &> ${RESULTS}/cmk-shared-typing.txt" + COMMAND: "../../scripts/run-in-docker.sh ./run --clean --all &> ${RESULTS}/cmk-shared-typing.txt" TEXT_ON_SKIP: "No cmk-shared-typing files changed" RESULT_CHECK_FILE_PATTERN: "results/cmk-shared-typing.txt" diff --git a/packages/cmk-agent-based/ci.json b/packages/cmk-agent-based/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-agent-based/ci.json +++ b/packages/cmk-agent-based/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-agent-receiver/ci.json b/packages/cmk-agent-receiver/ci.json index ecb2c10138a..1a685923a09 100644 --- a/packages/cmk-agent-receiver/ci.json +++ b/packages/cmk-agent-receiver/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-main@checkmk.com"] } diff --git a/packages/cmk-ccc/ci.json b/packages/cmk-ccc/ci.json index e05be0a0ff6..367c8ae3a75 100644 --- a/packages/cmk-ccc/ci.json +++ b/packages/cmk-ccc/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["mathias.laurin@checkmk.com"], } diff --git a/packages/cmk-crypto/ci.json b/packages/cmk-crypto/ci.json index babf287f70c..7668f4ba66a 100644 --- a/packages/cmk-crypto/ci.json +++ b/packages/cmk-crypto/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-security@checkmk.com"] } diff --git a/packages/cmk-events/ci.json b/packages/cmk-events/ci.json index 349d9cb813d..c8b5202df90 100644 --- a/packages/cmk-events/ci.json +++ b/packages/cmk-events/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["ronny.bruska@checkmk.com", "christopher.krause@checkmk.com"] } diff --git a/packages/cmk-graphing/ci.json b/packages/cmk-graphing/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-graphing/ci.json +++ b/packages/cmk-graphing/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-livestatus-client/ci.json b/packages/cmk-livestatus-client/ci.json index ecb2c10138a..1a685923a09 100644 --- a/packages/cmk-livestatus-client/ci.json +++ b/packages/cmk-livestatus-client/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-main@checkmk.com"] } diff --git a/packages/cmk-messaging/ci.json b/packages/cmk-messaging/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-messaging/ci.json +++ b/packages/cmk-messaging/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-mkp-tool/ci.json b/packages/cmk-mkp-tool/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-mkp-tool/ci.json +++ b/packages/cmk-mkp-tool/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-rulesets/ci.json b/packages/cmk-rulesets/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-rulesets/ci.json +++ b/packages/cmk-rulesets/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-server-side-calls/ci.json b/packages/cmk-server-side-calls/ci.json index cbcfd249a69..09acb2a48b5 100644 --- a/packages/cmk-server-side-calls/ci.json +++ b/packages/cmk-server-side-calls/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-nile@checkmk.com"] } diff --git a/packages/cmk-shared-typing/ci.json b/packages/cmk-shared-typing/ci.json index 019a939fc6a..f1c2e084395 100644 --- a/packages/cmk-shared-typing/ci.json +++ b/packages/cmk-shared-typing/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-prj-engelbart@checkmk.com"] } diff --git a/packages/cmk-trace/ci.json b/packages/cmk-trace/ci.json index fbe11373497..d3cb4647642 100644 --- a/packages/cmk-trace/ci.json +++ b/packages/cmk-trace/ci.json @@ -1,4 +1,4 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["lm@checkmk.com"], } diff --git a/packages/cmk-werks/ci.json b/packages/cmk-werks/ci.json index d609489bba6..a4fb6ff3073 100644 --- a/packages/cmk-werks/ci.json +++ b/packages/cmk-werks/ci.json @@ -1,5 +1,5 @@ { - "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh TERM=xterm ./run --clean --all", + "command_line": "BAZEL_CMD=../../scripts/run-bazel.sh ./run --clean --all", "maintainers": ["team-prj-engelbart@checkmk.com"], "dependencies": [".werks/"] } diff --git a/tests/Makefile b/tests/Makefile index 240af962301..3c171fdcb72 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -194,7 +194,7 @@ test-semgrep: $(realpath ..) test-semgrep-docker: - ../scripts/run-in-docker.sh TERM=xterm make test-semgrep + ../scripts/run-in-docker.sh make test-semgrep test-bandit: bandit.ini # Currently only care about high severity reported issues. Once this is reached, @@ -406,7 +406,7 @@ test-cycles: --verbose test-cycles-docker: - ../scripts/run-in-docker.sh TERM=xterm make --quiet test-cycles + ../scripts/run-in-docker.sh make --quiet test-cycles test-unit-omdlib: cd .. && TZ=$(RANDOM_TZ) $(PYTEST) \