From d9ab3c43fc9918217f4c0c728017dfd227fa6740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Dec 2023 22:40:59 -0500 Subject: [PATCH 1/5] test/lint/golangci: Add missing trailing new line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- test/lint/golangci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lint/golangci.sh b/test/lint/golangci.sh index 05ead58a58e..a2e5792b84d 100755 --- a/test/lint/golangci.sh +++ b/test/lint/golangci.sh @@ -14,4 +14,4 @@ fi rev="$(git log "${target_branch}" --oneline --no-abbrev-commit -n1 | cut -d' ' -f1)" echo "Checking for golangci-lint errors between HEAD and ${target_branch}..." -golangci-lint run --timeout 5m --new --new-from-rev "${rev}" \ No newline at end of file +golangci-lint run --timeout 5m --new --new-from-rev "${rev}" From e085bae1296c883b7b12a06fd73d9bf349eb2829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Dec 2023 22:51:06 -0500 Subject: [PATCH 2/5] test/golangci: Handle some common upstream branch names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- test/lint/golangci.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/lint/golangci.sh b/test/lint/golangci.sh index a2e5792b84d..68a7bd37cdd 100755 --- a/test/lint/golangci.sh +++ b/test/lint/golangci.sh @@ -1,13 +1,26 @@ #!/bin/sh -eu -# Default target branch. -target_branch="main" +target_branch="" if [ -n "${GITHUB_ACTIONS:-}" ]; then # Target branch when running in github actions (see https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables). target_branch="${GITHUB_BASE_REF}" elif [ -n "${1:-}" ]; then # Allow a target branch parameter. target_branch="${1}" +else + # Default target branch. + for branch in main origin lxc/main; do + if git show-ref --quiet "refs/heads/${branch}" >/dev/null 2>&1; then + target_branch="${branch}" + break + fi + done +fi + +# Check if we found a target branch. +if [ -z "${target_branch}" ]; then + echo "The target branch for golangci couldn't be found, skipping." + return fi # Gets the most recent commit hash from the target branch. From 517dd964aefc6bfacd9fa796003f459e930d4be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Dec 2023 22:51:53 -0500 Subject: [PATCH 3/5] test/README: Fix bad binary names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- test/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/README.md b/test/README.md index bc5747a078c..95411fe3456 100644 --- a/test/README.md +++ b/test/README.md @@ -17,7 +17,7 @@ Name | Default | Description `INCUS_CEPH_CEPHFS` | "" | Enables the CephFS tests using the specified cephfs filesystem for `cephfs` pools `INCUS_CEPH_CEPHOBJECT_RADOSGW` | "" | Enables the Ceph Object tests using the specified radosgw HTTP endpoint for `cephobject` pools `INCUS_CONCURRENT` | 0 | Run concurrency tests, very CPU intensive -`INCUS_DEBUG` | 0 | Run incus, inc and the shell in debug mode (very verbose) +`INCUS_DEBUG` | 0 | Run incusd, incus and the shell in debug mode (very verbose) `INCUS_INSPECT` | 0 | Don't teardown the test environment on failure `INCUS_LOGS ` | "" | Path to a directory to copy all the Incus logs to `INCUS_OFFLINE` | 0 | Skip anything that requires network access @@ -29,4 +29,4 @@ Name | Default | Description `INCUS_IB_SRIOV_PARENT` | "" | Enables Infiniband SR-IOV tests using the specified parent device `INCUS_NIC_BRIDGED_DRIVER` | "" | Specifies bridged NIC driver for tests (either native or openvswitch, defaults to native) `INCUS_REQUIRED_TESTS` | "" | Space-delimited list of test names that must not be skipped if their prerequisites are not met -`INCUS_VERBOSE` | 0 | Run incus, inc and the shell in verbose mode +`INCUS_VERBOSE` | 0 | Run incusd, incus and the shell in verbose mode From 0120136ed010e73b27170fa374118590092faac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Dec 2023 22:52:57 -0500 Subject: [PATCH 4/5] github/ISSUE_TEMPLATE: Fix bad binary names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/ISSUE_TEMPLATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 78660dfa782..bf4e751c419 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -9,7 +9,7 @@ Feel free to remove anything which doesn't apply to you and add more information * Distribution: * Distribution version: - * The output of "inc info" or if that fails: + * The output of "incus info" or if that fails: * Kernel version: * LXC version: * Incus version: @@ -30,8 +30,8 @@ see happen. # Information to attach - [ ] Any relevant kernel output (`dmesg`) - - [ ] Container log (`inc info NAME --show-log`) - - [ ] Container configuration (`inc config show NAME --expanded`) - - [ ] Main daemon log (at /var/log/incus/incus.log) + - [ ] Container log (`incus info NAME --show-log`) + - [ ] Container configuration (`incus config show NAME --expanded`) + - [ ] Main daemon log (at /var/log/incus/incusd.log) - [ ] Output of the client with --debug - - [ ] Output of the daemon with --debug (alternatively output of `inc monitor` while reproducing the issue) + - [ ] Output of the daemon with --debug (alternatively output of `incus monitor --pretty` while reproducing the issue) From ab5bee11885cfbf150eafdf02768501c8390979e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Dec 2023 23:02:03 -0500 Subject: [PATCH 5/5] test/golangci: Better handle Github refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/workflows/tests.yml | 2 ++ test/lint/golangci.sh | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d2d74218909..aeaa8b8c0e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -86,6 +86,8 @@ jobs: make - name: Run static analysis + env: + GITHUB_BEFORE: ${{ github.event.before }} run: | make static-analysis diff --git a/test/lint/golangci.sh b/test/lint/golangci.sh index 68a7bd37cdd..8d2dc0c7983 100755 --- a/test/lint/golangci.sh +++ b/test/lint/golangci.sh @@ -1,9 +1,12 @@ #!/bin/sh -eu target_branch="" -if [ -n "${GITHUB_ACTIONS:-}" ]; then - # Target branch when running in github actions (see https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables). +if [ -n "${GITHUB_BASE_REF:-}" ]; then + # Target branch when scanning a Github pull request target_branch="${GITHUB_BASE_REF}" +elif [ -n "${GITHUB_BEFORE:-}" ]; then + # Target branch when scanning a Github merge + target_branch="${GITHUB_BEFORE}" elif [ -n "${1:-}" ]; then # Allow a target branch parameter. target_branch="${1}"