Skip to content

chore: add test, security and build-and-push CI workflows [#999] - #12

Closed
nisargabd wants to merge 7 commits into
developmentfrom
chore/999-ci-cd-workflows
Closed

nisargabd wants to merge 7 commits into
developmentfrom
chore/999-ci-cd-workflows

Conversation

@nisargabd

@nisargabd nisargabd commented Sep 3, 2026 •

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, 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 (GHCR by default, DockerHub/ACR/GAR opt-in via repo variables)
  • New Makefile — build/test/test-ci/cover-diff/lint/trivy-* targets, the single source of truth both the workflows and a local make call use
  • Dockerfile.adapter and Dockerfile.adapter-with-plugins switched to dhi.io (Docker Hardened Images) base images; both keep build-arg overrides back to the previous public images (golang:1.26.1-bookworm, cgr.dev/chainguard/wolfi-base) for a local build without a DHI subscription
  • .github/actions/dhi-login — composite action to authenticate to dhi.io, used by security.yml and build-and-push.yml

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 ./... all pass locally (one pre-existing, unrelated failure: pkg/plugin's valid_config_with_so_file subtest — a checked-in .so fixture built with a different Go runtime ABI than what's installed locally)
  • make lint, make test-ci, make trivy-deps, make trivy-image run clean locally
  • Workflow YAML validated with a YAML parser; no CI run yet since secrets (DHI, registry) live on GitHub, not locally

Issue not yet filed — #999 is a placeholder; will update once a real ticket exists.

Closes #999

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

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

View full run

Package Severity Installed Fixed in Advisory
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 3, 2026 •

Copy link
Copy Markdown

🛡️ Trivy — image scan (HIGH,CRITICAL)

View full run

No HIGH or CRITICAL findings.

@nisargabd nisargabd changed the title chore: replicate discovery-service's CI/CD workflow [#999] chore: add test, security and build-and-push CI workflows [#999] Sep 3, 2026
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.
@nisargabd
nisargabd force-pushed the chore/999-ci-cd-workflows branch from c5404d9 to 0c8854c Compare September 3, 2026 09:41
… dependency [#999]

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 [#999]

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 [#999]

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 [#999]

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.
@nisargabd

Copy link
Copy Markdown
Collaborator Author

Superseded by the PR from chore/5-ci-cd-workflows — same work, retargeted to issue #5.

@nisargabd nisargabd closed this Sep 4, 2026
@nisargabd
nisargabd deleted the chore/999-ci-cd-workflows branch September 4, 2026 06:22
manjudr added a commit that referenced this pull request Sep 15, 2026
fix(mappings): follow network-specs #12/#13, and name a knowledge source by its title
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