Dagger
Search

generic-pipeline

This module contains functions that can be used in multiple pipelines

Installation

dagger install github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@v0.0.2

Entrypoint

Return Type
GenericPipeline
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
func (m *myModule) example() *GenericPipeline  {
	return dag.
			GenericPipeline()
}
@function
def example() -> dag.GenericPipeline:
	return (
		dag.generic_pipeline()
	)
@func()
example(): GenericPipeline {
	return dag
		.genericPipeline()
}

Types

GenericPipeline 🔗

lint() 🔗

Returns a file containing the results of the lint command

Return Type
File !
Arguments
NameTypeDefault ValueDescription
containerContainer !-Container to run the lint command
resultsString !-Path to file containing lint results
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 lint --container IMAGE:TAG --results string
func (m *myModule) example(container *Container, results string) *File  {
	return dag.
			GenericPipeline().
			Lint(container, results)
}
@function
def example(container: dagger.Container, results: str) -> dagger.File:
	return (
		dag.generic_pipeline()
		.lint(container, results)
	)
@func()
example(container: Container, results: string): File {
	return dag
		.genericPipeline()
		.lint(container, results)
}

test() 🔗

Returns a directory containing the results of the test command

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
containerContainer !-Container to run the test command
resultsString !-Path to directory containing test results
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 test --container IMAGE:TAG --results string
func (m *myModule) example(container *Container, results string) *Directory  {
	return dag.
			GenericPipeline().
			Test(container, results)
}
@function
def example(container: dagger.Container, results: str) -> dagger.Directory:
	return (
		dag.generic_pipeline()
		.test(container, results)
	)
@func()
example(container: Container, results: string): Directory {
	return dag
		.genericPipeline()
		.test(container, results)
}

sast() 🔗

Returns a file containing the results of the security scan

Return Type
File !
Arguments
NameTypeDefault ValueDescription
containerContainer !-Container to run the security scan
resultsString !-Path to file containing the results of the security scan
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 sast --container IMAGE:TAG --results string
func (m *myModule) example(container *Container, results string) *File  {
	return dag.
			GenericPipeline().
			Sast(container, results)
}
@function
def example(container: dagger.Container, results: str) -> dagger.File:
	return (
		dag.generic_pipeline()
		.sast(container, results)
	)
@func()
example(container: Container, results: string): File {
	return dag
		.genericPipeline()
		.sast(container, results)
}

build() 🔗

Returns a Container built from the Dockerfile in the provided Directory

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
dirDirectory !-No description provided
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 build --dir DIR_PATH
func (m *myModule) example(dir *Directory) *Container  {
	return dag.
			GenericPipeline().
			Build(dir)
}
@function
def example(dir: dagger.Directory) -> dagger.Container:
	return (
		dag.generic_pipeline()
		.build(dir)
	)
@func()
example(dir: Directory): Container {
	return dag
		.genericPipeline()
		.build(dir)
}

sbomBuild() 🔗

Builds the container and creates a SBOM for it

Return Type
File !
Arguments
NameTypeDefault ValueDescription
dirDirectory !-No description provided
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 sbom-build --dir DIR_PATH
func (m *myModule) example(dir *Directory) *File  {
	return dag.
			GenericPipeline().
			SbomBuild(dir)
}
@function
def example(dir: dagger.Directory) -> dagger.File:
	return (
		dag.generic_pipeline()
		.sbom_build(dir)
	)
@func()
example(dir: Directory): File {
	return dag
		.genericPipeline()
		.sbomBuild(dir)
}

sbom() 🔗

Creates a SBOM for the container

Return Type
File !
Arguments
NameTypeDefault ValueDescription
containerContainer !-No description provided
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 sbom --container IMAGE:TAG
func (m *myModule) example(container *Container) *File  {
	return dag.
			GenericPipeline().
			Sbom(container)
}
@function
def example(container: dagger.Container) -> dagger.File:
	return (
		dag.generic_pipeline()
		.sbom(container)
	)
@func()
example(container: Container): File {
	return dag
		.genericPipeline()
		.sbom(container)
}

vulnscan() 🔗

Scans the SBOM for vulnerabilities

Return Type
File !
Arguments
NameTypeDefault ValueDescription
sbomFile !-No description provided
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 vulnscan --sbom file:path
func (m *myModule) example(sbom *File) *File  {
	return dag.
			GenericPipeline().
			Vulnscan(sbom)
}
@function
def example(sbom: dagger.File) -> dagger.File:
	return (
		dag.generic_pipeline()
		.vulnscan(sbom)
	)
@func()
example(sbom: File): File {
	return dag
		.genericPipeline()
		.vulnscan(sbom)
}

publishToDeptrack() 🔗

Publish cyclonedx SBOM to Deptrack

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sbomFile !-SBOM file
addressString !-deptrack address for publishing the SBOM https://deptrack.example.com/api/v1/bom
apiKeySecret !-deptrack API key
projectUuidString !-deptrack project UUID
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 publish-to-deptrack --sbom file:path --address string --api-key env:MYSECRET --project-uuid string
func (m *myModule) example(ctx context.Context, sbom *File, address string, apiKey *Secret, projectUuid string) string  {
	return dag.
			GenericPipeline().
			PublishToDeptrack(ctx, sbom, address, apiKey, projectUuid)
}
@function
async def example(sbom: dagger.File, address: str, api_key: dagger.Secret, project_uuid: str) -> str:
	return await (
		dag.generic_pipeline()
		.publish_to_deptrack(sbom, address, api_key, project_uuid)
	)
@func()
async example(sbom: File, address: string, apiKey: Secret, projectUuid: string): Promise<string> {
	return dag
		.genericPipeline()
		.publishToDeptrack(sbom, address, apiKey, projectUuid)
}

publish() 🔗

Publish the provided Container to the provided registry

Return Type
String !
Arguments
NameTypeDefault ValueDescription
containerContainer !-Container to publish
registryAddressString !-Registry address to publish to - formatted as [host]/[user]/[repo]:[tag]
registryUsernameString ""Username of the registry's account
registryPasswordSecret -API key, password or token to authenticate to the registry
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 publish --container IMAGE:TAG --registry-address string
func (m *myModule) example(ctx context.Context, container *Container, registryAddress string) string  {
	return dag.
			GenericPipeline().
			Publish(ctx, container, registryAddress)
}
@function
async def example(container: dagger.Container, registry_address: str) -> str:
	return await (
		dag.generic_pipeline()
		.publish(container, registry_address)
	)
@func()
async example(container: Container, registryAddress: string): Promise<string> {
	return dag
		.genericPipeline()
		.publish(container, registryAddress)
}

sign() 🔗

Sign the published image using cosign (keyless)

Return Type
String !
Arguments
NameTypeDefault ValueDescription
registryUsernameString !-Username of the registry's account
registryPasswordSecret !-API key, password or token to authenticate to the registry
digestString !-Container image digest to sign
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 sign --registry-username string --registry-password env:MYSECRET --digest string
func (m *myModule) example(ctx context.Context, registryUsername string, registryPassword *Secret, digest string) string  {
	return dag.
			GenericPipeline().
			Sign(ctx, registryUsername, registryPassword, digest)
}
@function
async def example(registry_username: str, registry_password: dagger.Secret, digest: str) -> str:
	return await (
		dag.generic_pipeline()
		.sign(registry_username, registry_password, digest)
	)
@func()
async example(registryUsername: string, registryPassword: Secret, digest: string): Promise<string> {
	return dag
		.genericPipeline()
		.sign(registryUsername, registryPassword, digest)
}

attest() 🔗

Attests the SBOM using cosign (keyless)

Return Type
String !
Arguments
NameTypeDefault ValueDescription
registryUsernameString !-Username of the registry's account
registryPasswordSecret !-API key, password or token to authenticate to the registry
digestString !-Container image digest to attest
predicateFile !-SBOM file
sbomTypeString !-SBOM type
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 attest --registry-username string --registry-password env:MYSECRET --digest string --predicate file:path --sbom-type string
func (m *myModule) example(ctx context.Context, registryUsername string, registryPassword *Secret, digest string, predicate *File, sbomType string) string  {
	return dag.
			GenericPipeline().
			Attest(ctx, registryUsername, registryPassword, digest, predicate, sbomType)
}
@function
async def example(registry_username: str, registry_password: dagger.Secret, digest: str, predicate: dagger.File, sbom_type: str) -> str:
	return await (
		dag.generic_pipeline()
		.attest(registry_username, registry_password, digest, predicate, sbom_type)
	)
@func()
async example(registryUsername: string, registryPassword: Secret, digest: string, predicate: File, sbomType: string): Promise<string> {
	return dag
		.genericPipeline()
		.attest(registryUsername, registryPassword, digest, predicate, sbomType)
}

run() 🔗

Executes all the steps and returns a directory with the results

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
dirDirectory !-source directory
lintContainerContainer !-lint container
lintReportString !-lint report file name e.g. "lint.json"
sastContainerContainer !-sast container
sastReportString !-security scan report file name e.g. "/app/brakeman-output.tabs"
testContainerContainer !-test container
testReportDirString !-test report folder name e.g. "/mnt/test/reports"
registryUsernameString !-registry username for publishing the container image
registryPasswordSecret !-registry password for publishing the container image
registryAddressString !-registry address registry/repository/image:tag
dtAddressString !-deptrack address for publishing the SBOM https://deptrack.example.com/api/v1/bom
dtProjectUuidString !-deptrack project UUID
dtApiKeySecret !-deptrack API key
passBoolean falseignore linter failures
Example
dagger -m github.com/puzzle/dagger-module-generic-pipeline/generic-pipeline@c40994d5ea027a0060c00f533fd9f44e61c831fa call \
 run --dir DIR_PATH --lint-container IMAGE:TAG --lint-report string --sast-container IMAGE:TAG --sast-report string --test-container IMAGE:TAG --test-report-dir string --registry-username string --registry-password env:MYSECRET --registry-address string --dt-address string --dt-project-uuid string --dt-api-key env:MYSECRET
func (m *myModule) example(dir *Directory, lintContainer *Container, lintReport string, sastContainer *Container, sastReport string, testContainer *Container, testReportDir string, registryUsername string, registryPassword *Secret, registryAddress string, dtAddress string, dtProjectUuid string, dtApiKey *Secret) *Directory  {
	return dag.
			GenericPipeline().
			Run(dir, lintContainer, lintReport, sastContainer, sastReport, testContainer, testReportDir, registryUsername, registryPassword, registryAddress, dtAddress, dtProjectUuid, dtApiKey)
}
@function
def example(dir: dagger.Directory, lint_container: dagger.Container, lint_report: str, sast_container: dagger.Container, sast_report: str, test_container: dagger.Container, test_report_dir: str, registry_username: str, registry_password: dagger.Secret, registry_address: str, dt_address: str, dt_project_uuid: str, dt_api_key: dagger.Secret) -> dagger.Directory:
	return (
		dag.generic_pipeline()
		.run(dir, lint_container, lint_report, sast_container, sast_report, test_container, test_report_dir, registry_username, registry_password, registry_address, dt_address, dt_project_uuid, dt_api_key)
	)
@func()
example(dir: Directory, lintContainer: Container, lintReport: string, sastContainer: Container, sastReport: string, testContainer: Container, testReportDir: string, registryUsername: string, registryPassword: Secret, registryAddress: string, dtAddress: string, dtProjectUuid: string, dtApiKey: Secret): Directory {
	return dag
		.genericPipeline()
		.run(dir, lintContainer, lintReport, sastContainer, sastReport, testContainer, testReportDir, registryUsername, registryPassword, registryAddress, dtAddress, dtProjectUuid, dtApiKey)
}