Dagger
Search

build

No long description provided.

Installation

dagger install github.com/context-and-oss/cicd/src/build@v5.1.5

Entrypoint

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
NameTypeDefault ValueDescription
payloadFile !-No description provided
evidenceFile !-No description provided
kindString !-No description provided
nameString !-No description provided
commitShaString !-No description provided
branchString !-No description provided
repoUrlString !-No description provided
runUrlString -No description provided
appIdString -No description provided
toolchainImageString -No description provided
platformString -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 string
func (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
NameTypeDefault ValueDescription
srcDirectory !-

Source directory (must contain a Dockerfile).

dockerfileString !"Dockerfile"

Path to Dockerfile relative to src.

platformString !"linux/amd64"

Target platform.

commitShaString !-

Git commit SHA — used to label the image.

branchString !-

Git branch name.

repoUrlString !-

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 string
func (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
NameTypeDefault ValueDescription
srcDirectory !-

Source directory to build.

buildCmdString !-

Build command, run via sh -c in the toolchain container (always explicit, never auto-detected).

outputPathString !-

Path of the build output directory, relative to the source root (e.g. “dist”).

toolchainImageString -

Toolchain container image override — the only digest-pinnable level (ADR-004).

commitShaString !-

Git commit SHA — kept for signature symmetry with Build.

branchString !-

Git branch name.

repoUrlString !-

Repository URL.

preparedContainer -

Shared preparation/build state. Packaging runs in an immutable branch.

npmFeedUrlString -No description provided
npmFeedRoutingString -

“registry” (default) or “npmrc”; see quality.Check.

npmTokenSecret -No description provided
nugetFeedUrlString -No description provided
nugetTokenSecret -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 string
func (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
NameTypeDefault ValueDescription
outputDirDirectory !-No description provided
Example
dagger -m github.com/context-and-oss/cicd/src/build@e510ca0bff49e501bdb77cbdb6b12eb0bf10c447 call \
 bundle --output-dir DIR_PATH
func (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
NameTypeDefault ValueDescription
commitShaString !-

Git commit SHA for evidence provenance.

branchString !-

Git branch name.

repoUrlString !-

Repository URL.

sbomDisabledBoolean -

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 string
func (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
NameTypeDefault ValueDescription
imageContainer !-

Built container image to analyse.

commitShaString !-

Git commit SHA for evidence provenance.

branchString !-

Git branch name.

repoUrlString !-

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 string
func (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)
}