build
No long description provided.
Installation
dagger install github.com/context-and-oss/cicd/src/build@v5.1.5Entrypoint
Return Type
Build Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
func (m *MyModule) Example() *dagger.Build {
return dag.
Build()
}@function
def example() -> dagger.Build:
return (
dag.build()
)@func()
example(): Build {
return dag
.build()
}Types
Build 🔗
Build is the Dagger module that produces the deployable: an OCI image from a Dockerfile (Build), a CycloneDX SBOM of it (Sbom), a built archive from a consumer command (BuildArchive), or the attested absence of one (NoArtifact); Bundle and ArtifactManifest bind an archive output to its evidence. It never publishes what it builds (ADR-001). moduleName and moduleStage live in noartifact.go, which is untagged, so the -tags unit_test suite can build an envelope with the identity that ships.
artifactManifest() 🔗
ArtifactManifest binds exact transport bytes to exact combined evidence. An OCI tar checksum is a transport identity, not a registry manifest digest.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| payload | File ! | - | No description provided |
| evidence | File ! | - | No description provided |
| kind | String ! | - | No description provided |
| name | String ! | - | No description provided |
| commitSha | String ! | - | No description provided |
| branch | String ! | - | No description provided |
| repoUrl | String ! | - | No description provided |
| runUrl | String | - | No description provided |
| appId | String | - | No description provided |
| toolchainImage | String | - | No description provided |
| platform | String | - | No description provided |
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
artifact-manifest --payload file:path --evidence file:path --kind string --name string --commit-sha string --branch string --repo-url stringfunc (m *MyModule) Example(payload *dagger.File, evidence *dagger.File, kind string, name string, commitSha string, branch string, repoUrl string) *dagger.File {
return dag.
Build().
Artifactmanifest(payload, evidence, kind, name, commitSha, branch, repoUrl)
}@function
def example(payload: dagger.File, evidence: dagger.File, kind: str, name: str, commitsha: str, branch: str, repourl: str) -> dagger.File:
return (
dag.build()
.artifactmanifest(payload, evidence, kind, name, commitsha, branch, repourl)
)@func()
example(payload: File, evidence: File, kind: string, name: string, commitSha: string, branch: string, repoUrl: string): File {
return dag
.build()
.artifactManifest(payload, evidence, kind, name, commitSha, branch, repoUrl)
}build() 🔗
Build builds a container image from a Dockerfile and returns the built container. The returned container can be passed directly to Sbom or security.ScanImage.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | Source directory (must contain a Dockerfile). |
| dockerfile | String ! | "Dockerfile" | Path to Dockerfile relative to src. |
| platform | String ! | "linux/amd64" | Target platform. |
| commitSha | String ! | - | Git commit SHA — used to label the image. |
| branch | String ! | - | Git branch name. |
| repoUrl | String ! | - | Repository URL. |
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
build --src DIR_PATH --dockerfile string --platform string --commit-sha string --branch string --repo-url stringfunc (m *MyModule) Example(src *dagger.Directory, dockerfile string, platform string, commitSha string, branch string, repoUrl string) *dagger.Container {
return dag.
Build().
Build(src, dockerfile, platform, commitSha, branch, repoUrl)
}@function
def example(src: dagger.Directory, dockerfile: str, platform: str, commitsha: str, branch: str, repourl: str) -> dagger.Container:
return (
dag.build()
.build(src, dockerfile, platform, commitsha, branch, repourl)
)@func()
example(src: Directory, dockerfile: string, platform: string, commitSha: string, branch: string, repoUrl: string): Container {
return dag
.build()
.build(src, dockerfile, platform, commitSha, branch, repoUrl)
}buildArchive() 🔗
BuildArchive runs a consumer-owned build command in a resolved toolchain container and returns the built artifact directory (the “archive” shape — a vite dist/, a dotnet publish output, a Dataverse solution folder).
The toolchain image follows the ADR-004 precedence: explicit param >
version-file detection (.nvmrc, global.json) > pinned per-language default.
The build command runs via sh -c with src mounted at /src and workdir /src.
Unlike Build, no OCI labels are stamped — directories carry none. The commitSha/branch/repoUrl params are kept for signature symmetry with Build; provenance for archives rides in evidence envelopes downstream.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | Source directory to build. |
| buildCmd | String ! | - | Build command, run via |
| outputPath | String ! | - | Path of the build output directory, relative to the source root (e.g. “dist”). |
| toolchainImage | String | - | Toolchain container image override — the only digest-pinnable level (ADR-004). |
| commitSha | String ! | - | Git commit SHA — kept for signature symmetry with Build. |
| branch | String ! | - | Git branch name. |
| repoUrl | String ! | - | Repository URL. |
| prepared | Container | - | Shared preparation/build state. Packaging runs in an immutable branch. |
| 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/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
build-archive --src DIR_PATH --build-cmd string --output-path string --commit-sha string --branch string --repo-url stringfunc (m *MyModule) Example(src *dagger.Directory, buildCmd string, outputPath string, commitSha string, branch string, repoUrl string) *dagger.Directory {
return dag.
Build().
Buildarchive(src, buildCmd, outputPath, commitSha, branch, repoUrl)
}@function
def example(src: dagger.Directory, buildcmd: str, outputpath: str, commitsha: str, branch: str, repourl: str) -> dagger.Directory:
return (
dag.build()
.buildarchive(src, buildcmd, outputpath, commitsha, branch, repourl)
)@func()
example(src: Directory, buildCmd: string, outputPath: string, commitSha: string, branch: string, repoUrl: string): Directory {
return dag
.build()
.buildArchive(src, buildCmd, outputPath, commitSha, branch, repoUrl)
}bundle() 🔗
Bundle retains an archive-shaped output, including dotfiles, symlinks and executable modes. No build command runs during this transport operation.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| outputDir | Directory ! | - | No description provided |
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
bundle --output-dir DIR_PATHfunc (m *MyModule) Example(outputDir *dagger.Directory) *dagger.File {
return dag.
Build().
Bundle(outputDir)
}@function
def example(outputdir: dagger.Directory) -> dagger.File:
return (
dag.build()
.bundle(outputdir)
)@func()
example(outputDir: Directory): File {
return dag
.build()
.bundle(outputDir)
}noArtifact() 🔗
NoArtifact returns the evidence envelope for a pipeline run that built and
attested no artifact — the record behind --artifact none.
It is the only function in this module that runs no tool, and that is the
point: an artifact tail that did not run leaves an audit indistinguishable
from an artifact tail that ran and found nothing, so the run says so instead.
The envelope passes (a repository with no deployable artifact is legitimate)
and carries the disclosure in warnings, which notify renders verbatim into
the PR comment, plus genericReport.artifactAttested: false for machines.
The wording and the reasoning live in noartifact.go.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| commitSha | String ! | - | Git commit SHA for evidence provenance. |
| branch | String ! | - | Git branch name. |
| repoUrl | String ! | - | Repository URL. |
| sbomDisabled | Boolean | - | Application mode has deferred dependency assessment and emits no SBOM. |
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
no-artifact --commit-sha string --branch string --repo-url stringfunc (m *MyModule) Example(commitSha string, branch string, repoUrl string) *dagger.File {
return dag.
Build().
Noartifact(commitSha, branch, repoUrl)
}@function
def example(commitsha: str, branch: str, repourl: str) -> dagger.File:
return (
dag.build()
.noartifact(commitsha, branch, repourl)
)@func()
example(commitSha: string, branch: string, repoUrl: string): File {
return dag
.build()
.noArtifact(commitSha, branch, repoUrl)
}sbom() 🔗
Sbom generates a CycloneDX SBOM from a container image using Trivy. Returns an evidence envelope containing the CycloneDX JSON report.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| image | Container ! | - | Built container image to analyse. |
| commitSha | String ! | - | Git commit SHA for evidence provenance. |
| branch | String ! | - | Git branch name. |
| repoUrl | String ! | - | Repository URL. |
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
sbom --image IMAGE:TAG --commit-sha string --branch string --repo-url stringfunc (m *MyModule) Example(image *dagger.Container, commitSha string, branch string, repoUrl string) *dagger.File {
return dag.
Build().
Sbom(image, commitSha, branch, repoUrl)
}@function
def example(image: dagger.Container, commitsha: str, branch: str, repourl: str) -> dagger.File:
return (
dag.build()
.sbom(image, commitsha, branch, repourl)
)@func()
example(image: Container, commitSha: string, branch: string, repoUrl: string): File {
return dag
.build()
.sbom(image, commitSha, branch, repoUrl)
}