quality
No long description provided.
Installation
dagger install github.com/context-and-oss/cicd/src/quality@v5.1.5Entrypoint
Return Type
Quality Example
dagger -m github.com/context-and-oss/cicd/src/quality@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
func (m *MyModule) Example() *dagger.Quality {
return dag.
Quality()
}@function
def example() -> dagger.Quality:
return (
dag.quality()
)@func()
example(): Quality {
return dag
.quality()
}Types
Quality 🔗
Quality is the Dagger module for the source gate’s code-quality legs: lint and native unit tests per auto-detected language (Check), a witnessed consumer-owned test command with its coverage harvest (Test), a consumer-owned lint or SBOM command (Collect), and the prepared toolchain container the others can share (Prepare).
check() 🔗
Check runs lint and unit tests on source code. Returns an aggregated evidence envelope.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | Source directory to check. |
| include | [String ! ] | - | Languages to include: go, node, python, dotnet (repeatable, optional). |
| failOn | String ! | "HIGH" | Minimum severity that fails the pipeline: CRITICAL|HIGH|MEDIUM|LOW|NONE |
| commitSha | String ! | - | Git commit SHA for evidence provenance. |
| branch | String ! | - | Git branch name for evidence provenance. |
| repoUrl | String ! | - | Repository URL for evidence provenance. |
| npmFeedUrl | String | - | Internal npm registry URL. |
| npmFeedRouting | String | - | How the npm feed is applied: “registry” (default) makes it the registry for every package; “npmrc” binds only its token and leaves routing to the project’s .npmrc, for a feed with no upstream to the public registry. |
| npmToken | Secret | - | Auth token for internal npm registry. |
| nugetFeedUrl | String | - | Internal NuGet feed URL. |
| nugetToken | Secret | - | Auth token for internal NuGet feed. |
| minCoverage | Float | "0" | Minimum coverage percentage (0–100) to pass the gate. 0 disables the check. |
| coverageMinLines | Integer | "0" | Skip the coverage gate for a language that has fewer coverable lines/statements than this. |
| lintOnly | Boolean | - | Run lint only — skip the per-language test step entirely. For repos that execute their own test command via Test (BYO test, ADR-002), this keeps the vanilla lint baseline without a redundant test run. |
| prepared | Container | - | No description provided |
| preparedLanguage | String | - | node or dotnet; the language whose linter uses prepared dependencies. |
| nodeProjectLimit | Integer ! | 4 | Maximum independent Node projects to lint/test. No project is silently omitted. |
Example
dagger -m github.com/context-and-oss/cicd/src/quality@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
check --src DIR_PATH --fail-on string --commit-sha string --branch string --repo-url string --node-project-limit integerfunc (m *MyModule) Example(src *dagger.Directory, failOn string, commitSha string, branch string, repoUrl string, nodeProjectLimit int) *dagger.File {
return dag.
Quality().
Check(src, failOn, commitSha, branch, repoUrl, nodeProjectLimit)
}@function
def example(src: dagger.Directory, failon: str, commitsha: str, branch: str, repourl: str, nodeprojectlimit: int) -> dagger.File:
return (
dag.quality()
.check(src, failon, commitsha, branch, repourl, nodeprojectlimit)
)@func()
example(src: Directory, failOn: string, commitSha: string, branch: string, repoUrl: string, nodeProjectLimit: number): File {
return dag
.quality()
.check(src, failOn, commitSha, branch, repoUrl, nodeProjectLimit)
}collect() 🔗
Collect runs a caller-owned lint or SBOM command in the full checkout and returns evidence. Setup belongs in cmd. The named output is removed inside the execution container first, so committed or stale output cannot pass.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | No description provided |
| kind | String ! | - | No description provided |
| label | String ! | - | No description provided |
| language | String ! | - | No description provided |
| cmd | String ! | - | No description provided |
| reportPath | String ! | - | No description provided |
| format | String ! | - | No description provided |
| sourcePaths | [String ! ] ! | - | No description provided |
| commitSha | String ! | - | No description provided |
| branch | String ! | - | No description provided |
| repoUrl | String ! | - | No description provided |
| toolchainImage | String | - | No description provided |
| failOn | String ! | "HIGH" | No description provided |
| npmFeedUrl | String | - | No description provided |
| npmFeedRouting | String | - | “registry” (default) or “npmrc”; see quality.Check. |
| npmToken | Secret | - | No description provided |
| nugetFeedUrl | String | - | No description provided |
| nugetToken | Secret | - | No description provided |
| prepared | Container | - | No description provided |
Example
dagger -m github.com/context-and-oss/cicd/src/quality@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
collect --src DIR_PATH --kind string --label string --language string --cmd string --report-path string --format string --source-paths string1 --source-paths string2 --commit-sha string --branch string --repo-url string --fail-on stringfunc (m *MyModule) Example(src *dagger.Directory, kind string, label string, language string, cmd string, reportPath string, format string, sourcePaths []string, commitSha string, branch string, repoUrl string, failOn string) *dagger.File {
return dag.
Quality().
Collect(src, kind, label, language, cmd, reportPath, format, sourcePaths, commitSha, branch, repoUrl, failOn)
}@function
def example(src: dagger.Directory, kind: str, label: str, language: str, cmd: str, reportpath: str, format: str, sourcepaths: List[str], commitsha: str, branch: str, repourl: str, failon: str) -> dagger.File:
return (
dag.quality()
.collect(src, kind, label, language, cmd, reportpath, format, sourcepaths, commitsha, branch, repourl, failon)
)@func()
example(src: Directory, kind: string, label: string, language: string, cmd: string, reportPath: string, format: string, sourcePaths: string[], commitSha: string, branch: string, repoUrl: string, failOn: string): File {
return dag
.quality()
.collect(src, kind, label, language, cmd, reportPath, format, sourcePaths, commitSha, branch, repoUrl, failOn)
}prepare() 🔗
Prepare executes the consumer’s dependency preparation and optional compile command once. Tests, lint and packaging branch from this immutable state. Feed credentials are secret variables, never baked into source or artifacts.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | No description provided |
| cmd | String ! | - | No description provided |
| toolchainImage | String ! | - | No description provided |
| repoUrl | String ! | - | No description provided |
| npmFeedUrl | String | - | No description provided |
| npmFeedRouting | String | - | “registry” (default) or “npmrc”; see quality.Check. |
| npmToken | Secret | - | No description provided |
| nugetFeedUrl | String | - | No description provided |
| nugetToken | Secret | - | No description provided |
Example
dagger -m github.com/context-and-oss/cicd/src/quality@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
prepare --src DIR_PATH --cmd string --toolchain-image string --repo-url stringfunc (m *MyModule) Example(src *dagger.Directory, cmd string, toolchainImage string, repoUrl string) *dagger.Container {
return dag.
Quality().
Prepare(src, cmd, toolchainImage, repoUrl)
}@function
def example(src: dagger.Directory, cmd: str, toolchainimage: str, repourl: str) -> dagger.Container:
return (
dag.quality()
.prepare(src, cmd, toolchainimage, repourl)
)@func()
example(src: Directory, cmd: string, toolchainImage: string, repoUrl: string): Container {
return dag
.quality()
.prepare(src, cmd, toolchainImage, repoUrl)
}test() 🔗
Test runs consumer-owned test commands in resolved toolchain containers and returns witnessed test + coverage evidence (BYO test, ADR-002). The consumer owns the test definitions; cicd owns execution and attestation.
One leg per language: pass testLegs (a JSON array of legs, each with its own command, language, coverage report and optional image) for a polyglot repository, or testCmd for the single-command case. The two are mutually exclusive.
When a leg names a coverage report, it is harvested from that leg’s container after the run and its format sniffed (v8 json-summary, go coverprofile, pytest-cov JSON, cobertura XML). Legs sharing a language are combined by coverable-line weighting. When a baseline is supplied the coverage ratchet (ADR-003) compares measured against baseline coverage per language; missing inputs skip the ratchet fail-open, never red.
A language detected in the tree that no leg witnesses is named in warnings[]
and in the genericReport, and languages lists what was witnessed rather
than what was detected — a partially witnessed repository must never render
identically to a fully witnessed one. See testlegs.go for why that is a
warning and not a failure.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | Source directory to test. |
| testCmd | String | - | Single test command, run via |
| testLegs | String | - | Witnessed test legs as a JSON array — one object per leg, each with keys label, language (go|node|python|dotnet), cmd, and optionally coveragePath and toolchainImage. Supersedes testCmd / coveragePath / toolchainImage, which it carries per leg. Mutually exclusive with testCmd. |
| coveragePath | String | - | Path of the coverage report the test command writes — absolute, or relative to the source root. A filename pattern is accepted too (any of * ? [ makes it one), for a command that cannot be made to write a fixed name: Microsoft.Testing.Platform guid-names every test application’s report. The search descends from the pattern’s directory, duplicate documents are dropped, and the evidence states how many documents were merged. Applies to testCmd only; a leg names its own. |
| baseline | File | - | Baseline coverage document for the ratchet: a prior combined-evidence.json / evidence envelope, or a bare {“coverageByLanguage”: {…}} map (sniffed). |
| tolerance | Float ! | 1 | Allowed per-language coverage drop (percentage points) before the ratchet trips. |
| coverageGate | String ! | "gate" | Ratchet mode: “gate” fails the envelope on a tripped ratchet, “warn” only warns. |
| toolchainImage | String | - | Toolchain container image override — the only digest-pinnable level (ADR-004). Applies to testCmd only; a leg names its own. |
| include | [String ! ] | - | Languages to include: go, node, python, dotnet (repeatable, optional). |
| commitSha | String ! | - | Git commit SHA for evidence provenance. |
| branch | String ! | - | Git branch name for evidence provenance. |
| repoUrl | String ! | - | Repository URL for evidence provenance. |
| npmFeedUrl | String | - | Internal npm registry URL. When set with npmToken, the BYO test command can restore from a private npm feed. Mirrors quality.Check. |
| npmFeedRouting | String | - | “registry” (default) or “npmrc”; see quality.Check. |
| npmToken | Secret | - | Auth token for the internal npm registry (Dagger secret, never plaintext). |
| nugetFeedUrl | String | - | Internal NuGet feed URL. When set with nugetToken, the BYO test command can restore private NuGet packages. Mirrors quality.Check. |
| nugetToken | Secret | - | Auth token for the internal NuGet feed (Dagger secret, never plaintext). |
| appSource | Directory | - | Optional app source view for detection and scope accounting. Commands still run in src. Named coverage output is mandatory and freshly produced. |
| prepared | Container | - | Shared prepared container; only the selected test leg uses it. |
| preparedTestLabel | String | - | Label of the test leg sharing preparation; test-cmd for the single command. |
| preparedImage | String | - | Image used to produce prepared. Must agree with any explicit leg image. |
| preparedLanguage | String | - | No description provided |
| parallelism | Integer ! | 1 | Maximum test legs in flight at once, 1 to 4. 1 runs them one after another, as before this input existed. The evidence is folded in declaration order whatever order the legs finish in, so only the per-leg durations differ between a sequential and a concurrent run. |
Example
dagger -m github.com/context-and-oss/cicd/src/quality@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
test --src DIR_PATH --coverage-gate string --commit-sha string --branch string --repo-url string --parallelism integerfunc (m *MyModule) Example(src *dagger.Directory, tolerance , coverageGate string, commitSha string, branch string, repoUrl string, parallelism int) *dagger.File {
return dag.
Quality().
Test(src, tolerance, coverageGate, commitSha, branch, repoUrl, parallelism)
}@function
def example(src: dagger.Directory, tolerance: , coveragegate: str, commitsha: str, branch: str, repourl: str, parallelism: int) -> dagger.File:
return (
dag.quality()
.test(src, tolerance, coveragegate, commitsha, branch, repourl, parallelism)
)@func()
example(src: Directory, tolerance: , coverageGate: string, commitSha: string, branch: string, repoUrl: string, parallelism: number): File {
return dag
.quality()
.test(src, tolerance, coverageGate, commitSha, branch, repoUrl, parallelism)
}