Skip to content

security Submodule

Classes

Sops

Static Functions

Name Description
export_decrypted_values Returns a helper string that can be embedded into jobs to allow exporting values that are decrypted using sops, for example: 'export $(sops -d sops/encrypted_file.env)'.

export_decrypted_values
1
2
3
4
5
6
7
from gcix import security

security.Sops.export_decrypted_values(
  path: str,
  install_sops: bool = None,
  download_url: str = None
)

Returns a helper string that can be embedded into jobs to allow exporting values that are decrypted using sops, for example: 'export $(sops -d sops/encrypted_file.env)'.

This function is useful if you want to use environment variables to authenticate, for instance, with a container registry.

The script has been successfully tested with SOPS version 3.7 and is intentionally NOT COMPATIBLE with SOPS version 3.6. This is due to a bug in the latter version, which wraps the values to be exported in quotes.

pathRequired
  • Type: str

Path to the sops-encrypted file.

The path must be relative to the project directory.


install_sopsOptional
  • Type: bool

Enable downloading sops from the provided download_url.ue.


download_urlOptional
  • Type: str

Download URL to acquire sops from.

Defaults to the GitHub Mozilla SOPS releases.