
// This file was autogenerated by go-to-protobuf. Do not edit it manually!

syntax = "proto2";

package github.com.openshift.api.build.v1;

import "k8s.io/api/core/v1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";

// Package-wide variables from generator "generated".
option go_package = "github.com/openshift/api/build/v1";

// BinaryBuildRequestOptions are the options required to fully speficy a binary build request
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BinaryBuildRequestOptions {
  // metadata is the standard object's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // asFile determines if the binary should be created as a file within the source rather than extracted as an archive
  optional string asFile = 2;

  // revision.commit is the value identifying a specific commit
  optional string revisionCommit = 3;

  // revision.message is the description of a specific commit
  optional string revisionMessage = 4;

  // revision.authorName of the source control user
  optional string revisionAuthorName = 5;

  // revision.authorEmail of the source control user
  optional string revisionAuthorEmail = 6;

  // revision.committerName of the source control user
  optional string revisionCommitterName = 7;

  // revision.committerEmail of the source control user
  optional string revisionCommitterEmail = 8;
}

// BinaryBuildSource describes a binary file to be used for the Docker and Source build strategies,
// where the file will be extracted and used as the build source.
message BinaryBuildSource {
  // asFile indicates that the provided binary input should be considered a single file
  // within the build input. For example, specifying "webapp.war" would place the provided
  // binary as `/webapp.war` for the builder. If left empty, the Docker and Source build
  // strategies assume this file is a zip, tar, or tar.gz file and extract it as the source.
  // The custom strategy receives this binary as standard input. This filename may not
  // contain slashes or be '..' or '.'.
  optional string asFile = 1;
}

// BitbucketWebHookCause has information about a Bitbucket webhook that triggered a
// build.
message BitbucketWebHookCause {
  optional CommonWebHookCause commonSpec = 1;
}

// Build encapsulates the inputs needed to produce a new deployable image, as well as
// the status of the execution and a reference to the Pod which executed the build.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message Build {
  // metadata is the standard object's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // spec is all the inputs used to execute the build.
  optional BuildSpec spec = 2;

  // status is the current status of the build.
  // +optional
  optional BuildStatus status = 3;
}

// BuildCondition describes the state of a build at a certain point.
message BuildCondition {
  // type of build condition.
  optional string type = 1;

  // status of the condition, one of True, False, Unknown.
  optional string status = 2;

  // The last time this condition was updated.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastUpdateTime = 6;

  // The last time the condition transitioned from one status to another.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;

  // The reason for the condition's last transition.
  optional string reason = 4;

  // A human readable message indicating details about the transition.
  optional string message = 5;
}

// Build configurations define a build process for new container images. There are three types of builds possible - a container image build using a Dockerfile, a Source-to-Image build that uses a specially prepared base image that accepts source code that it can make runnable, and a custom build that can run // arbitrary container images as a base and accept the build parameters. Builds run on the cluster and on completion are pushed to the container image registry specified in the "output" section. A build can be triggered via a webhook, when the base image changes, or when a user manually requests a new build be // created.
//
// Each build created by a build configuration is numbered and refers back to its parent configuration. Multiple builds can be triggered at once. Builds that do not have "output" set can be used to test code or run a verification build.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildConfig {
  // metadata is the standard object's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // spec holds all the input necessary to produce a new build, and the conditions when
  // to trigger them.
  optional BuildConfigSpec spec = 2;

  // status holds any relevant information about a build config
  // +optional
  optional BuildConfigStatus status = 3;
}

// BuildConfigList is a collection of BuildConfigs.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildConfigList {
  // metadata is the standard list's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // items is a list of build configs
  repeated BuildConfig items = 2;
}

// BuildConfigSpec describes when and how builds are created
message BuildConfigSpec {
  // triggers determine how new Builds can be launched from a BuildConfig. If
  // no triggers are defined, a new build can only occur as a result of an
  // explicit client build creation.
  // +optional
  repeated BuildTriggerPolicy triggers = 1;

  // runPolicy describes how the new build created from this build
  // configuration will be scheduled for execution.
  // This is optional, if not specified we default to "Serial".
  optional string runPolicy = 2;

  // CommonSpec is the desired build specification
  optional CommonSpec commonSpec = 3;

  // successfulBuildsHistoryLimit is the number of old successful builds to retain.
  // When a BuildConfig is created, the 5 most recent successful builds are retained unless this value is set.
  // If removed after the BuildConfig has been created, all successful builds are retained.
  optional int32 successfulBuildsHistoryLimit = 4;

  // failedBuildsHistoryLimit is the number of old failed builds to retain.
  // When a BuildConfig is created, the 5 most recent failed builds are retained unless this value is set.
  // If removed after the BuildConfig has been created, all failed builds are retained.
  optional int32 failedBuildsHistoryLimit = 5;
}

// BuildConfigStatus contains current state of the build config object.
message BuildConfigStatus {
  // lastVersion is used to inform about number of last triggered build.
  // +optional
  optional int64 lastVersion = 1;

  // imageChangeTriggers captures the runtime state of any ImageChangeTrigger specified in the BuildConfigSpec,
  // including the value reconciled by the OpenShift APIServer for the lastTriggeredImageID. There is a single entry
  // in this array for each image change trigger in spec. Each trigger status references the ImageStreamTag that acts as the source of the trigger.
  // +optional
  repeated ImageChangeTriggerStatus imageChangeTriggers = 2;
}

// BuildList is a collection of Builds.
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildList {
  // metadata is the standard list's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // items is a list of builds
  repeated Build items = 2;
}

// BuildLog is the (unused) resource associated with the build log redirector
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildLog {
}

// BuildLogOptions is the REST options for a build log
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildLogOptions {
  // cointainer for which to stream logs. Defaults to only container if there is one container in the pod.
  optional string container = 1;

  // follow if true indicates that the build log should be streamed until
  // the build terminates.
  optional bool follow = 2;

  // previous returns previous build logs. Defaults to false.
  optional bool previous = 3;

  // sinceSeconds is a relative time in seconds before the current time from which to show logs. If this value
  // precedes the time a pod was started, only logs since the pod start will be returned.
  // If this value is in the future, no logs will be returned.
  // Only one of sinceSeconds or sinceTime may be specified.
  optional int64 sinceSeconds = 4;

  // sinceTime is an RFC3339 timestamp from which to show logs. If this value
  // precedes the time a pod was started, only logs since the pod start will be returned.
  // If this value is in the future, no logs will be returned.
  // Only one of sinceSeconds or sinceTime may be specified.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time sinceTime = 5;

  // timestamps, If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line
  // of log output. Defaults to false.
  optional bool timestamps = 6;

  // tailLines, If set, is the number of lines from the end of the logs to show. If not specified,
  // logs are shown from the creation of the container or sinceSeconds or sinceTime
  optional int64 tailLines = 7;

  // limitBytes, If set, is the number of bytes to read from the server before terminating the
  // log output. This may not display a complete final line of logging, and may return
  // slightly more or slightly less than the specified limit.
  optional int64 limitBytes = 8;

  // nowait if true causes the call to return immediately even if the build
  // is not available yet. Otherwise the server will wait until the build has started.
  // TODO: Fix the tag to 'noWait' in v2
  optional bool nowait = 9;

  // version of the build for which to view logs.
  optional int64 version = 10;

  // insecureSkipTLSVerifyBackend indicates that the apiserver should not confirm the validity of the
  // serving certificate of the backend it is connecting to.  This will make the HTTPS connection between the apiserver
  // and the backend insecure. This means the apiserver cannot verify the log data it is receiving came from the real
  // kubelet.  If the kubelet is configured to verify the apiserver's TLS credentials, it does not mean the
  // connection to the real kubelet is vulnerable to a man in the middle attack (e.g. an attacker could not intercept
  // the actual log data coming from the real kubelet).
  // +optional
  optional bool insecureSkipTLSVerifyBackend = 11;
}

// BuildOutput is input to a build strategy and describes the container image that the strategy
// should produce.
message BuildOutput {
  // to defines an optional location to push the output of this build to.
  // Kind must be one of 'ImageStreamTag' or 'DockerImage'.
  // This value will be used to look up a container image repository to push to.
  // In the case of an ImageStreamTag, the ImageStreamTag will be looked for in the namespace of
  // the build unless Namespace is specified.
  optional .k8s.io.api.core.v1.ObjectReference to = 1;

  // pushSecret is the name of a Secret that would be used for setting
  // up the authentication for executing the Docker push to authentication
  // enabled Docker Registry (or Docker Hub).
  optional .k8s.io.api.core.v1.LocalObjectReference pushSecret = 2;

  // imageLabels define a list of labels that are applied to the resulting image. If there
  // are multiple labels with the same name then the last one in the list is used.
  repeated ImageLabel imageLabels = 3;
}

// A BuildPostCommitSpec holds a build post commit hook specification. The hook
// executes a command in a temporary container running the build output image,
// immediately after the last layer of the image is committed and before the
// image is pushed to a registry. The command is executed with the current
// working directory ($PWD) set to the image's WORKDIR.
//
// The build will be marked as failed if the hook execution fails. It will fail
// if the script or command return a non-zero exit code, or if there is any
// other error related to starting the temporary container.
//
// There are five different ways to configure the hook. As an example, all forms
// below are equivalent and will execute `rake test --verbose`.
//
// 1. Shell script:
//
// 	   "postCommit": {
// 	     "script": "rake test --verbose",
// 	   }
//
// 	The above is a convenient form which is equivalent to:
//
// 	   "postCommit": {
// 	     "command": ["/bin/sh", "-ic"],
// 	     "args":    ["rake test --verbose"]
// 	   }
//
// 2. A command as the image entrypoint:
//
// 	   "postCommit": {
// 	     "commit": ["rake", "test", "--verbose"]
// 	   }
//
// 	Command overrides the image entrypoint in the exec form, as documented in
// 	Docker: https://docs.docker.com/engine/reference/builder/#entrypoint.
//
// 3. Pass arguments to the default entrypoint:
//
// 	       "postCommit": {
// 			      "args": ["rake", "test", "--verbose"]
// 		      }
//
// 	    This form is only useful if the image entrypoint can handle arguments.
//
// 4. Shell script with arguments:
//
// 	   "postCommit": {
// 	     "script": "rake test $1",
// 	     "args":   ["--verbose"]
// 	   }
//
// 	This form is useful if you need to pass arguments that would otherwise be
// 	hard to quote properly in the shell script. In the script, $0 will be
// 	"/bin/sh" and $1, $2, etc, are the positional arguments from Args.
//
// 5. Command with arguments:
//
// 	   "postCommit": {
// 	     "command": ["rake", "test"],
// 	     "args":    ["--verbose"]
// 	   }
//
// 	This form is equivalent to appending the arguments to the Command slice.
//
// It is invalid to provide both Script and Command simultaneously. If none of
// the fields are specified, the hook is not executed.
message BuildPostCommitSpec {
  // command is the command to run. It may not be specified with Script.
  // This might be needed if the image doesn't have `/bin/sh`, or if you
  // do not want to use a shell. In all other cases, using Script might be
  // more convenient.
  repeated string command = 1;

  // args is a list of arguments that are provided to either Command,
  // Script or the container image's default entrypoint. The arguments are
  // placed immediately after the command to be run.
  repeated string args = 2;

  // script is a shell script to be run with `/bin/sh -ic`. It may not be
  // specified with Command. Use Script when a shell script is appropriate
  // to execute the post build hook, for example for running unit tests
  // with `rake test`. If you need control over the image entrypoint, or
  // if the image does not have `/bin/sh`, use Command and/or Args.
  // The `-i` flag is needed to support CentOS and RHEL images that use
  // Software Collections (SCL), in order to have the appropriate
  // collections enabled in the shell. E.g., in the Ruby image, this is
  // necessary to make `ruby`, `bundle` and other binaries available in
  // the PATH.
  optional string script = 3;
}

// BuildRequest is the resource used to pass parameters to build generator
//
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
// +openshift:compatibility-gen:level=1
message BuildRequest {
  // metadata is the standard object's metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // revision is the information from the source for a specific repo snapshot.
  optional SourceRevision revision = 2;

  // triggeredByImage is the Image that triggered this build.
  optional .k8s.io.api.core.v1.ObjectReference triggeredByImage = 3;

  // from is the reference to the ImageStreamTag that triggered the build.
  optional .k8s.io.api.core.v1.ObjectReference from = 4;

  // binary indicates a request to build from a binary provided to the builder
  optional BinaryBuildSource binary = 5;

  // lastVersion (optional) is the LastVersion of the BuildConfig that was used
  // to generate the build. If the BuildConfig in the generator doesn't match, a build will
  // not be generated.
  optional int64 lastVersion = 6;

  // env contains additional environment variables you want to pass into a builder container.
  repeated .k8s.io.api.core.v1.EnvVar env = 7;

  // triggeredBy describes which triggers started the most recent update to the
  // build configuration and contains information about those triggers.
  repeated BuildTriggerCause triggeredBy = 8;

  // dockerStrategyOptions contains additional docker-strategy specific options for the build
  optional DockerStrategyOptions dockerStrategyOptions = 9;

  // sourceStrategyOptions contains additional source-strategy specific options for the build
  optional SourceStrategyOptions sourceStrategyOptions = 10;
}

// BuildSource is the SCM used for the build.
message BuildSource {
  // type of build input to accept
  // +k8s:conversion-gen=false
  // +optional
  optional string type = 1;

  // binary builds accept a binary as their input. The binary is generally assumed to be a tar,
  // gzipped tar, or zip file depending on the strategy. For container image builds, this is the build
  // context and an optional Dockerfile may be specified to override any Dockerfile in the
  // build context. For Source builds, this is assumed to be an archive as described above. For
  // Source and container image builds, if binary.asFile is set the build will receive a directory with
  // a single file. contextDir may be used when an archive is provided. Custom builds will
  // receive this binary as input on STDIN.
  optional BinaryBuildSource binary = 2;

  // dockerfile is the raw contents of a Dockerfile which should be built. When this option is
  // specified, the FROM may be modified based on your strategy base image and additional ENV
  // stanzas from your strategy environment will be added after the FROM, but before the rest
  // of your Dockerfile stanzas. The Dockerfile source type may be used with other options like
  // git - in those cases the Git repo will have any innate Dockerfile replaced in the context
  // dir.
  optional string dockerfile = 3;

  // git contains optional information about git build source
  optional GitBuildSource git = 4;

  // images describes a set of images to be used to provide source for the build
  repeated ImageSource images = 5;

  // contextDir specifies the sub-directory where the source code for the application exists.
  // This allows to have buildable sources in directory other than root of
  // repository.
  optional string contextDir = 6;

  // sourceSecret is the name of a Secret that would be used for setting
  // up the authentication for cloning private repository.
  // The secret contains valid credentials for remote repository, where the
  // data's key represent the authentication method to be used and value is
  // the base64 encoded credentials. Supported auth methods are: ssh-privatekey.
  optional .k8s.io.api.core.v1.LocalObjectReference sourceSecret = 7;

  // secrets represents a list of secrets and their destinations that will
  // be used only for the build.
  repeated SecretBuildSource secrets = 8;

  // configMaps represents a list of configMaps and their destinations that will
  // be used for the build.
  repeated ConfigMapBuildSource configMaps = 9;
}

// BuildSpec has the information to represent a build and also additional
// information about a build
message BuildSpec {
  // CommonSpec is the information that represents a build
  optional CommonSpec commonSpec = 1;

  // triggeredBy describes which triggers started the most recent update to the
  // build configuration and contains information about those triggers.
  repeated BuildTriggerCause triggeredBy = 2;
}

// BuildStatus contains the status of a build
message BuildStatus {
  // phase is the point in the build lifecycle. Possible values are
  // "New", "Pending", "Running", "Complete", "Failed", "Error", and "Cancelled".
  // +optional
  optional string phase = 1;

  // cancelled describes if a cancel event was triggered for the build.
  // +optional
  optional bool cancelled = 2;

  // reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.
  // +optional
  optional string reason = 3;

  // message is a human-readable message indicating details about why the build has this status.
  // +optional
  optional string message = 4;

  // startTimestamp is a timestamp representing the server time when this Build started
  // running in a Pod.
  // It is represented in RFC3339 form and is in UTC.
  // +optional
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startTimestamp = 5;

  // completionTimestamp is a timestamp representing the server time when this Build was
  // finished, whether that build failed or succeeded.  It reflects the time at which
  // the Pod running the Build terminated.
  // It is represented in RFC3339 form and is in UTC.
  // +optional
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time completionTimestamp = 6;

  // duration contains time.Duration object describing build time.
  // +optional
  optional int64 duration = 7;

  // outputDockerImageReference contains a reference to the container image that
  // will be built by this build. Its value is computed from
  // Build.Spec.Output.To, and should include the registry address, so that
  // it can be used to push and pull the image.
  // +optional
  optional string outputDockerImageReference = 8;

  // config is an ObjectReference to the BuildConfig this Build is based on.
  // +optional
  optional .k8s.io.api.core.v1.ObjectReference config = 9;

  // output describes the container image the build has produced.
  // +optional
  optional BuildStatusOutput output = 10;

  // stages contains details about each stage that occurs during the build
  // including start time, duration (in milliseconds), and the steps that
  // occured within each stage.
  // +optional
  repeated StageInfo stages = 11;

  // logSnippet is the last few lines of the build log.  This value is only set for builds that failed.
  // +optional
  optional string logSnippet = 12;

  // conditions represents the latest available observations of a build's current state.
  // +patchMergeKey=type
  // +patchStrategy=merge
  // +optional
  repeated BuildCondition conditions = 13;
}

// BuildStatusOutput contains the status of the built image.
message BuildStatusOutput {
  // to describes the status of the built image being pushed to a registry.
  optional BuildStatusOutputTo to = 1;
}

// BuildStatusOutputTo describes the status of the built image with regards to
// image registry to which it was supposed to be pushed.
message BuildStatusOutputTo {
  // imageDigest is the digest of the built container image. The digest uniquely
  // identifies the image in the registry to which it was pushed.
  //
  // Please note that this field may not always be set even if the push
  // completes successfully - e.g. when the registry returns no digest or
  // returns it in a format that the builder doesn't understand.
  optional string imageDigest = 1;
}

// BuildStrategy contains the details of how to perform a build.
message BuildStrategy {
  // type is the kind of build strategy.
  // +k8s:conversion-gen=false
  // +optional
  optional string type = 1;

  // dockerStrategy holds the parameters to the container image build strategy.
  optional DockerBuildStrategy dockerStrategy = 2;

  // sourceStrategy holds the parameters to the Source build strategy.
  optional SourceBuildStrategy sourceStrategy = 3;

  // customStrategy holds the parameters to the Custom build strategy
  optional CustomBuildStrategy customStrategy = 4;

  // jenkinsPipelineStrategy holds the parameters to the Jenkins Pipeline build strategy.
  // Deprecated: use OpenShift Pipelines
  optional JenkinsPipelineBuildStrategy jenkinsPipelineStrategy = 5;
}

// BuildTriggerCause holds information about a triggered build. It is used for
// displaying build trigger data for each build and build configuration in oc
// describe. It is also used to describe which triggers led to the most recent
// update in the build configuration.
message BuildTriggerCause {
  // message is used to store a human readable message for why the build was
  // triggered. E.g.: "Manually triggered by user", "Configuration change",etc.
  optional string message = 1;

  // genericWebHook holds data about a builds generic webhook trigger.
  optional GenericWebHookCause genericWebHook = 2;

  // githubWebHook represents data for a GitHub webhook that fired a
  // specific build.
  optional GitHubWebHookCause githubWebHook = 3;

  // imageChangeBuild stores information about an imagechange event
  // that triggered a new build.
  optional ImageChangeCause imageChangeBuild = 4;

  // gitlabWebHook represents data for a GitLab webhook that fired a specific
  // build.
  optional GitLabWebHookCause gitlabWebHook = 5;

  // bitbucketWebHook represents data for a Bitbucket webhook that fired a
  // specific build.
  optional BitbucketWebHookCause bitbucketWebHook = 6;
}

// BuildTriggerPolicy describes a policy for a single trigger that results in a new Build.
message BuildTriggerPolicy {
  // type is the type of build trigger. Valid values:
  //
  // - GitHub
  // GitHubWebHookBuildTriggerType represents a trigger that launches builds on
  // GitHub webhook invocations
  //
  // - Generic
  // GenericWebHookBuildTriggerType represents a trigger that launches builds on
  // generic webhook invocations
  //
  // - GitLab
  // GitLabWebHookBuildTriggerType represents a trigger that launches builds on
  // GitLab webhook invocations
  //
  // - Bitbucket
  // BitbucketWebHookBuildTriggerType represents a trigger that launches builds on
  // Bitbucket webhook invocations
  //
  // - ImageChange
  // ImageChangeBuildTriggerType represents a trigger that launches builds on
  // availability of a new version of an image
  //
  // - ConfigChange
  // ConfigChangeBuildTriggerType will trigger a build on an initial build config creation
  // WARNING: In the future the behavior will change to trigger a build on any config change
  optional string type = 1;

  // github contains the parameters for a GitHub webhook type of trigger
  optional WebHookTrigger github = 2;

  // generic contains the parameters for a Generic webhook type of trigger
  optional WebHookTrigger generic = 3;

  // imageChange contains parameters for an ImageChange type of trigger
  optional ImageChangeTrigger imageChange = 4;

  // GitLabWebHook contains the parameters for a GitLab webhook type of trigger
  optional WebHookTrigger gitlab = 5;

  // BitbucketWebHook contains the parameters for a Bitbucket webhook type of
  // trigger
  optional WebHookTrigger bitbucket = 6;
}

// BuildVolume describes a volume that is made available to build pods,
// such that it can be mounted into buildah's runtime environment.
// Only a subset of Kubernetes Volume sources are supported.
message BuildVolume {
  // name is a unique identifier for this BuildVolume.
  // It must conform to the Kubernetes DNS label standard and be unique within the pod.
  // Names that collide with those added by the build controller will result in a
  // failed build with an error message detailing which name caused the error.
  // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
  // +required
  optional string name = 1;

  // source represents the location and type of the mounted volume.
  // +required
  optional BuildVolumeSource source = 2;

  // mounts represents the location of the volume in the image build container
  // +required
  // +listType=map
  // +listMapKey=destinationPath
  // +patchMergeKey=destinationPath
  // +patchStrategy=merge
  repeated BuildVolumeMount mounts = 3;
}

// BuildVolumeMount describes the mounting of a Volume within buildah's runtime environment.
message BuildVolumeMount {
  // destinationPath is the path within the buildah runtime environment at which the volume should be mounted.
  // The transient mount within the build image and the backing volume will both be mounted read only.
  // Must be an absolute path, must not contain '..' or ':', and must not collide with a destination path generated
  // by the builder process
  // Paths that collide with those added by the build controller will result in a
  // failed build with an error message detailing which path caused the error.
  optional string destinationPath = 1;
}

// BuildVolumeSource represents the source of a volume to mount
// Only one of its supported types may be specified at any given time.
message BuildVolumeSource {
  // type is the BuildVolumeSourceType for the volume source.
  // Type must match the populated volume source.
  // Valid types are: Secret, ConfigMap
  optional string type = 1;

  // secret represents a Secret that should populate this volume.
  // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
  // +optional
  optional .k8s.io.api.core.v1.SecretVolumeSource secret = 2;

  // configMap represents a ConfigMap that should populate this volume
  // +optional
  optional .k8s.io.api.core.v1.ConfigMapVolumeSource configMap = 3;

  // csi represents ephemeral storage provided by external CSI drivers which support this capability
  // +optional
  optional .k8s.io.api.core.v1.CSIVolumeSource csi = 4;
}

// CommonSpec encapsulates all the inputs necessary to represent a build.
message CommonSpec {
  // serviceAccount is the name of the ServiceAccount to use to run the pod
  // created by this build.
  // The pod will be allowed to use secrets referenced by the ServiceAccount
  optional string serviceAccount = 1;

  // source describes the SCM in use.
  optional BuildSource source = 2;

  // revision is the information from the source for a specific repo snapshot.
  // This is optional.
  optional SourceRevision revision = 3;

  // strategy defines how to perform a build.
  optional BuildStrategy strategy = 4;

  // output describes the container image the Strategy should produce.
  optional BuildOutput output = 5;

  // resources computes resource requirements to execute the build.
  optional .k8s.io.api.core.v1.ResourceRequirements resources = 6;

  // postCommit is a build hook executed after the build output image is
  // committed, before it is pushed to a registry.
  optional BuildPostCommitSpec postCommit = 7;

  // completionDeadlineSeconds is an optional duration in seconds, counted from
  // the time when a build pod gets scheduled in the system, that the build may
  // be active on a node before the system actively tries to terminate the
  // build; value must be positive integer
  optional int64 completionDeadlineSeconds = 8;

  // nodeSelector is a selector which must be true for the build pod to fit on a node
  // If nil, it can be overridden by default build nodeselector values for the cluster.
  // If set to an empty map or a map with any values, default build nodeselector values
  // are ignored.
  // +optional
  optional OptionalNodeSelector nodeSelector = 9;

  // mountTrustedCA bind mounts the cluster's trusted certificate authorities, as defined in
  // the cluster's proxy configuration, into the build. This lets processes within a build trust
  // components signed by custom PKI certificate authorities, such as private artifact
  // repositories and HTTPS proxies.
  //
  // When this field is set to true, the contents of `/etc/pki/ca-trust` within the build are
  // managed by the build container, and any changes to this directory or its subdirectories (for
  // example - within a Dockerfile `RUN` instruction) are not persisted in the build's output image.
  optional bool mountTrustedCA = 10;
}

// CommonWebHookCause factors out the identical format of these webhook
// causes into struct so we can share it in the specific causes;  it is too late for
// GitHub and Generic but we can leverage this pattern with GitLab and Bitbucket.
message CommonWebHookCause {
  // revision is the git source revision information of the trigger.
  optional SourceRevision revision = 1;

  // secret is the obfuscated webhook secret that triggered a build.
  optional string secret = 2;
}

// ConfigMapBuildSource describes a configmap and its destination directory that will be
// used only at the build time. The content of the configmap referenced here will
// be copied into the destination directory instead of mounting.
message ConfigMapBuildSource {
  // configMap is a reference to an existing configmap that you want to use in your
  // build.
  optional .k8s.io.api.core.v1.LocalObjectReference configMap = 1;

  // destinationDir is the directory where the files from the configmap should be
  // available for the build time.
  // For the Source build strategy, these will be injected into a container
  // where the assemble script runs.
  // For the container image build strategy, these will be copied into the build
  // directory, where the Dockerfile is located, so users can ADD or COPY them
  // during container image build.
  optional string destinationDir = 2;
}

// CustomBuildStrategy defines input parameters specific to Custom build.
message CustomBuildStrategy {
  // from is reference to an DockerImage, ImageStreamTag, or ImageStreamImage from which
  // the container image should be pulled
  optional .k8s.io.api.core.v1.ObjectReference from = 1;

  // pullSecret is the name of a Secret that would be used for setting up
  // the authentication for pulling the container images from the private Docker
  // registries
  optional .k8s.io.api.core.v1.LocalObjectReference pullSecret = 2;

  // env contains additional environment variables you want to pass into a builder container.
  repeated .k8s.io.api.core.v1.EnvVar env = 3;

  // exposeDockerSocket will allow running Docker commands (and build container images) from
  // inside the container.
  // TODO: Allow admins to enforce 'false' for this option
  optional bool exposeDockerSocket = 4;

  // forcePull describes if the controller should configure the build pod to always pull the images
  // for the builder or only pull if it is not present locally
  optional bool forcePull = 5;

  // secrets is a list of additional secrets that will be included in the build pod
  repeated SecretSpec secrets = 6;

  // buildAPIVersion is the requested API version for the Build object serialized and passed to the custom builder
  optional string buildAPIVersion = 7;
}

// DockerBuildStrategy defines input parameters specific to container image build.
message DockerBuildStrategy {
  // from is a reference to an DockerImage, ImageStreamTag, or ImageStreamImage which overrides
  // the FROM image in the Dockerfile for the build. If the Dockerfile uses multi-stage builds,
  // this will replace the image in the last FROM directive of the file.
  optional .k8s.io.api.core.v1.ObjectReference from = 1;

  // pullSecret is the name of a Secret that would be used for setting up
  // the authentication for pulling the container images from the private Docker
  // registries
  optional .k8s.io.api.core.v1.LocalObjectReference pullSecret = 2;

  // noCache if set to true indicates that the container image build must be executed with the
  // --no-cache=true flag
  optional bool noCache = 3;

  // env contains additional environment variables you want to pass into a builder container.
  repeated .k8s.io.api.core.v1.EnvVar env = 4;

  // forcePull describes if the builder should pull the images from registry prior to building.
  optional bool forcePull = 5;

  // dockerfilePath is the path of the Dockerfile that will be used to build the container image,
  // relative to the root of the context (contextDir).
  // Defaults to `Dockerfile` if unset.
  optional string dockerfilePath = 6;

  // buildArgs contains build arguments that will be resolved in the Dockerfile.  See
  // https://docs.docker.com/engine/reference/builder/#/arg for more details.
  // NOTE: Only the 'name' and 'value' fields are supported. Any settings on the 'valueFrom' field
  // are ignored.
  repeated .k8s.io.api.core.v1.EnvVar buildArgs = 7;

  // imageOptimizationPolicy describes what optimizations the system can use when building images
  // to reduce the final size or time spent building the image. The default policy is 'None' which
  // means the final build image will be equivalent to an image created by the container image build API.
  // The experimental policy 'SkipLayers' will avoid commiting new layers in between each
  // image step, and will fail if the Dockerfile cannot provide compatibility with the 'None'
  // policy. An additional experimental policy 'SkipLayersAndWarn' is the same as
  // 'SkipLayers' but simply warns if compatibility cannot be preserved.
  optional string imageOptimizationPolicy = 8;

  // volumes is a list of input volumes that can be mounted into the builds runtime environment.
  // Only a subset of Kubernetes Volume sources are supported by builds.
  // More info: https://kubernetes.io/docs/concepts/storage/volumes
  // +listType=map
  // +listMapKey=name
  // +patchMergeKey=name
  // +patchStrategy=merge
  repeated BuildVolume volumes = 9;
}

// DockerStrategyOptions contains extra strategy options for container image builds
message DockerStrategyOptions {
  // Args contains any build arguments that are to be passed to Docker.  See
  // https://docs.docker.com/engine/reference/builder/#/arg for more details
  repeated .k8s.io.api.core.v1.EnvVar buildArgs = 1;

  // noCache overrides the docker-strategy noCache option in the build config
  optional bool noCache = 2;
}

// GenericWebHookCause holds information about a generic WebHook that
// triggered a build.
message GenericWebHookCause {
  // revision is an optional field that stores the git source revision
  // information of the generic webhook trigger when it is available.
  optional SourceRevision revision = 1;

  // secret is the obfuscated webhook secret that triggered a build.
  optional string secret = 2;
}

// GenericWebHookEvent is the payload expected for a generic webhook post
message GenericWebHookEvent {
  // type is the type of source repository
  // +k8s:conversion-gen=false
  optional string type = 1;

  // git is the git information if the Type is BuildSourceGit
  optional GitInfo git = 2;

  // env contains additional environment variables you want to pass into a builder container.
  // ValueFrom is not supported.
  repeated .k8s.io.api.core.v1.EnvVar env = 3;

  // dockerStrategyOptions contains additional docker-strategy specific options for the build
  optional DockerStrategyOptions dockerStrategyOptions = 4;
}

// GitBuildSource defines the parameters of a Git SCM
message GitBuildSource {
  // uri points to the source that will be built. The structure of the source
  // will depend on the type of build to run
  optional string uri = 1;

  // ref is the branch/tag/ref to build.
  optional string ref = 2;

  // proxyConfig defines the proxies to use for the git clone operation. Values
  // not set here are inherited from cluster-wide build git proxy settings.
  optional ProxyConfig proxyConfig = 3;
}

// GitHubWebHookCause has information about a GitHub webhook that triggered a
// build.
message GitHubWebHookCause {
  // revision is the git revision information of the trigger.
  optional SourceRevision revision = 1;

  // secret is the obfuscated webhook secret that triggered a build.
  optional string secret = 2;
}

// GitInfo is the aggregated git information for a generic webhook post
message GitInfo {
  optional GitBuildSource gitBuildSource = 1;

  optional GitSourceRevision gitSourceRevision = 2;

  // refs is a list of GitRefs for the provided repo - generally sent
  // when used from a post-receive hook. This field is optional and is
  // used when sending multiple refs
  repeated GitRefInfo refs = 3;
}

// GitLabWebHookCause has information about a GitLab webhook that triggered a
// build.
message GitLabWebHookCause {
  optional CommonWebHookCause commonSpec = 1;
}

// GitRefInfo is a single ref
message GitRefInfo {
  optional GitBuildSource gitBuildSource = 1;

  optional GitSourceRevision gitSourceRevision = 2;
}

// GitSourceRevision is the commit information from a git source for a build
message GitSourceRevision {
  // commit is the commit hash identifying a specific commit
  optional string commit = 1;

  // author is the author of a specific commit
  optional SourceControlUser author = 2;

  // committer is the committer of a specific commit
  optional SourceControlUser committer = 3;

  // message is the description of a specific commit
  optional string message = 4;
}

// ImageChangeCause contains information about the image that triggered a
// build
message ImageChangeCause {
  // imageID is the ID of the image that triggered a new build.
  optional string imageID = 1;

  // fromRef contains detailed information about an image that triggered a
  // build.
  optional .k8s.io.api.core.v1.ObjectReference fromRef = 2;
}

// ImageChangeTrigger allows builds to be triggered when an ImageStream changes
message ImageChangeTrigger {
  // lastTriggeredImageID is used internally by the ImageChangeController to save last
  // used image ID for build
  // This field is deprecated and will be removed in a future release.
  // Deprecated
  optional string lastTriggeredImageID = 1;

  // from is a reference to an ImageStreamTag that will trigger a build when updated
  // It is optional. If no From is specified, the From image from the build strategy
  // will be used. Only one ImageChangeTrigger with an empty From reference is allowed in
  // a build configuration.
  optional .k8s.io.api.core.v1.ObjectReference from = 2;

  // paused is true if this trigger is temporarily disabled. Optional.
  optional bool paused = 3;
}

// ImageChangeTriggerStatus tracks the latest resolved status of the associated ImageChangeTrigger policy
// specified in the BuildConfigSpec.Triggers struct.
message ImageChangeTriggerStatus {
  // lastTriggeredImageID represents the sha/id of the ImageStreamTag when a Build for this BuildConfig was started.
  // The lastTriggeredImageID is updated each time a Build for this BuildConfig is started, even if this ImageStreamTag is not the reason the Build is started.
  optional string lastTriggeredImageID = 1;

  // from is the ImageStreamTag that is the source of the trigger.
  optional ImageStreamTagReference from = 2;

  // lastTriggerTime is the last time this particular ImageStreamTag triggered a Build to start.
  // This field is only updated when this trigger specifically started a Build.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTriggerTime = 3;
}

// ImageLabel represents a label applied to the resulting image.
message ImageLabel {
  // name defines the name of the label. It must have non-zero length.
  optional string name = 1;

  // value defines the literal value of the label.
  optional string value = 2;
}

// ImageSource is used to describe build source that will be extracted from an image or used during a
// multi stage build. A reference of type ImageStreamTag, ImageStreamImage or DockerImage may be used.
// A pull secret can be specified to pull the image from an external registry or override the default
// service account secret if pulling from the internal registry. Image sources can either be used to
// extract content from an image and place it into the build context along with the repository source,
// or used directly during a multi-stage container image build to allow content to be copied without overwriting
// the contents of the repository source (see the 'paths' and 'as' fields).
message ImageSource {
  // from is a reference to an ImageStreamTag, ImageStreamImage, or DockerImage to
  // copy source from.
  optional .k8s.io.api.core.v1.ObjectReference from = 1;

  // A list of image names that this source will be used in place of during a multi-stage container image
  // build. For instance, a Dockerfile that uses "COPY --from=nginx:latest" will first check for an image
  // source that has "nginx:latest" in this field before attempting to pull directly. If the Dockerfile
  // does not reference an image source it is ignored. This field and paths may both be set, in which case
  // the contents will be used twice.
  // +optional
  repeated string as = 4;

  // paths is a list of source and destination paths to copy from the image. This content will be copied
  // into the build context prior to starting the build. If no paths are set, the build context will
  // not be altered.
  // +optional
  repeated ImageSourcePath paths = 2;

  // pullSecret is a reference to a secret to be used to pull the image from a registry
  // If the image is pulled from the OpenShift registry, this field does not need to be set.
  optional .k8s.io.api.core.v1.LocalObjectReference pullSecret = 3;
}

// ImageSourcePath describes a path to be copied from a source image and its destination within the build directory.
message ImageSourcePath {
  // sourcePath is the absolute path of the file or directory inside the image to
  // copy to the build directory.  If the source path ends in /. then the content of
  // the directory will be copied, but the directory itself will not be created at the
  // destination.
  optional string sourcePath = 1;

  // destinationDir is the relative directory within the build directory
  // where files copied from the image are placed.
  optional string destinationDir = 2;
}

// ImageStreamTagReference references the ImageStreamTag in an image change trigger by namespace and name.
message ImageStreamTagReference {
  // namespace is the namespace where the ImageStreamTag for an ImageChangeTrigger is located
  optional string namespace = 1;

  // name is the name of the ImageStreamTag for an ImageChangeTrigger
  optional string name = 2;
}

// JenkinsPipelineBuildStrategy holds parameters specific to a Jenkins Pipeline build.
// Deprecated: use OpenShift Pipelines
message JenkinsPipelineBuildStrategy {
  // jenkinsfilePath is the optional path of the Jenkinsfile that will be used to configure the pipeline
  // relative to the root of the context (contextDir). If both JenkinsfilePath & Jenkinsfile are
  // both not specified, this defaults to Jenkinsfile in the root of the specified contextDir.
  optional string jenkinsfilePath = 1;

  // jenkinsfile defines the optional raw contents of a Jenkinsfile which defines a Jenkins pipeline build.
  optional string jenkinsfile = 2;

  // env contains additional environment variables you want to pass into a build pipeline.
  repeated .k8s.io.api.core.v1.EnvVar env = 3;
}

// OptionalNodeSelector is a map that may also be left nil to distinguish between set and unset.
// +protobuf.nullable=true
// +protobuf.options.(gogoproto.goproto_stringer)=false
message OptionalNodeSelector {
  // items, if empty, will result in an empty map

  map<string, string> items = 1;
}

// ProxyConfig defines what proxies to use for an operation
message ProxyConfig {
  // httpProxy is a proxy used to reach the git repository over http
  optional string httpProxy = 3;

  // httpsProxy is a proxy used to reach the git repository over https
  optional string httpsProxy = 4;

  // noProxy is the list of domains for which the proxy should not be used
  optional string noProxy = 5;
}

// SecretBuildSource describes a secret and its destination directory that will be
// used only at the build time. The content of the secret referenced here will
// be copied into the destination directory instead of mounting.
message SecretBuildSource {
  // secret is a reference to an existing secret that you want to use in your
  // build.
  optional .k8s.io.api.core.v1.LocalObjectReference secret = 1;

  // destinationDir is the directory where the files from the secret should be
  // available for the build time.
  // For the Source build strategy, these will be injected into a container
  // where the assemble script runs. Later, when the script finishes, all files
  // injected will be truncated to zero length.
  // For the container image build strategy, these will be copied into the build
  // directory, where the Dockerfile is located, so users can ADD or COPY them
  // during container image build.
  optional string destinationDir = 2;
}

// SecretLocalReference contains information that points to the local secret being used
message SecretLocalReference {
  // name is the name of the resource in the same namespace being referenced
  optional string name = 1;
}

// SecretSpec specifies a secret to be included in a build pod and its corresponding mount point
message SecretSpec {
  // secretSource is a reference to the secret
  optional .k8s.io.api.core.v1.LocalObjectReference secretSource = 1;

  // mountPath is the path at which to mount the secret
  optional string mountPath = 2;
}

// SourceBuildStrategy defines input parameters specific to an Source build.
message SourceBuildStrategy {
  // from is reference to an DockerImage, ImageStreamTag, or ImageStreamImage from which
  // the container image should be pulled
  optional .k8s.io.api.core.v1.ObjectReference from = 1;

  // pullSecret is the name of a Secret that would be used for setting up
  // the authentication for pulling the container images from the private Docker
  // registries
  optional .k8s.io.api.core.v1.LocalObjectReference pullSecret = 2;

  // env contains additional environment variables you want to pass into a builder container.
  repeated .k8s.io.api.core.v1.EnvVar env = 3;

  // scripts is the location of Source scripts
  optional string scripts = 4;

  // incremental flag forces the Source build to do incremental builds if true.
  optional bool incremental = 5;

  // forcePull describes if the builder should pull the images from registry prior to building.
  optional bool forcePull = 6;

  // volumes is a list of input volumes that can be mounted into the builds runtime environment.
  // Only a subset of Kubernetes Volume sources are supported by builds.
  // More info: https://kubernetes.io/docs/concepts/storage/volumes
  // +listType=map
  // +listMapKey=name
  // +patchMergeKey=name
  // +patchStrategy=merge
  repeated BuildVolume volumes = 9;
}

// SourceControlUser defines the identity of a user of source control
message SourceControlUser {
  // name of the source control user
  optional string name = 1;

  // email of the source control user
  optional string email = 2;
}

// SourceRevision is the revision or commit information from the source for the build
message SourceRevision {
  // type of the build source, may be one of 'Source', 'Dockerfile', 'Binary', or 'Images'
  // +k8s:conversion-gen=false
  optional string type = 1;

  // git contains information about git-based build source
  optional GitSourceRevision git = 2;
}

// SourceStrategyOptions contains extra strategy options for Source builds
message SourceStrategyOptions {
  // incremental overrides the source-strategy incremental option in the build config
  optional bool incremental = 1;
}

// StageInfo contains details about a build stage.
message StageInfo {
  // name is a unique identifier for each build stage that occurs.
  optional string name = 1;

  // startTime is a timestamp representing the server time when this Stage started.
  // It is represented in RFC3339 form and is in UTC.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startTime = 2;

  // durationMilliseconds identifies how long the stage took
  // to complete in milliseconds.
  // Note: the duration of a stage can exceed the sum of the duration of the steps within
  // the stage as not all actions are accounted for in explicit build steps.
  optional int64 durationMilliseconds = 3;

  // steps contains details about each step that occurs during a build stage
  // including start time and duration in milliseconds.
  repeated StepInfo steps = 4;
}

// StepInfo contains details about a build step.
message StepInfo {
  // name is a unique identifier for each build step.
  optional string name = 1;

  // startTime is a timestamp representing the server time when this Step started.
  // it is represented in RFC3339 form and is in UTC.
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time startTime = 2;

  // durationMilliseconds identifies how long the step took
  // to complete in milliseconds.
  optional int64 durationMilliseconds = 3;
}

// WebHookTrigger is a trigger that gets invoked using a webhook type of post
message WebHookTrigger {
  // secret used to validate requests.
  // Deprecated: use SecretReference instead.
  optional string secret = 1;

  // allowEnv determines whether the webhook can set environment variables; can only
  // be set to true for GenericWebHook.
  optional bool allowEnv = 2;

  // secretReference is a reference to a secret in the same namespace,
  // containing the value to be validated when the webhook is invoked.
  // The secret being referenced must contain a key named "WebHookSecretKey", the value
  // of which will be checked against the value supplied in the webhook invocation.
  optional SecretLocalReference secretReference = 3;
}

