{"modulePath":"github.com/databus23/atc","version":"v3.14.1+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package exec\n\n## Constants\n\n```go\nconst AbortedLogMessage = \"interrupted\"\n```\n\n```go\nconst TimeoutLogMessage = \"timeout exceeded\"\n```\n\n## Variables\n\n```go\nvar ErrPutStepVersionMissing = errors.New(\"version is missing from put step\")\n```\n\n## Types\n\n```go\ntype AggregateStep []Step\n```\nAggregateStep is a step of steps to run in parallel.\n\n```go\nfunc (step AggregateStep) Run(ctx context.Context, state RunState) error\n```\nRun executes all steps in parallel. It will indicate that it's ready when all of its steps are ready, and propagate any signal received to all running steps.\n\nIt will wait for all steps to exit, even if one step fails or errors. After all steps finish, their errors (if any) will be aggregated and returned as a single error.\n\n```go\nfunc (step AggregateStep) Succeeded() bool\n```\nSucceeded is true if all of the steps' Succeeded is true\n\n```go\ntype ArtifactOutputStep struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (step *ArtifactOutputStep) Run(ctx context.Context, state RunState) error\n```\n\n```go\nfunc (step *ArtifactOutputStep) Succeeded() bool\n```\n\n```go\ntype BuildStepDelegate interface {\n\tImageVersionDetermined(*db.UsedResourceCache) error\n\n\tStdout() io.Writer\n\tStderr() io.Writer\n\n\tErrored(lager.Logger, string)\n}\n```\n\n```go\ntype DeprecationConfigSource struct {\n\tDelegate TaskConfigSource\n\tStderr   io.Writer\n}\n```\nDeprecationConfigSource returns the Delegate TaskConfig and prints warnings to Stderr.\n\n```go\nfunc (configSource DeprecationConfigSource) FetchConfig(repo *worker.ArtifactRepository) (atc.TaskConfig, error)\n```\nFetchConfig calls the Delegate's FetchConfig and prints warnings to Stderr\n\n```go\nfunc (configSource DeprecationConfigSource) Warnings() []string\n```\n\n```go\ntype EmptyVersionSource struct{}\n```\n\n```go\nfunc (p *EmptyVersionSource) Version(RunState) (atc.Version, error)\n```\n\n```go\ntype EnsureStep struct {\n\t// contains filtered or unexported fields\n}\n```\nEnsureStep will run one step, and then a second step regardless of whether the first step fails or errors.\n\n```go\nfunc Ensure(step Step, hook Step) EnsureStep\n```\nEnsure constructs an EnsureStep.\n\n```go\nfunc (o EnsureStep) Run(ctx context.Context, state RunState) error\n```\nRun will call Run on the first step, wait for it to complete, and then call Run on the second step, regardless of whether the first step failed or errored.\n\nIf the first step or the second step errors, an aggregate of their errors is returned.\n\n```go\nfunc (o EnsureStep) Succeeded() bool\n```\nSucceeded is true if both of its steps succeeded.\n\n```go\ntype ExitStatus int\n```\nExitStatus is the resulting exit code from the process that the step ran. Typically if the ExitStatus result is 0, the Success result is true.\n\n```go\ntype Factory interface {\n\t// Get constructs a Get step.\n\tGet(\n\t\tlager.Logger,\n\t\tatc.Plan,\n\t\tdb.Build,\n\t\tStepMetadata,\n\t\tdb.ContainerMetadata,\n\t\tGetDelegate,\n\t) Step\n\n\t// Put constructs a Put step.\n\tPut(\n\t\tlager.Logger,\n\t\tatc.Plan,\n\t\tdb.Build,\n\t\tStepMetadata,\n\t\tdb.ContainerMetadata,\n\t\tPutDelegate,\n\t) Step\n\n\t// Task constructs a Task step.\n\tTask(\n\t\tlager.Logger,\n\t\tatc.Plan,\n\t\tdb.Build,\n\t\tdb.ContainerMetadata,\n\t\tTaskDelegate,\n\t) Step\n}\n```\nFactory is used when building up the steps for a build.\n\n```go\nfunc NewGardenFactory(\n\tworkerClient worker.Client,\n\tresourceFetcher resource.Fetcher,\n\tresourceFactory resource.ResourceFactory,\n\tdbResourceCacheFactory db.ResourceCacheFactory,\n\tvariablesFactory creds.VariablesFactory,\n) Factory\n```\n\n```go\ntype FileConfigSource struct {\n\tPath string\n}\n```\nFileConfigSource represents a dynamically configured TaskConfig, which will be fetched from a specified file in the worker.ArtifactRepository.\n\n```go\nfunc (configSource FileConfigSource) FetchConfig(repo *worker.ArtifactRepository) (atc.TaskConfig, error)\n```\nFetchConfig reads the specified file from the worker.ArtifactRepository and loads the TaskConfig contained therein (expecting it to be YAML format).\n\nThe path must be in the format SOURCE\\_NAME/FILE/PATH.yml. The SOURCE\\_NAME will be used to determine the ArtifactSource in the worker.ArtifactRepository to stream the file out of.\n\nIf the source name is missing (i.e. if the path is just \"foo.yml\"), UnspecifiedArtifactSourceError is returned.\n\nIf the specified source name cannot be found, UnknownArtifactSourceError is returned.\n\nIf the task config file is not found, or is invalid YAML, or is an invalid task configuration, the respective errors will be bubbled up.\n\n```go\nfunc (configSource FileConfigSource) Warnings() []string\n```\n\n```go\ntype FileNotFoundError struct {\n\tPath string\n}\n```\nFileNotFoundError is the error to return from StreamFile when the given path does not exist.\n\n```go\nfunc (err FileNotFoundError) Error() string\n```\nError prints a helpful message including the file path. The user will see this message if e.g. their task config path does not exist.\n\n```go\ntype GetDelegate interface {\n\tBuildStepDelegate\n\n\tFinished(lager.Logger, ExitStatus, VersionInfo)\n}\n```\n\n```go\ntype GetStep struct {\n\t// contains filtered or unexported fields\n}\n```\nGetStep will fetch a version of a resource on a worker that supports the resource type.\n\n```go\nfunc (step *GetStep) Run(ctx context.Context, state RunState) error\n```\nRun ultimately registers the configured resource version's ArtifactSource under the configured SourceName. How it actually does this is determined by a few factors.\n\nFirst, a worker that supports the given resource type is chosen, and a container is created on the worker.\n\nIf the worker has a VolumeManager, and its cache is already warmed, the cache will be mounted into the container, and no fetching will be performed. The container will be used to stream the contents of the cache to later steps that require the artifact but are running on a worker that does not have the cache.\n\nIf the worker does not have a VolumeManager, or if the worker does have a VolumeManager but a cache for the version of the resource is not present, the specified version of the resource will be fetched. As long as running the fetch script works, Run will return nil regardless of its exit status.\n\nIf the worker has a VolumeManager but did not have the cache initially, the fetched ArtifactSource is initialized, thus warming the worker's cache.\n\nAt the end, the resulting ArtifactSource (either from using the cache or fetching the resource) is registered under the step's SourceName.\n\n```go\nfunc (step *GetStep) Succeeded() bool\n```\nSucceeded returns true if the resource was successfully fetched.\n\n```go\ntype IdentityStep struct{}\n```\nIdentityStep does nothing.\n\n```go\nfunc (IdentityStep) Run(context.Context, RunState) error\n```\nRun does nothing.\n\n```go\nfunc (IdentityStep) Succeeded() bool\n```\n\n```go\ntype InputHandler func(io.ReadCloser) error\n```\n\n```go\ntype LogErrorStep struct {\n\tStep\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (step LogErrorStep) Run(ctx context.Context, state RunState) error\n```\n\n```go\ntype MergedConfigSource struct {\n\tA TaskConfigSource\n\tB TaskConfigSource\n}\n```\nMergedConfigSource is used to join two config sources together.\n\n```go\nfunc (configSource MergedConfigSource) FetchConfig(source *worker.ArtifactRepository) (atc.TaskConfig, error)\n```\nFetchConfig fetches both config sources, and merges the second config source into the first. This allows the user to set params required by a task loaded from a file by providing them in static configuration.\n\n```go\nfunc (configSource MergedConfigSource) Warnings() []string\n```\n\n```go\ntype MissingInputsError struct {\n\tInputs []string\n}\n```\nMissingInputsError is returned when any of the task's required inputs are missing.\n\n```go\nfunc (err MissingInputsError) Error() string\n```\nError prints a human-friendly message listing the inputs that were missing.\n\n```go\ntype MissingTaskImageSourceError struct {\n\tSourceName string\n}\n```\n\n```go\nfunc (err MissingTaskImageSourceError) Error() string\n```\n\n```go\ntype OnAbortStep struct {\n\t// contains filtered or unexported fields\n}\n```\nOnAbortStep will run one step, and then a second step if the first step aborts (but not errors).\n\n```go\nfunc OnAbort(step Step, hook Step) OnAbortStep\n```\nOnAbort constructs an OnAbortStep factory.\n\n```go\nfunc (o OnAbortStep) Run(ctx context.Context, state RunState) error\n```\nRun will call Run on the first step and wait for it to complete. If the first step errors, Run returns the error. OnAbortStep is ready as soon as the first step is ready.\n\nIf the first step aborts (that is, it gets interrupted), the second step is executed. If the second step errors, its error is returned.\n\n```go\nfunc (o OnAbortStep) Succeeded() bool\n```\nSucceeded is true if the first step doesn't exist, or if it completed successfully.\n\n```go\ntype OnFailureStep struct {\n\t// contains filtered or unexported fields\n}\n```\nOnFailureStep will run one step, and then a second step if the first step fails (but not errors).\n\n```go\nfunc OnFailure(firstStep Step, secondStep Step) OnFailureStep\n```\nOnFailure constructs an OnFailureStep factory.\n\n```go\nfunc (o OnFailureStep) Run(ctx context.Context, state RunState) error\n```\nRun will call Run on the first step and wait for it to complete. If the first step errors, Run returns the error. OnFailureStep is ready as soon as the first step is ready.\n\nIf the first step fails (that is, its Success result is false), the second step is executed. If the second step errors, its error is returned.\n\n```go\nfunc (o OnFailureStep) Succeeded() bool\n```\nSucceeded is true if the first step doesn't exist, or if it completed successfully.\n\n```go\ntype OnSuccessStep struct {\n\t// contains filtered or unexported fields\n}\n```\nOnSuccessStep will run one step, and then a second step if the first step succeeds.\n\n```go\nfunc (o OnSuccessStep) Run(ctx context.Context, state RunState) error\n```\nRun will call Run on the first step and wait for it to complete. If the first step errors, Run returns the error. OnSuccessStep is ready as soon as the first step is ready.\n\nIf the first step succeeds (that is, its Success result is true), the second step is executed. If the second step errors, its error is returned.\n\n```go\nfunc (o OnSuccessStep) Succeeded() bool\n```\nSucceeded is true if the first step completed and the second step completed successfully.\n\n```go\ntype OutputHandler func(io.Writer) error\n```\n\n```go\ntype Privileged bool\n```\nPrivileged is used to indicate whether the given step should run with special privileges (i.e. as an administrator user).\n\n```go\ntype PutDelegate interface {\n\tBuildStepDelegate\n\n\tFinished(lager.Logger, ExitStatus, VersionInfo)\n}\n```\n\n```go\ntype PutResourceSource struct {\n\tworker.ArtifactSource\n}\n```\n\n```go\nfunc (source PutResourceSource) StreamTo(dest worker.ArtifactDestination) error\n```\n\n```go\ntype PutStep struct {\n\t// contains filtered or unexported fields\n}\n```\nPutStep produces a resource version using preconfigured params and any data available in the worker.ArtifactRepository.\n\n```go\nfunc NewPutStep(\n\tbuild db.Build,\n\tname string,\n\tresourceType string,\n\tresourceName string,\n\tsource creds.Source,\n\tparams creds.Params,\n\ttags atc.Tags,\n\tdelegate PutDelegate,\n\tresourceFactory resource.ResourceFactory,\n\tplanID atc.PlanID,\n\tcontainerMetadata db.ContainerMetadata,\n\tstepMetadata StepMetadata,\n\tresourceTypes creds.VersionedResourceTypes,\n) *PutStep\n```\n\n```go\nfunc (step *PutStep) Run(ctx context.Context, state RunState) error\n```\nRun chooses a worker that supports the step's resource type and creates a container.\n\nAll worker.ArtifactSources present in the worker.ArtifactRepository are then brought into the container, using volumes if possible, and streaming content over if not.\n\nThe resource's put script is then invoked. If the context is canceled, the script will be interrupted.\n\n```go\nfunc (step *PutStep) Succeeded() bool\n```\nSucceeded returns true if the resource script exited successfully.\n\n```go\nfunc (step *PutStep) VersionInfo() VersionInfo\n```\nVersionInfo returns the info of the pushed version.\n\n```go\ntype PutStepVersionSource struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (p *PutStepVersionSource) Version(state RunState) (atc.Version, error)\n```\n\n```go\ntype RetryStep struct {\n\tAttempts    []Step\n\tLastAttempt Step\n}\n```\nRetryStep is a step that will run the steps in order until one of them succeeds.\n\n```go\nfunc (step *RetryStep) Run(ctx context.Context, state RunState) error\n```\nRun iterates through each step, stopping once a step succeeds. If all steps fail, the RetryStep will fail.\n\n```go\nfunc (step *RetryStep) Succeeded() bool\n```\nSucceeded delegates to the last step that it ran.\n\n```go\ntype RunState interface {\n\tArtifacts() *worker.ArtifactRepository\n\n\tResult(atc.PlanID, interface{}) bool\n\tStoreResult(atc.PlanID, interface{})\n\n\tSendUserInput(atc.PlanID, io.ReadCloser)\n\tReadUserInput(atc.PlanID, InputHandler) error\n\n\tReadPlanOutput(atc.PlanID, io.Writer)\n\tSendPlanOutput(atc.PlanID, OutputHandler) error\n}\n```\n\n```go\nfunc NewRunState() RunState\n```\n\n```go\ntype StaticConfigSource struct {\n\tPlan atc.TaskPlan\n}\n```\nStaticConfigSource represents a statically configured TaskConfig.\n\n```go\nfunc (configSource StaticConfigSource) FetchConfig(*worker.ArtifactRepository) (atc.TaskConfig, error)\n```\nFetchConfig returns the configuration.\n\n```go\nfunc (configSource StaticConfigSource) Warnings() []string\n```\n\n```go\ntype StaticVersionSource struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (p *StaticVersionSource) Version(RunState) (atc.Version, error)\n```\n\n```go\ntype Step interface {\n\t// Run is called when it's time to execute the step. It should watch for the\n\t// given context to be canceled in the event that the build is aborted or the\n\t// step times out, and be sure to propagate the (context.Context).Err().\n\t//\n\t// Steps wrapping other steps should be careful to propagate the context.\n\t//\n\t// Steps must be idempotent. Each step is responsible for handling its own\n\t// idempotency.\n\tRun(context.Context, RunState) error\n\n\t// Succeeded is true when the Step succeeded, and false otherwise.\n\t// Succeeded is not guaranteed to be truthful until after you run Run()\n\tSucceeded() bool\n}\n```\nA Step is an object that can be executed, whose result (e.g. Success) can be collected, and whose dependent resources (e.g. Containers, Volumes) can be released, allowing them to expire.\n\n```go\nfunc ArtifactOutput(id atc.PlanID, name worker.ArtifactName, delegate BuildStepDelegate) Step\n```\n\n```go\nfunc LogError(step Step, delegate BuildStepDelegate) Step\n```\n\n```go\nfunc NewGetStep(\n\tbuild db.Build,\n\n\tname string,\n\tresourceType string,\n\tresource string,\n\tsource creds.Source,\n\tparams creds.Params,\n\tversionSource VersionSource,\n\ttags atc.Tags,\n\n\tdelegate GetDelegate,\n\n\tresourceFetcher resource.Fetcher,\n\tteamID int,\n\tbuildID int,\n\tplanID atc.PlanID,\n\tcontainerMetadata db.ContainerMetadata,\n\tdbResourceCacheFactory db.ResourceCacheFactory,\n\tstepMetadata StepMetadata,\n\n\tresourceTypes creds.VersionedResourceTypes,\n) Step\n```\n\n```go\nfunc NewTaskStep(\n\tprivileged Privileged,\n\tconfigSource TaskConfigSource,\n\ttags atc.Tags,\n\tinputMapping map[string]string,\n\toutputMapping map[string]string,\n\tartifactsRoot string,\n\timageArtifactName string,\n\tdelegate TaskDelegate,\n\tworkerPool worker.Client,\n\tteamID int,\n\tbuildID int,\n\tjobID int,\n\tstepName string,\n\tplanID atc.PlanID,\n\tcontainerMetadata db.ContainerMetadata,\n\tresourceTypes creds.VersionedResourceTypes,\n\tvariables creds.Variables,\n) Step\n```\n\n```go\nfunc OnSuccess(firstStep Step, secondStep Step) Step\n```\nOnSuccess constructs an OnSuccessStep factory.\n\n```go\nfunc Retry(attempts ...Step) Step\n```\n\n```go\nfunc Try(step Step) Step\n```\nTry constructs a TryStep.\n\n```go\nfunc UserArtifact(id atc.PlanID, name worker.ArtifactName, delegate BuildStepDelegate) Step\n```\n\n```go\ntype StepMetadata interface {\n\tEnv() []string\n}\n```\nStepMetadata is used to inject metadata to make available to the step when it's running.\n\n```go\ntype TaskConfigSource interface {\n\t// FetchConfig returns the TaskConfig, and may have to a task config file out\n\t// of the worker.ArtifactRepository.\n\tFetchConfig(*worker.ArtifactRepository) (atc.TaskConfig, error)\n\tWarnings() []string\n}\n```\nTaskConfigSource is used to determine a Task step's TaskConfig.\n\n```go\ntype TaskDelegate interface {\n\tBuildStepDelegate\n\n\tInitializing(lager.Logger, atc.TaskConfig)\n\tStarting(lager.Logger, atc.TaskConfig)\n\tFinished(lager.Logger, ExitStatus)\n}\n```\n\n```go\ntype TaskImageSourceParametersError struct {\n\tErr error\n}\n```\n\n```go\nfunc (err TaskImageSourceParametersError) Error() string\n```\n\n```go\ntype TaskStep struct {\n\t// contains filtered or unexported fields\n}\n```\nTaskStep executes a TaskConfig, whose inputs will be fetched from the worker.ArtifactRepository and outputs will be added to the worker.ArtifactRepository.\n\n```go\nfunc (action *TaskStep) Run(ctx context.Context, state RunState) error\n```\nRun will first selects the worker based on the TaskConfig's platform, the TaskStep's tags, and prioritized by availability of volumes for the TaskConfig's inputs. Inputs that did not have volumes available on the worker will be streamed in to the container.\n\nIf any inputs are not available in the worker.ArtifactRepository, MissingInputsError is returned.\n\nOnce all the inputs are satisfied, the task's script will be executed. If the task is canceled via the context, the script will be interrupted.\n\nIf the script exits successfully, the outputs specified in the TaskConfig are registered with the worker.ArtifactRepository. If no outputs are specified, the task's entire working directory is registered as an ArtifactSource under the name of the task.\n\n```go\nfunc (action *TaskStep) Succeeded() bool\n```\n\n```go\ntype TimeoutStep struct {\n\t// contains filtered or unexported fields\n}\n```\nTimeoutStep applies a fixed timeout to a step's Run.\n\n```go\nfunc Timeout(step Step, duration string) *TimeoutStep\n```\nTimeout constructs a TimeoutStep factory.\n\n```go\nfunc (ts *TimeoutStep) Run(ctx context.Context, state RunState) error\n```\nRun parses the timeout duration and invokes the nested step.\n\nIf the nested step takes longer than the duration, it is sent the Interrupt signal, and the TimeoutStep returns nil once the nested step exits (ignoring the nested step's error).\n\nThe result of the nested step's Run is returned.\n\n```go\nfunc (ts *TimeoutStep) Succeeded() bool\n```\nSucceeded is true if the nested step completed successfully and did not time out.\n\n```go\ntype TryStep struct {\n\t// contains filtered or unexported fields\n}\n```\nTryStep wraps another step, ignores its errors, and always succeeds.\n\n```go\nfunc (ts TryStep) Run(ctx context.Context, state RunState) error\n```\nRun runs the nested step, and always returns nil, ignoring the nested step's error.\n\n```go\nfunc (ts TryStep) Succeeded() bool\n```\nSucceeded is true\n\n```go\ntype UnknownArtifactSourceError struct {\n\tSourceName worker.ArtifactName\n}\n```\nUnknownArtifactSourceError is returned when the worker.ArtifactName specified by the path does not exist in the worker.ArtifactRepository.\n\n```go\nfunc (err UnknownArtifactSourceError) Error() string\n```\nError returns a human-friendly error message.\n\n```go\ntype UnspecifiedArtifactSourceError struct {\n\tPath string\n}\n```\nUnspecifiedArtifactSourceError is returned when the specified path is of a file in the toplevel directory, and so it does not indicate a SourceName.\n\n```go\nfunc (err UnspecifiedArtifactSourceError) Error() string\n```\nError returns a human-friendly error message.\n\n```go\ntype UserArtifactStep struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (step *UserArtifactStep) Run(ctx context.Context, state RunState) error\n```\n\n```go\nfunc (step *UserArtifactStep) Succeeded() bool\n```\n\n```go\ntype ValidatingConfigSource struct {\n\tConfigSource TaskConfigSource\n}\n```\nValidatingConfigSource delegates to another ConfigSource, and validates its task config.\n\n```go\nfunc (configSource ValidatingConfigSource) FetchConfig(source *worker.ArtifactRepository) (atc.TaskConfig, error)\n```\nFetchConfig fetches the config using the underlying ConfigSource, and checks that it's valid.\n\n```go\nfunc (configSource ValidatingConfigSource) Warnings() []string\n```\n\n```go\ntype VersionInfo struct {\n\tVersion  atc.Version\n\tMetadata []atc.MetadataField\n}\n```\nVersionInfo is the version and metadata of a resource that was fetched or produced. It is used by Put and Get.\n\n```go\ntype VersionSource interface {\n\tVersion(RunState) (atc.Version, error)\n}\n```\n\n```go\nfunc NewVersionSourceFromPlan(getPlan *atc.GetPlan) VersionSource\n```\n\n","path":"github.com/databus23/atc/exec","name":"exec","synopsis":"","isRedistributable":true}
