{"modulePath":"github.com/coder/envbuilder","version":"v1.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package options\n\n## Functions\n\n```go\nfunc DefaultWorkspaceFolder(workspacesFolder, repoURL string) string\n```\nDefaultWorkspaceFolder returns the default workspace folder for a given repository URL.\n\n```go\nfunc UnsetEnv()\n```\nUnsetEnv unsets all environment variables that are used to configure the options.\n\n```go\nfunc WithEnvPrefix(str string) string\n```\n\n## Types\n\n```go\ntype Options struct {\n\t// SetupScript is the script to run before the init script. It runs as the\n\t// root user regardless of the user specified in the devcontainer.json file.\n\t// SetupScript is ran as the root user prior to the init script. It is used to\n\t// configure envbuilder dynamically during the runtime. e.g. specifying\n\t// whether to start systemd or tiny init for PID 1.\n\tSetupScript string\n\t// InitScript is the script to run to initialize the workspace.\n\tInitScript string\n\t// InitCommand is the command to run to initialize the workspace.\n\tInitCommand string\n\t// InitArgs are the arguments to pass to the init command. They are split\n\t// according to /bin/sh rules with https://github.com/kballard/go-shellquote.\n\tInitArgs string\n\t// CacheRepo is the name of the container registry to push the cache image to.\n\t// If this is empty, the cache will not be pushed.\n\tCacheRepo string\n\t// BaseImageCacheDir is the path to a directory where the base image can be\n\t// found. This should be a read-only directory solely mounted for the purpose\n\t// of caching the base image.\n\tBaseImageCacheDir string\n\t// LayerCacheDir is the path to a directory where built layers will be stored.\n\t// This spawns an in-memory registry to serve the layers from.\n\tLayerCacheDir string\n\t// DevcontainerDir is the path to the folder containing the devcontainer.json\n\t// file that will be used to build the workspace and can either be an absolute\n\t// path or a path relative to the workspace folder. If not provided, defaults\n\t// to `.devcontainer`.\n\tDevcontainerDir string\n\t// DevcontainerJSONPath is a path to a devcontainer.json file\n\t// that is either an absolute path or a path relative to\n\t// DevcontainerDir. This can be used in cases where one wants\n\t// to substitute an edited devcontainer.json file for the one\n\t// that exists in the repo.\n\t// If neither `DevcontainerDir` nor `DevcontainerJSONPath` is provided,\n\t// envbuilder will browse following directories to locate it:\n\t// 1. `.devcontainer/devcontainer.json`\n\t// 2. `.devcontainer.json`\n\t// 3. `.devcontainer/\u003cfolder\u003e/devcontainer.json`\n\tDevcontainerJSONPath string\n\t// DockerfilePath is the relative path to the Dockerfile that will be used to\n\t// build the workspace. This is an alternative to using a devcontainer that\n\t// some might find simpler.\n\tDockerfilePath string\n\t// BuildContextPath can be specified when a DockerfilePath is specified\n\t// outside the base WorkspaceFolder. This path MUST be relative to the\n\t// WorkspaceFolder path into which the repo is cloned.\n\tBuildContextPath string\n\t// CacheTTLDays is the number of days to use cached layers before expiring\n\t// them. Defaults to 7 days.\n\tCacheTTLDays int64\n\t// DockerConfigBase64 is the base64 encoded Docker config file that will be\n\t// used to pull images from private container registries.\n\tDockerConfigBase64 string\n\t// FallbackImage specifies an alternative image to use when neither an image\n\t// is declared in the devcontainer.json file nor a Dockerfile is present. If\n\t// there's a build failure (from a faulty Dockerfile) or a misconfiguration,\n\t// this image will be the substitute. Set ExitOnBuildFailure to true to halt\n\t// the container if the build faces an issue.\n\tFallbackImage string\n\t// ExitOnBuildFailure terminates the container upon a build failure. This is\n\t// handy when preferring the FALLBACK_IMAGE in cases where no\n\t// devcontainer.json or image is provided. However, it ensures that the\n\t// container stops if the build process encounters an error.\n\tExitOnBuildFailure bool\n\t// ExitOnPushFailure terminates the container upon a push failure. This is\n\t// useful if failure to push the built image should abort execution\n\t// and result in an error.\n\tExitOnPushFailure bool\n\t// ForceSafe ignores any filesystem safety checks. This could cause serious\n\t// harm to your system! This is used in cases where bypass is needed to\n\t// unblock customers.\n\tForceSafe bool\n\t// Insecure bypasses TLS verification when cloning and pulling from container\n\t// registries.\n\tInsecure bool\n\t// IgnorePaths is the comma separated list of paths to ignore when building\n\t// the workspace.\n\tIgnorePaths []string\n\t// BuildSecrets is the list of secret environment variables to use when\n\t// building the image.\n\tBuildSecrets []string\n\t// SkipRebuild skips building if the MagicFile exists. This is used to skip\n\t// building when a container is restarting. e.g. docker stop -\u003e docker start\n\t// This value can always be set to true - even if the container is being\n\t// started for the first time.\n\tSkipRebuild bool\n\t// GitURL is the URL of the Git repository to clone. This is optional.\n\tGitURL string\n\t// GitCloneDepth is the depth to use when cloning the Git repository.\n\tGitCloneDepth int64\n\t// GitCloneSingleBranch clone only a single branch of the Git repository.\n\tGitCloneSingleBranch bool\n\t// GitCloneThinPack clone with thin pack compabilities. This is optional.\n\tGitCloneThinPack bool\n\t// GitUsername is the username to use for Git authentication. This is\n\t// optional.\n\tGitUsername string\n\t// GitPassword is the password to use for Git authentication. This is\n\t// optional.\n\tGitPassword string\n\t// GitSSHPrivateKeyPath is the path to an SSH private key to be used for\n\t// Git authentication.\n\tGitSSHPrivateKeyPath string\n\t// GitSSHPrivateKeyBase64 is the content of an SSH private key to be used\n\t// for Git authentication.\n\tGitSSHPrivateKeyBase64 string\n\t// GitHTTPProxyURL is the URL for the HTTP proxy. This is optional.\n\tGitHTTPProxyURL string\n\t// WorkspaceBaseDir is the path under which workspaces will be placed when\n\t// workspace folder option is not given.\n\tWorkspaceBaseDir string\n\t// WorkspaceFolder is the path to the workspace folder that will be built.\n\t// This is optional. Defaults to `[workspace base dir]/[name]` where name is\n\t// the name of the repository or \"empty\".\n\tWorkspaceFolder string\n\t// SSLCertBase64 is the content of an SSL cert file. This is useful for\n\t// self-signed certificates.\n\tSSLCertBase64 string\n\t// ExportEnvFile is the optional file path to a .env file where envbuilder\n\t// will dump environment variables from devcontainer.json and the built\n\t// container image.\n\tExportEnvFile string\n\t// PostStartScriptPath is the path to a script that will be created by\n\t// envbuilder based on the postStartCommand in devcontainer.json, if any is\n\t// specified (otherwise the script is not created). If this is set, the\n\t// specified InitCommand should check for the presence of this script and\n\t// execute it after successful startup.\n\tPostStartScriptPath string\n\t// Logger is the logger to use for all operations.\n\tLogger log.Func\n\t// Verbose controls whether to send verbose logs.\n\tVerbose bool\n\t// Filesystem is the filesystem to use for all operations. Defaults to the\n\t// host filesystem.\n\tFilesystem billy.Filesystem\n\t// These options are specifically used when envbuilder is invoked as part of a\n\t// Coder workspace.\n\t// Revert to `*url.URL` once https://github.com/coder/serpent/issues/14 is fixed.\n\tCoderAgentURL string\n\t// CoderAgentToken is the authentication token for a Coder agent.\n\tCoderAgentToken string\n\t// CoderAgentSubsystem is the Coder agent subsystems to report when forwarding\n\t// logs. The envbuilder subsystem is always included.\n\tCoderAgentSubsystem []string\n\n\t// PushImage is a flag to determine if the image should be pushed to the\n\t// container registry. This option implies reproducible builds.\n\tPushImage bool\n\t// GetCachedImage is a flag to determine if the cached image is available,\n\t// and if it is, to return it.\n\tGetCachedImage bool\n\n\t// RemoteRepoBuildMode uses the remote repository as the source of truth\n\t// when building the image. Enabling this option ignores user changes to\n\t// local files and they will not be reflected in the image. This can be\n\t// used to improving cache utilization when multiple users are building\n\t// working on the same repository.\n\tRemoteRepoBuildMode bool\n\n\t// BinaryPath is the path to the local envbuilder binary when\n\t// attempting to probe the build cache. This is only relevant when\n\t// GetCachedImage is true.\n\tBinaryPath string\n\n\t// WorkingDirBase is the path to the directory where all envbuilder files should be\n\t// stored. By default, this is set to `/.envbuilder`. This is intentionally\n\t// excluded from the CLI options.\n\tWorkingDirBase string\n}\n```\nOptions contains the configuration for the envbuilder.\n\n```go\nfunc (o *Options) CABundle() ([]byte, error)\n```\n\n```go\nfunc (o *Options) CLI() serpent.OptionSet\n```\nGenerate CLI options for the envbuilder command.\n\n```go\nfunc (o *Options) Markdown() string\n```\n\n```go\nfunc (o *Options) SetDefaults()\n```\n\n","path":"github.com/coder/envbuilder/options","name":"options","synopsis":"","isRedistributable":true}
