Dagger
Search

cosign

Cosign container image signing in a Dagger module

Installation

dagger install github.com/puzzle/dagger-module-cosign/cosign@v0.0.1

Entrypoint

Return Type
Cosign
Example
dagger -m github.com/puzzle/dagger-module-cosign/cosign@4f0527563a74ba7f6c796972f1bedd26afc26030 call \
func (m *myModule) example() *Cosign  {
	return dag.
			Cosign()
}
@function
def example() -> dag.Cosign:
	return (
		dag.cosign()
	)
@func()
example(): Cosign {
	return dag
		.cosign()
}

Types

Cosign 🔗

Cosign represents the cosign Dagger module type

sign() 🔗

Sign will run cosign from the image, as defined by the cosignImage parameter, to sign the given Container image digests

Note: keyless signing not supported as-is

See https://edu.chainguard.dev/open-source/sigstore/cosign/an-introduction-to-cosign/

Return Type
String !
Arguments
NameTypeDefault ValueDescription
privateKeySecret !-Cosign private key
passwordSecret !-Cosign password
registryUsernameString -registry username
registryPasswordSecret -name of the image
dockerConfigFile -Docker config
cosignImageString "chainguard/cosign:latest"Cosign container image
cosignUserString "nonroot"Cosign container image user
digestString !-Container image digest to sign
Example
dagger -m github.com/puzzle/dagger-module-cosign/cosign@4f0527563a74ba7f6c796972f1bedd26afc26030 call \
 sign --private-key env:MYSECRET --password env:MYSECRET --digest string
func (m *myModule) example(ctx context.Context, privateKey *Secret, password *Secret, digest string) string  {
	return dag.
			Cosign().
			Sign(ctx, privateKey, password, digest)
}
@function
async def example(private_key: dagger.Secret, password: dagger.Secret, digest: str) -> str:
	return await (
		dag.cosign()
		.sign(private_key, password, digest)
	)
@func()
async example(privateKey: Secret, password: Secret, digest: string): Promise<string> {
	return dag
		.cosign()
		.sign(privateKey, password, digest)
}

attest() 🔗

Attest will run cosign from the image, as defined by the cosignImage parameter, to attest the SBOM of the given Container image digest

Note: keyless signing not supported as-is

See https://edu.chainguard.dev/open-source/sigstore/cosign/how-to-sign-an-sbom-with-cosign/

Return Type
String !
Arguments
NameTypeDefault ValueDescription
privateKeySecret !-Cosign private key
passwordSecret !-Cosign password
registryUsernameString -registry username
registryPasswordSecret -name of the image
dockerConfigFile -Docker config
cosignImageString "chainguard/cosign:latest"Cosign container image
cosignUserString "nonroot"Cosign container image user
digestString !-Container image digest to attest
sbomFileFile !-SBOM file
sbomTypeString "spdxjson"SBOM type
Example
dagger -m github.com/puzzle/dagger-module-cosign/cosign@4f0527563a74ba7f6c796972f1bedd26afc26030 call \
 attest --private-key env:MYSECRET --password env:MYSECRET --digest string --sbom-file file:path
func (m *myModule) example(ctx context.Context, privateKey *Secret, password *Secret, digest string, sbomFile *File) string  {
	return dag.
			Cosign().
			Attest(ctx, privateKey, password, digest, sbomFile)
}
@function
async def example(private_key: dagger.Secret, password: dagger.Secret, digest: str, sbom_file: dagger.File) -> str:
	return await (
		dag.cosign()
		.attest(private_key, password, digest, sbom_file)
	)
@func()
async example(privateKey: Secret, password: Secret, digest: string, sbomFile: File): Promise<string> {
	return dag
		.cosign()
		.attest(privateKey, password, digest, sbomFile)
}