Documentation ¶
Index ¶
Constants ¶
const ( // CondaEnvLayer is the name of the layer into which conda environment is installed. CondaEnvLayer = "conda-env" // CondaEnvCache is the name of the layer that is used as the conda package directory. CondaEnvCache = "conda-env-cache" // CondaEnvPlanEntry is the name of the Build Plan requirement that this buildpack provides. CondaEnvPlanEntry = "conda-environment" // CondaPlanEntry is the name of the Build Plan requirement for the miniconda // dependency that this buildpack requires. CondaPlanEntry = "conda" // LockfileShaName is the key in the Layer Content Metadata used to determine if layer // can be reused. LockfileShaName = "lockfile-sha" // LockfileName is the name of the export file from which the buildpack reinstalls packages // See https://docs.conda.io/projects/conda/en/latest/commands/list.html LockfileName = "package-list.txt" // EnvironmentFileName is the name of the conda environment file. EnvironmentFileName = "environment.yml" )
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(runner Runner, sbomGenerator SBOMGenerator, logger scribe.Emitter, clock chronos.Clock) packit.BuildFunc
Build will return a packit.BuildFunc that will be invoked during the build phase of the buildpack lifecycle.
Build updates the conda environment and stores the result in a layer. It may reuse the environment layer from a previous build, depending on conditions determined by the runner.
func Detect ¶
func Detect() packit.DetectFunc
Detect returns a packit.DetectFunc that will be invoked during the detect phase of the buildpack lifecycle.
Detection passes when there is an environment.yml or package-list.txt file in the app directory, and will contribute a Build Plan that provides conda-environment and requires conda.
Types ¶
type CondaRunner ¶
type CondaRunner struct {
// contains filtered or unexported fields
}
CondaRunner implements the Runner interface.
func NewCondaRunner ¶
func NewCondaRunner(executable Executable, summer Summer, logger scribe.Emitter) CondaRunner
NewCondaRunner creates an instance of CondaRunner given an Executable, a Summer, and a Logger.
func (CondaRunner) Execute ¶
func (c CondaRunner) Execute(condaLayerPath string, condaCachePath string, workingDir string) error
Execute runs the conda environment setup command and cleans up unnecessary artifacts. If a vendor directory is present, it uses vendored packages and installs them in offline mode. If a packages-list.txt file is present, it creates a new environment based on the packages list. Otherwise, it updates the existing packages to their latest versions.
For more information about the commands used, see: https://docs.conda.io/projects/conda/en/latest/commands/create.html https://docs.conda.io/projects/conda/en/latest/commands/update.html https://docs.conda.io/projects/conda/en/latest/commands/clean.html
func (CondaRunner) ShouldRun ¶
func (c CondaRunner) ShouldRun(workingDir string, metadata map[string]interface{}) (run bool, sha string, err error)
ShouldRun determines whether the conda environment setup command needs to be run, given the path to the app directory and the metadata from the preexisting conda-env layer. It returns true if the conda environment setup command must be run during this build, the SHA256 of the package-list.txt in the app directory, and an error. If there is no package-list.txt, the sha returned is an empty string.
type Executable ¶
Executable defines the interface for invoking an executable.
type Runner ¶
type Runner interface { Execute(condaEnvPath string, condaCachePath string, workingDir string) error ShouldRun(workingDir string, metadata map[string]interface{}) (bool, string, error) }
Runner defines the interface for setting up the conda environment.