Skip to content

chore: add test, security and build-and-push CI workflows [#5] - #14

Open
nisargabd wants to merge 9 commits into
developmentfrom
chore/5-ci-cd-workflows
Open

chore: add test, security and build-and-push CI workflows [#5]#14
nisargabd wants to merge 9 commits into
developmentfrom
chore/5-ci-cd-workflows

Conversation

@nisargabd

Copy link
Copy Markdown
Collaborator

What

  • run-tests.yml — lint (advisory) + tests via gotestsum, with diff-scoped coverage posted as a PR comment
  • security.yml — Trivy dependency scan + image scan (built from Dockerfile.adapter-with-plugins), SARIF uploaded to the Security tab, gated on HIGH/CRITICAL findings
  • build-and-push.yml — multi-arch (amd64/arm64) image build on vX.Y.Z tags, Trivy release gate before push, multi-registry push
  • New Makefilebuild/test/test-ci/cover-diff/lint/trivy-* targets, the single source of truth both the workflows and a local make call use
  • Dockerfile.adapter-with-plugins (the image actually deployed) switched to dhi.io (Docker Hardened Images) glibc-only runtime; Dockerfile.adapter is unchanged
  • Deployment/deployment.yaml — passes --config via Kubernetes' native $(CONFIG_FILE) arg substitution, since the hardened runtime has no shell to do it itself
  • .github/actions/dhi-login — composite action to authenticate to dhi.io, used by security.yml and build-and-push.yml
  • onix-gcp-terraform-deploy.yml — disabled its push trigger (kept workflow_dispatch only); it was failing on every push for unrelated reasons

Why

No consistent test/security/release pipeline existed for this repo. This adds one: gated tests with coverage feedback on PRs, dependency and image vulnerability scanning before merge, and a signed-off multi-arch release path on tag push.

Testing

  • go build ./cmd/adapter/..., go vet ./..., go test -race ./... pass locally (one pre-existing, non-deterministic failure: pkg/plugin's valid_config_with_so_file subtest — a checked-in .so fixture that only loads when it matches the active Go toolchain's ABI fingerprint; unrelated to this change)
  • make lint, make test-ci, make trivy-deps, make trivy-image run clean locally
  • CI green on this branch: tests, security scan (0 HIGH/CRITICAL image findings), build-and-push dry runs

Closes #5

Adds a run-tests/security/build-and-push flow: gated lint, gotestsum with
diff-scoped coverage, dependency+image Trivy scans gated on HIGH/CRITICAL,
multi-registry multi-arch build-and-push on release tags. Both Dockerfiles
switch to dhi.io base images (with public overrides for a local build
without a DHI subscription), so the security and build-and-push jobs
authenticate to dhi.io first.
… dependency [#5]

security.yml's Trivy gate failed on unpatched CVEs in dhi.io/debian-base's
bundled perl-base, ncurses, util-linux and zlib1g -- none of which the
adapter uses. Neither can move to the fully static dhi.io/static image
though: the adapter loads plugin .so files at runtime via Go's `plugin`
package, which needs cgo and a real glibc dynamic linker to work at all.
dhi.io/static's glibc variant is the middle ground -- keeps libc6 so
plugin.Open still works, drops everything else the scan was flagging.

That variant has no shell, so CMD's `sh -c "./server --config=$CONFIG_FILE"`
can no longer expand the env var. Switched to an exec-form ENTRYPOINT and
taught main.go to read CONFIG_FILE itself as the --config default.
…wn CVEs [#5]

security.yml's trivy-deps scan flagged CVE-2026-56854 (x/crypto, CRITICAL)
and CVE-2026-84304 (grpc, HIGH), both with fixed versions already
published upstream.
Ran on every push including this branch and always failed here -- missing
Gerrit credentials for the private Terraform-CICD repo it clones.
workflow_dispatch stays, so it's still runnable by hand; kept, not deleted,
pending a decision on whether it's folded into build-and-push.yml or
removed outright.
…ersions [#5]

This is CI setup, not a dependency-bump PR -- the two CVEs trivy-deps flags
(CVE-2026-56854, CVE-2026-84304) are real and the scan catching them is
working as intended; the actual bump is deferred to its own change.
Dockerfile.adapter goes back to the original public base images --
Dockerfile.adapter-with-plugins is the one actually deployed, so that's
the one that needs the CVE fix. Keeps dhi.io/static's glibc-only variant
(clears the unpatched perl-base/ncurses/util-linux/zlib1g CVEs, keeps
libc6 so plugin.Open still works) but drops the main.go change entirely:
Deployment/deployment.yaml now passes --config=$(CONFIG_FILE) via args,
letting the kubelet do the substitution instead of a shell inside the
container.
…dapter [#5]

security.yml and build-and-push.yml still pointed at Dockerfile.adapter,
which we just reverted back to the original, unpatched base images -- so
the security gate was scanning the wrong Dockerfile and the CVE fix never
took effect. Dockerfile.adapter-with-plugins is the one actually deployed
and the one carrying the DHI glibc-only runtime fix.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

🛡️ Trivy — Go dependency scan (HIGH,CRITICAL)

View full run

Package Severity Installed Fixed in Advisory
github.com/rabbitmq/amqp091-go HIGH v1.11.0 1.13.0 CVE-2026-79921
golang.org/x/crypto CRITICAL v0.54.0 0.55.0 CVE-2026-56854
google.golang.org/grpc HIGH v1.82.1 1.83.1 CVE-2026-84304

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

🛡️ Trivy — image scan (HIGH,CRITICAL)

View full run

No HIGH or CRITICAL findings.

…ce+coverage run [#5]

pkg/plugin and benchmarks/e2e each build a real .so via a subprocess
`go build -buildmode=plugin`, then load it with plugin.Open in the same
test run. Instrumenting the whole module for coverage/race in one ./...
build gives a shared package a different build identity than the plain
subprocess build produces, so plugin.Open rejects the .so. Split them
into their own go test invocation and merge the coverage output.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

📊 Test Coverage: ✅ Passed — not applicable, no changed Go files vs origin/development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant