Dagger
Search

chainloop

Chainloop is an open source project that allows you to collect, attest, and distribute pieces of evidence from your Software Supply Chain.

Installation

dagger install github.com/chainloop-dev/chainloop@7581865775f5d3020cd3564c99244e83262de088

Entrypoint

Return Type
Chainloop
Example
func (m *myModule) example() *Chainloop  {
	return dag.
			Chainloop()
}

Types

Chainloop 🔗

init() 🔗

Initialize a new attestation

Return Type
Attestation !
Arguments
NameTypeDefault ValueDescription
tokenSecret !-Chainloop API token
contractRevisionString -Workflow Contract revision, default is the latest
repositoryDirectory -Path to the source repository to be attested
workflowNameString !-Workflow name to be used for the attestation
projectNameString !-Project name to be used for the attestation
contractNameString -name of an existing contract to attach it to the auto-created workflow
projectVersionString -Version of the project to be used for the attestation
releaseBoolean -mark the version as release
Example
func (m *myModule) example(token *Secret, workflowName string, projectName string) *ChainloopAttestation  {
	return dag.
			Chainloop().
			Init(token, workflowName, projectName)
}

resume() 🔗

Resume an attestation from its identifier

Return Type
Attestation !
Arguments
NameTypeDefault ValueDescription
attestationIdString !-The attestation ID
tokenSecret !-Chainloop API token
Example
func (m *myModule) example(attestationId string, token *Secret) *ChainloopAttestation  {
	return dag.
			Chainloop().
			Resume(attestationId, token)
}

withInstance() 🔗

Configure the Chainloop instance to use

Return Type
Chainloop !
Arguments
NameTypeDefault ValueDescription
controlplaneApiString !-Example: "api.controlplane.company.com:443"
casApiString !-Example: "api.cas.company.com:443"
casCaFile -Path to custom CA certificate for the CAS API
controlplaneCaFile -Path to custom CA certificate for the Control Plane API
insecureBoolean -Whether to skip TLS verification
Example
func (m *myModule) example(controlplaneApi string, casApi string) *Chainloop  {
	return dag.
			Chainloop().
			WithInstance(controlplaneApi, casApi)
}

workflowCreate() 🔗

Create a new workflow

Return Type
String !
Arguments
NameTypeDefault ValueDescription
tokenSecret !-Chainloop API token
nameString !-Workflow name
projectString !-Workflow project
teamString -No description provided
descriptionString -No description provided
contractNameString -name of an existing contract
publicBoolean -Set workflow as public so other organizations can see it
skipIfExistsBoolean -If the workflow already exists, skip the creation and return success
Example
func (m *myModule) example(ctx context.Context, token *Secret, name string, project string) string  {
	return dag.
			Chainloop().
			WorkflowCreate(ctx, token, name, project)
}

Attestation 🔗

A Chainloop attestation https://docs.chainloop.dev/how-does-it-work/#contract-based-attestation

attestationId() 🔗

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret) string  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			AttestationId(ctx)
}

client() 🔗

Return Type
Chainloop !
Example
func (m *myModule) example(attestationId string, token *Secret) *Chainloop  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Client()
}

status() 🔗

Check the attestation status

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret) string  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Status(ctx)
}

sync() 🔗

Sync will force the client to send an actual query to the chainloop control plane This is specially important to be run right after Init for example

att := chainloop.Init(ctx, token, "main")

if err := att.Sync(ctx); err != nil {
	return nil, err
}
Return Type
Void !
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret)   {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Sync(ctx)
}

withRegistryAuth() 🔗

Attach credentials for a container registry. Chainloop will use them to query the registry for container image pieces of evidences

Return Type
Attestation !
Arguments
NameTypeDefault ValueDescription
addressString !-Registry address. Example: "index.docker.io"
usernameString !-Registry username
passwordSecret !-Registry password
Example
func (m *myModule) example(attestationId string, token *Secret, address string, username string, password *Secret) *ChainloopAttestation  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			WithRegistryAuth(address, username, password)
}

addRawEvidence() 🔗

Add a raw string piece of evidence to the attestation

Return Type
Attestation !
Arguments
NameTypeDefault ValueDescription
nameString -Evidence name. Don't pass a name if the material being attested is not part of the contract Example: "my-blob"
valueString !-The contents of the blob
Example
func (m *myModule) example(attestationId string, token *Secret, value string) *ChainloopAttestation  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			AddRawEvidence(value)
}

addFileEvidence() 🔗

Add a file type piece of evidence to the attestation

Return Type
Attestation !
Arguments
NameTypeDefault ValueDescription
nameString -Evidence name. Don't pass a name if the material being attested is not part of the contract Example: "my-binary"
pathFile !-The file to add
Example
func (m *myModule) example(attestationId string, token *Secret, path *File) *ChainloopAttestation  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			AddFileEvidence(path)
}

debug() 🔗

Return Type
Container !
Example
func (m *myModule) example(attestationId string, token *Secret) *Container  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Debug()
}

container() 🔗

Build an ephemeral container with everything needed to process the attestation

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
ttlInteger 0Cache TTL for chainloop commands, in seconds Defaults to 0: no caching
Example
func (m *myModule) example(attestationId string, token *Secret) *Container  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Container()
}

push() 🔗

Generate, sign and push the attestation to the chainloop control plane

Return Type
String !
Arguments
NameTypeDefault ValueDescription
keySecret -The private key to sign the attestation
passphraseSecret -The passphrase to decrypt the private key
exceptionBypassPolicyCheckBoolean -Whether not fail if the policy check fails
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret) string  {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			Push(ctx)
}

markFailed() 🔗

Mark the attestation as failed

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
reasonString -The reason for canceling, in human-readable form
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret)   {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			MarkFailed(ctx)
}

markCanceled() 🔗

Mark the attestation as canceled

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
reasonString -The reason for canceling, in human-readable form
Example
func (m *myModule) example(ctx context.Context, attestationId string, token *Secret)   {
	return dag.
			Chainloop().
			Resume(attestationId, token).
			MarkCanceled(ctx)
}