Dagger
Search

sops

This module provides functionality for working with [Mozilla SOPS](https://github.com/getsops/sops)
in a Dagger pipeline. It supports generating AGE keys, encrypting and decrypting files.
Files are mounted into a container and processed using the `sops` CLI tool.

Functions:
- GenerateAgeKey: Generates a new AGE key pair
- GenerateSopsConfig: Generates a .sops.yaml configuration file
- Encrypt: Encrypts a plaintext file using SOPS with an AGE key
- Decrypt: Decrypts a SOPS-encrypted file and returns the decrypted file

Installation

dagger install github.com/stuttgart-things/dagger/sops@v0.75.0

Entrypoint

Return Type
Sops
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
func (m *MyModule) Example() *dagger.Sops  {
	return dag.
			Sops()
}
@function
def example() -> dagger.Sops:
	return (
		dag.sops()
	)
@func()
example(): Sops {
	return dag
		.sops()
}

Types

Sops 🔗

baseImage() 🔗

Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
 base-image
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Sops().
			BaseImage(ctx)
}
@function
async def example() -> str:
	return await (
		dag.sops()
		.base_image()
	)
@func()
async example(): Promise<string> {
	return dag
		.sops()
		.baseImage()
}

generateAgeKey() 🔗

GenerateAgeKey generates a new AGE key pair using age-keygen. Returns the key file containing both the public key (in a comment) and the private key.

Return Type
File !
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
 generate-age-key
func (m *MyModule) Example() *dagger.File  {
	return dag.
			Sops().
			GenerateAgeKey()
}
@function
def example() -> dagger.File:
	return (
		dag.sops()
		.generate_age_key()
	)
@func()
example(): File {
	return dag
		.sops()
		.generateAgeKey()
}

generateSopsConfig() 🔗

GenerateSopsConfig generates a .sops.yaml configuration file with creation rules for the given AGE key. The fileExtensions parameter accepts a comma-separated list of extensions (e.g., “yaml,json,env”). If not provided, defaults to “yaml,json”.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
agePublicKeyString !-No description provided
fileExtensionsString -No description provided
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
 generate-sops-config --age-public-key string
func (m *MyModule) Example(agePublicKey string) *dagger.File  {
	return dag.
			Sops().
			GenerateSopsConfig(agePublicKey)
}
@function
def example(age_public_key: str) -> dagger.File:
	return (
		dag.sops()
		.generate_sops_config(age_public_key)
	)
@func()
example(agePublicKey: string): File {
	return dag
		.sops()
		.generateSopsConfig(agePublicKey)
}

encrypt() 🔗

Return Type
File !
Arguments
NameTypeDefault ValueDescription
ageKeySecret !-No description provided
plaintextFileFile !-No description provided
fileExtensionString "yaml"e.g., "yaml", "json", "env"
sopsConfigFile -~/.sops.yaml config file
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
 encrypt --age-key env:MYSECRET --plaintext-file file:path
func (m *MyModule) Example(ageKey *dagger.Secret, plaintextFile *dagger.File) *dagger.File  {
	return dag.
			Sops().
			Encrypt(ageKey, plaintextFile)
}
@function
def example(age_key: dagger.Secret, plaintext_file: dagger.File) -> dagger.File:
	return (
		dag.sops()
		.encrypt(age_key, plaintext_file)
	)
@func()
example(ageKey: Secret, plaintextFile: File): File {
	return dag
		.sops()
		.encrypt(ageKey, plaintextFile)
}

decrypt() 🔗

Decrypt decrypts a SOPS-encrypted file using an AGE key. Returns the decrypted file.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
ageKeySecret !-No description provided
encryptedFileFile !-No description provided
sopsConfigFile -~/.sops.yaml config file
Example
dagger -m github.com/stuttgart-things/dagger/sops@1d5b83e0a4ddb02acff6698a2a54204faf818a9f call \
 decrypt --age-key env:MYSECRET --encrypted-file file:path
func (m *MyModule) Example(ageKey *dagger.Secret, encryptedFile *dagger.File) *dagger.File  {
	return dag.
			Sops().
			Decrypt(ageKey, encryptedFile)
}
@function
def example(age_key: dagger.Secret, encrypted_file: dagger.File) -> dagger.File:
	return (
		dag.sops()
		.decrypt(age_key, encrypted_file)
	)
@func()
example(ageKey: Secret, encryptedFile: File): File {
	return dag
		.sops()
		.decrypt(ageKey, encryptedFile)
}