ci: Qlty quality job, go 1.27.3 !592
7 files changed, +100 −11
Layout: unified · split
.gitbay/ci.yml +19 −3
| @@ -2,7 +2,7 @@ jobs: | |||
| 2 | # Fast feedback: this finishes in seconds, so it is not held behind the | 2 | # Fast feedback: this finishes in seconds, so it is not held behind the |
| 3 | # suite. | 3 | # suite. |
| 4 | build: | 4 | build: |
| 5 | image: localhost/gitbay-ci:2 | 5 | image: localhost/gitbay-ci:3 |
| 6 | steps: | 6 | steps: |
| 7 | - go build ./... | 7 | - go build ./... |
| 8 | - go vet ./... | 8 | - go vet ./... |
| @@ -13,12 +13,24 @@ jobs: | |||
| 13 | # The 20m is under the runner's own 30m limit, so go times out first and | 13 | # The 20m is under the runner's own 30m limit, so go times out first and |
| 14 | # says which test hung instead of the runner killing it blind. | 14 | # says which test hung instead of the runner killing it blind. |
| 15 | test: | 15 | test: |
| 16 | image: localhost/gitbay-ci:2 | 16 | image: localhost/gitbay-ci:3 |
| 17 | steps: | 17 | steps: |
| 18 | - missing=""; for t in git git-lfs gpg; do command -v "$t" >/dev/null || missing="$missing $t"; done; test -x /usr/sbin/sshd || missing="$missing sshd"; test -z "$missing" || { echo "runner is missing:$missing"; exit 1; } | 18 | - missing=""; for t in git git-lfs gpg; do command -v "$t" >/dev/null || missing="$missing $t"; done; test -x /usr/sbin/sshd || missing="$missing sshd"; test -z "$missing" || { echo "runner is missing:$missing"; exit 1; } |
| 19 | - go test ./... -count=1 -timeout 20m | 19 | - go test ./... -count=1 -timeout 20m |
| 20 | paths-ignore: | 20 | paths-ignore: |
| 21 | - .gitbay/wiki/** | 21 | - .gitbay/wiki/** |
| 22 | # Static analysis through Qlty (.qlty/qlty.toml). Secrets and gofmt fail | ||
| 23 | # the build. The full report, including radarlint-go's Sonar rules, is | ||
| 24 | # printed without failing it. The CLI is pinned, and unpacked with Python | ||
| 25 | # because this image has no xz. | ||
| 26 | quality: | ||
| 27 | image: localhost/gitbay-ci:3 | ||
| 28 | steps: | ||
| 29 | - curl -fsSL -o /tmp/qlty.tar.xz https://qlty-releases.s3.amazonaws.com/qlty/v0.661.0/qlty-x86_64-unknown-linux-gnu.tar.xz && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')" | ||
| 30 | - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter trufflehog,gofmt | ||
| 31 | - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --no-fail | ||
| 32 | paths-ignore: | ||
| 33 | - .gitbay/wiki/** | ||
| 22 | # Vulnerability scanning, separate from test so a newly published advisory | 34 | # Vulnerability scanning, separate from test so a newly published advisory |
| 23 | # against unchanged code does not mask a real test failure. It fails the | 35 | # against unchanged code does not mask a real test failure. It fails the |
| 24 | # build on purpose: an advisory that only lands in a report nobody reads is | 36 | # build on purpose: an advisory that only lands in a report nobody reads is |
| @@ -33,7 +45,11 @@ jobs: | |||
| 33 | # `build trigger krz/gitbay vuln` runs it on demand before a release | 45 | # `build trigger krz/gitbay vuln` runs it on demand before a release |
| 34 | # (#177). | 46 | # (#177). |
| 35 | vuln: | 47 | vuln: |
| 36 | image: localhost/gitbay-ci:2 | 48 | image: localhost/gitbay-ci:3 |
| 37 | schedule: "0 3 * * *" | 49 | schedule: "0 3 * * *" |
| 38 | steps: | 50 | steps: |
| 39 | - go run golang.org/x/vuln/cmd/govulncheck@latest ./... | 51 | - go run golang.org/x/vuln/cmd/govulncheck@latest ./... |
| 52 | # osv-scanner also reports advisories in dependencies the code does not | ||
| 53 | # call, which govulncheck skips. | ||
| 54 | - curl -fsSL -o /tmp/qlty.tar.xz https://qlty-releases.s3.amazonaws.com/qlty/v0.661.0/qlty-x86_64-unknown-linux-gnu.tar.xz && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')" | ||
| 55 | - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter osv-scanner | ||
.gitbay/wiki/Admin.org +2 −2
| @@ -1090,7 +1090,7 @@ where every repository is trusted. There is no automatic fallback: a | |||
| 1090 | runner started with =-isolation podman= that cannot find a working | 1090 | runner started with =-isolation podman= that cannot find a working |
| 1091 | podman exits rather than running a build unsandboxed. | 1091 | podman exits rather than running a build unsandboxed. |
| 1092 | 1092 | ||
| 1093 | gitbay's own jobs name =localhost/gitbay-ci:2=, built from | 1093 | gitbay's own jobs name =localhost/gitbay-ci:3=, built from |
| 1094 | =deploy/Containerfile.ci= on the runner host. A job's image must carry | 1094 | =deploy/Containerfile.ci= on the runner host. A job's image must carry |
| 1095 | what its steps need: the suite drives real git, git-lfs, gpg and sshd and | 1095 | what its steps need: the suite drives real git, git-lfs, gpg and sshd and |
| 1096 | asserts they exist before running, so the stock runner default would fail | 1096 | asserts they exist before running, so the stock runner default would fail |
| @@ -1099,7 +1099,7 @@ it immediately. Build or rebuild it with: | |||
| 1099 | #+begin_src sh | 1099 | #+begin_src sh |
| 1100 | ssh -p 2222 root@<host> 'cat > /tmp/Containerfile.ci' < deploy/Containerfile.ci | 1100 | ssh -p 2222 root@<host> 'cat > /tmp/Containerfile.ci' < deploy/Containerfile.ci |
| 1101 | ssh -p 2222 root@<host> 'su - ci-runner -s /bin/sh -c \ | 1101 | ssh -p 2222 root@<host> 'su - ci-runner -s /bin/sh -c \ |
| 1102 | "podman build -t localhost/gitbay-ci:2 -f /tmp/Containerfile.ci /tmp"' | 1102 | "podman build -t localhost/gitbay-ci:3 -f /tmp/Containerfile.ci /tmp"' |
| 1103 | #+end_src | 1103 | #+end_src |
| 1104 | 1104 | ||
| 1105 | The tag is deliberate rather than =:latest=: changing the file means | 1105 | The tag is deliberate rather than =:latest=: changing the file means |
.qlty/.gitignore added +7
| @@ -0,0 +1,7 @@ | |||
| 1 | * | ||
| 2 | !configs | ||
| 3 | !configs/** | ||
| 4 | !hooks | ||
| 5 | !hooks/** | ||
| 6 | !qlty.toml | ||
| 7 | !.gitignore | ||
.qlty/qlty.toml added +66
| @@ -0,0 +1,66 @@ | |||
| 1 | config_version = "0" | ||
| 2 | |||
| 3 | # Qlty's generated defaults exclude **/config/** and **/templates/**, which | ||
| 4 | # would skip internal/config. | ||
| 5 | exclude_patterns = [ | ||
| 6 | "**/testdata/**", | ||
| 7 | "**/vendor/**", | ||
| 8 | ".gitbay/wiki/**", | ||
| 9 | ] | ||
| 10 | |||
| 11 | test_patterns = [ | ||
| 12 | "**/*_test.go", | ||
| 13 | "e2e/**", | ||
| 14 | ] | ||
| 15 | |||
| 16 | [smells] | ||
| 17 | mode = "comment" | ||
| 18 | |||
| 19 | [[source]] | ||
| 20 | name = "default" | ||
| 21 | default = true | ||
| 22 | |||
| 23 | [[plugin]] | ||
| 24 | name = "golangci-lint" | ||
| 25 | version = "2.15.0" | ||
| 26 | drivers = ["lint"] | ||
| 27 | |||
| 28 | [[plugin]] | ||
| 29 | name = "gofmt" | ||
| 30 | |||
| 31 | [[plugin]] | ||
| 32 | name = "radarlint-go" | ||
| 33 | |||
| 34 | [[plugin]] | ||
| 35 | name = "osv-scanner" | ||
| 36 | |||
| 37 | [[plugin]] | ||
| 38 | name = "trufflehog" | ||
| 39 | |||
| 40 | [[plugin]] | ||
| 41 | name = "shellcheck" | ||
| 42 | |||
| 43 | [[plugin]] | ||
| 44 | name = "ruff" | ||
| 45 | drivers = ["lint"] | ||
| 46 | |||
| 47 | # Repeated literals are expected in table-driven and end-to-end tests. | ||
| 48 | [[triage]] | ||
| 49 | match.plugins = ["radarlint-go"] | ||
| 50 | match.rules = ["radarlint-go:go:S1192"] | ||
| 51 | match.file_patterns = ["**/*_test.go", "e2e/**"] | ||
| 52 | set.ignored = true | ||
| 53 | |||
| 54 | # Unchecked errors in tests are setup and teardown calls. | ||
| 55 | [[triage]] | ||
| 56 | match.plugins = ["golangci-lint"] | ||
| 57 | match.rules = ["golangci-lint:errcheck"] | ||
| 58 | match.file_patterns = ["**/*_test.go", "e2e/**"] | ||
| 59 | set.ignored = true | ||
| 60 | |||
| 61 | # x/crypto/openpgp is deprecated with no fixed version. gitbay imports | ||
| 62 | # github.com/ProtonMail/go-crypto/openpgp, not that package. | ||
| 63 | [[triage]] | ||
| 64 | match.plugins = ["osv-scanner"] | ||
| 65 | match.rules = ["osv-scanner:GO-2026-5932"] | ||
| 66 | set.ignored = true | ||
deploy/Containerfile.ci +2 −2
| @@ -8,12 +8,12 @@ | |||
| 8 | # | 8 | # |
| 9 | # scp -P 2222 deploy/Containerfile.ci root@gitbay.org:/var/lib/gitbay-runner/gitbay-ci.Containerfile | 9 | # scp -P 2222 deploy/Containerfile.ci root@gitbay.org:/var/lib/gitbay-runner/gitbay-ci.Containerfile |
| 10 | # ssh -p 2222 root@gitbay.org 'chown ci-runner /var/lib/gitbay-runner/gitbay-ci.Containerfile \ | 10 | # ssh -p 2222 root@gitbay.org 'chown ci-runner /var/lib/gitbay-runner/gitbay-ci.Containerfile \ |
| 11 | # && su - ci-runner -s /bin/sh -c "podman build -t localhost/gitbay-ci:2 -f gitbay-ci.Containerfile ." \ | 11 | # && su - ci-runner -s /bin/sh -c "podman build -t localhost/gitbay-ci:3 -f gitbay-ci.Containerfile ." \ |
| 12 | # && rm /var/lib/gitbay-runner/gitbay-ci.Containerfile' | 12 | # && rm /var/lib/gitbay-runner/gitbay-ci.Containerfile' |
| 13 | # | 13 | # |
| 14 | # Tagged, not :latest, so a change to this file is a deliberate bump in | 14 | # Tagged, not :latest, so a change to this file is a deliberate bump in |
| 15 | # .gitbay/ci.yml rather than a silent change under a running branch. | 15 | # .gitbay/ci.yml rather than a silent change under a running branch. |
| 16 | FROM docker.io/library/golang:1.27-trixie | 16 | FROM docker.io/library/golang:1.27.3-trixie |
| 17 | 17 | ||
| 18 | # gitbay-runner-prune.service skips images carrying this label. A localhost/ | 18 | # gitbay-runner-prune.service skips images carrying this label. A localhost/ |
| 19 | # image cannot be pulled back, so pruning it fails every job that names it. | 19 | # image cannot be pulled back, so pruning it fails every job that names it. |
go.mod +1 −1
| @@ -1,6 +1,6 @@ | |||
| 1 | module gitbay.org/gitbay | 1 | module gitbay.org/gitbay |
| 2 | 2 | ||
| 3 | go 1.27.2 | 3 | go 1.27.3 |
| 4 | 4 | ||
| 5 | require ( | 5 | require ( |
| 6 | filippo.io/age v1.3.2 | 6 | filippo.io/age v1.3.2 |
internal/httpd/rendered_test.go +3 −3
| @@ -17,10 +17,10 @@ func TestFocusableBlocks(t *testing.T) { | |||
| 17 | func TestImageAlt(t *testing.T) { | 17 | func TestImageAlt(t *testing.T) { |
| 18 | cases := map[string]string{ | 18 | cases := map[string]string{ |
| 19 | `<a href="/b"><img src="https://forge.test/krz/gitbay/badge/build.svg"/></a>`: `<a href="/b"><img alt="build" src="https://forge.test/krz/gitbay/badge/build.svg"/></a>`, | 19 | `<a href="/b"><img src="https://forge.test/krz/gitbay/badge/build.svg"/></a>`: `<a href="/b"><img alt="build" src="https://forge.test/krz/gitbay/badge/build.svg"/></a>`, |
| 20 | `<img src="pic.png?v=2">`: `<img alt="pic" src="pic.png?v=2">`, | 20 | `<img src="pic.png?v=2">`: `<img alt="pic" src="pic.png?v=2">`, |
| 21 | `<img alt="" src="pic.png">`: `<img alt="" src="pic.png">`, | 21 | `<img alt="" src="pic.png">`: `<img alt="" src="pic.png">`, |
| 22 | `<img alt="a chart" src="c.png">`: `<img alt="a chart" src="c.png">`, | 22 | `<img alt="a chart" src="c.png">`: `<img alt="a chart" src="c.png">`, |
| 23 | `<img>`: `<img alt="">`, | 23 | `<img>`: `<img alt="">`, |
| 24 | } | 24 | } |
| 25 | for in, want := range cases { | 25 | for in, want := range cases { |
| 26 | if got := string(imageAlt(template.HTML(in))); got != want { | 26 | if got := string(imageAlt(template.HTML(in))); got != want { |