1 package v1 2 3 import ( 4 "fmt" 5 "time" 6 7 corev1 "k8s.io/api/core/v1" 8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 ) 10 11 // +genclient 12 // +genclient:method=UpdateDetails,verb=update,subresource=details 13 // +genclient:method=Clone,verb=create,subresource=clone,input=BuildRequest 14 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 15 16 // Build encapsulates the inputs needed to produce a new deployable image, as well as 17 // the status of the execution and a reference to the Pod which executed the build. 18 // 19 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 20 // +openshift:compatibility-gen:level=1 21 type Build struct { 22 metav1.TypeMeta `json:",inline"` 23 24 // metadata is the standard object's metadata. 25 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 26 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 27 28 // spec is all the inputs used to execute the build. 29 Spec BuildSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 30 31 // status is the current status of the build. 32 // +optional 33 Status BuildStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 34 } 35 36 // BuildSpec has the information to represent a build and also additional 37 // information about a build 38 type BuildSpec struct { 39 // CommonSpec is the information that represents a build 40 CommonSpec `json:",inline" protobuf:"bytes,1,opt,name=commonSpec"` 41 42 // triggeredBy describes which triggers started the most recent update to the 43 // build configuration and contains information about those triggers. 44 TriggeredBy []BuildTriggerCause `json:"triggeredBy,omitempty" protobuf:"bytes,2,rep,name=triggeredBy"` 45 } 46 47 // OptionalNodeSelector is a map that may also be left nil to distinguish between set and unset. 48 // +protobuf.nullable=true 49 // +protobuf.options.(gogoproto.goproto_stringer)=false 50 type OptionalNodeSelector map[string]string 51 52 func (t OptionalNodeSelector) String() string { 53 return fmt.Sprintf("%v", map[string]string(t)) 54 } 55 56 // CommonSpec encapsulates all the inputs necessary to represent a build. 57 type CommonSpec struct { 58 // serviceAccount is the name of the ServiceAccount to use to run the pod 59 // created by this build. 60 // The pod will be allowed to use secrets referenced by the ServiceAccount 61 ServiceAccount string `json:"serviceAccount,omitempty" protobuf:"bytes,1,opt,name=serviceAccount"` 62 63 // source describes the SCM in use. 64 Source BuildSource `json:"source,omitempty" protobuf:"bytes,2,opt,name=source"` 65 66 // revision is the information from the source for a specific repo snapshot. 67 // This is optional. 68 Revision *SourceRevision `json:"revision,omitempty" protobuf:"bytes,3,opt,name=revision"` 69 70 // strategy defines how to perform a build. 71 Strategy BuildStrategy `json:"strategy" protobuf:"bytes,4,opt,name=strategy"` 72 73 // output describes the container image the Strategy should produce. 74 Output BuildOutput `json:"output,omitempty" protobuf:"bytes,5,opt,name=output"` 75 76 // resources computes resource requirements to execute the build. 77 Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,6,opt,name=resources"` 78 79 // postCommit is a build hook executed after the build output image is 80 // committed, before it is pushed to a registry. 81 PostCommit BuildPostCommitSpec `json:"postCommit,omitempty" protobuf:"bytes,7,opt,name=postCommit"` 82 83 // completionDeadlineSeconds is an optional duration in seconds, counted from 84 // the time when a build pod gets scheduled in the system, that the build may 85 // be active on a node before the system actively tries to terminate the 86 // build; value must be positive integer 87 CompletionDeadlineSeconds *int64 `json:"completionDeadlineSeconds,omitempty" protobuf:"varint,8,opt,name=completionDeadlineSeconds"` 88 89 // nodeSelector is a selector which must be true for the build pod to fit on a node 90 // If nil, it can be overridden by default build nodeselector values for the cluster. 91 // If set to an empty map or a map with any values, default build nodeselector values 92 // are ignored. 93 // +optional 94 NodeSelector OptionalNodeSelector `json:"nodeSelector" protobuf:"bytes,9,name=nodeSelector"` 95 96 // mountTrustedCA bind mounts the cluster's trusted certificate authorities, as defined in 97 // the cluster's proxy configuration, into the build. This lets processes within a build trust 98 // components signed by custom PKI certificate authorities, such as private artifact 99 // repositories and HTTPS proxies. 100 // 101 // When this field is set to true, the contents of `/etc/pki/ca-trust` within the build are 102 // managed by the build container, and any changes to this directory or its subdirectories (for 103 // example - within a Dockerfile `RUN` instruction) are not persisted in the build's output image. 104 MountTrustedCA *bool `json:"mountTrustedCA,omitempty" protobuf:"varint,10,opt,name=mountTrustedCA"` 105 } 106 107 // BuildTriggerCause holds information about a triggered build. It is used for 108 // displaying build trigger data for each build and build configuration in oc 109 // describe. It is also used to describe which triggers led to the most recent 110 // update in the build configuration. 111 type BuildTriggerCause struct { 112 // message is used to store a human readable message for why the build was 113 // triggered. E.g.: "Manually triggered by user", "Configuration change",etc. 114 Message string `json:"message,omitempty" protobuf:"bytes,1,opt,name=message"` 115 116 // genericWebHook holds data about a builds generic webhook trigger. 117 GenericWebHook *GenericWebHookCause `json:"genericWebHook,omitempty" protobuf:"bytes,2,opt,name=genericWebHook"` 118 119 // gitHubWebHook represents data for a GitHub webhook that fired a 120 //specific build. 121 GitHubWebHook *GitHubWebHookCause `json:"githubWebHook,omitempty" protobuf:"bytes,3,opt,name=githubWebHook"` 122 123 // imageChangeBuild stores information about an imagechange event 124 // that triggered a new build. 125 ImageChangeBuild *ImageChangeCause `json:"imageChangeBuild,omitempty" protobuf:"bytes,4,opt,name=imageChangeBuild"` 126 127 // GitLabWebHook represents data for a GitLab webhook that fired a specific 128 // build. 129 GitLabWebHook *GitLabWebHookCause `json:"gitlabWebHook,omitempty" protobuf:"bytes,5,opt,name=gitlabWebHook"` 130 131 // BitbucketWebHook represents data for a Bitbucket webhook that fired a 132 // specific build. 133 BitbucketWebHook *BitbucketWebHookCause `json:"bitbucketWebHook,omitempty" protobuf:"bytes,6,opt,name=bitbucketWebHook"` 134 } 135 136 // GenericWebHookCause holds information about a generic WebHook that 137 // triggered a build. 138 type GenericWebHookCause struct { 139 // revision is an optional field that stores the git source revision 140 // information of the generic webhook trigger when it is available. 141 Revision *SourceRevision `json:"revision,omitempty" protobuf:"bytes,1,opt,name=revision"` 142 143 // secret is the obfuscated webhook secret that triggered a build. 144 Secret string `json:"secret,omitempty" protobuf:"bytes,2,opt,name=secret"` 145 } 146 147 // GitHubWebHookCause has information about a GitHub webhook that triggered a 148 // build. 149 type GitHubWebHookCause struct { 150 // revision is the git revision information of the trigger. 151 Revision *SourceRevision `json:"revision,omitempty" protobuf:"bytes,1,opt,name=revision"` 152 153 // secret is the obfuscated webhook secret that triggered a build. 154 Secret string `json:"secret,omitempty" protobuf:"bytes,2,opt,name=secret"` 155 } 156 157 // CommonWebHookCause factors out the identical format of these webhook 158 // causes into struct so we can share it in the specific causes; it is too late for 159 // GitHub and Generic but we can leverage this pattern with GitLab and Bitbucket. 160 type CommonWebHookCause struct { 161 // Revision is the git source revision information of the trigger. 162 Revision *SourceRevision `json:"revision,omitempty" protobuf:"bytes,1,opt,name=revision"` 163 164 // Secret is the obfuscated webhook secret that triggered a build. 165 Secret string `json:"secret,omitempty" protobuf:"bytes,2,opt,name=secret"` 166 } 167 168 // GitLabWebHookCause has information about a GitLab webhook that triggered a 169 // build. 170 type GitLabWebHookCause struct { 171 CommonWebHookCause `json:",inline" protobuf:"bytes,1,opt,name=commonSpec"` 172 } 173 174 // BitbucketWebHookCause has information about a Bitbucket webhook that triggered a 175 // build. 176 type BitbucketWebHookCause struct { 177 CommonWebHookCause `json:",inline" protobuf:"bytes,1,opt,name=commonSpec"` 178 } 179 180 // ImageChangeCause contains information about the image that triggered a 181 // build 182 type ImageChangeCause struct { 183 // imageID is the ID of the image that triggered a new build. 184 ImageID string `json:"imageID,omitempty" protobuf:"bytes,1,opt,name=imageID"` 185 186 // fromRef contains detailed information about an image that triggered a 187 // build. 188 FromRef *corev1.ObjectReference `json:"fromRef,omitempty" protobuf:"bytes,2,opt,name=fromRef"` 189 } 190 191 // BuildStatus contains the status of a build 192 type BuildStatus struct { 193 // phase is the point in the build lifecycle. Possible values are 194 // "New", "Pending", "Running", "Complete", "Failed", "Error", and "Cancelled". 195 Phase BuildPhase `json:"phase" protobuf:"bytes,1,opt,name=phase,casttype=BuildPhase"` 196 197 // cancelled describes if a cancel event was triggered for the build. 198 Cancelled bool `json:"cancelled,omitempty" protobuf:"varint,2,opt,name=cancelled"` 199 200 // reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI. 201 Reason StatusReason `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason,casttype=StatusReason"` 202 203 // message is a human-readable message indicating details about why the build has this status. 204 Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` 205 206 // startTimestamp is a timestamp representing the server time when this Build started 207 // running in a Pod. 208 // It is represented in RFC3339 form and is in UTC. 209 StartTimestamp *metav1.Time `json:"startTimestamp,omitempty" protobuf:"bytes,5,opt,name=startTimestamp"` 210 211 // completionTimestamp is a timestamp representing the server time when this Build was 212 // finished, whether that build failed or succeeded. It reflects the time at which 213 // the Pod running the Build terminated. 214 // It is represented in RFC3339 form and is in UTC. 215 CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty" protobuf:"bytes,6,opt,name=completionTimestamp"` 216 217 // duration contains time.Duration object describing build time. 218 Duration time.Duration `json:"duration,omitempty" protobuf:"varint,7,opt,name=duration,casttype=time.Duration"` 219 220 // outputDockerImageReference contains a reference to the container image that 221 // will be built by this build. Its value is computed from 222 // Build.Spec.Output.To, and should include the registry address, so that 223 // it can be used to push and pull the image. 224 OutputDockerImageReference string `json:"outputDockerImageReference,omitempty" protobuf:"bytes,8,opt,name=outputDockerImageReference"` 225 226 // config is an ObjectReference to the BuildConfig this Build is based on. 227 Config *corev1.ObjectReference `json:"config,omitempty" protobuf:"bytes,9,opt,name=config"` 228 229 // output describes the container image the build has produced. 230 Output BuildStatusOutput `json:"output,omitempty" protobuf:"bytes,10,opt,name=output"` 231 232 // stages contains details about each stage that occurs during the build 233 // including start time, duration (in milliseconds), and the steps that 234 // occured within each stage. 235 Stages []StageInfo `json:"stages,omitempty" protobuf:"bytes,11,opt,name=stages"` 236 237 // logSnippet is the last few lines of the build log. This value is only set for builds that failed. 238 LogSnippet string `json:"logSnippet,omitempty" protobuf:"bytes,12,opt,name=logSnippet"` 239 240 // Conditions represents the latest available observations of a build's current state. 241 // +patchMergeKey=type 242 // +patchStrategy=merge 243 Conditions []BuildCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,13,rep,name=conditions"` 244 } 245 246 // StageInfo contains details about a build stage. 247 type StageInfo struct { 248 // name is a unique identifier for each build stage that occurs. 249 Name StageName `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 250 251 // startTime is a timestamp representing the server time when this Stage started. 252 // It is represented in RFC3339 form and is in UTC. 253 StartTime metav1.Time `json:"startTime,omitempty" protobuf:"bytes,2,opt,name=startTime"` 254 255 // durationMilliseconds identifies how long the stage took 256 // to complete in milliseconds. 257 // Note: the duration of a stage can exceed the sum of the duration of the steps within 258 // the stage as not all actions are accounted for in explicit build steps. 259 DurationMilliseconds int64 `json:"durationMilliseconds,omitempty" protobuf:"varint,3,opt,name=durationMilliseconds"` 260 261 // steps contains details about each step that occurs during a build stage 262 // including start time and duration in milliseconds. 263 Steps []StepInfo `json:"steps,omitempty" protobuf:"bytes,4,opt,name=steps"` 264 } 265 266 // StageName is the unique identifier for each build stage. 267 type StageName string 268 269 // Valid values for StageName 270 const ( 271 // StageFetchInputs fetches any inputs such as source code. 272 StageFetchInputs StageName = "FetchInputs" 273 274 // StagePullImages pulls any images that are needed such as 275 // base images or input images. 276 StagePullImages StageName = "PullImages" 277 278 // StageBuild performs the steps necessary to build the image. 279 StageBuild StageName = "Build" 280 281 // StagePostCommit executes any post commit steps. 282 StagePostCommit StageName = "PostCommit" 283 284 // StagePushImage pushes the image to the node. 285 StagePushImage StageName = "PushImage" 286 ) 287 288 // StepInfo contains details about a build step. 289 type StepInfo struct { 290 // name is a unique identifier for each build step. 291 Name StepName `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 292 293 // startTime is a timestamp representing the server time when this Step started. 294 // it is represented in RFC3339 form and is in UTC. 295 StartTime metav1.Time `json:"startTime,omitempty" protobuf:"bytes,2,opt,name=startTime"` 296 297 // durationMilliseconds identifies how long the step took 298 // to complete in milliseconds. 299 DurationMilliseconds int64 `json:"durationMilliseconds,omitempty" protobuf:"varint,3,opt,name=durationMilliseconds"` 300 } 301 302 // StepName is a unique identifier for each build step. 303 type StepName string 304 305 // Valid values for StepName 306 const ( 307 // StepExecPostCommitHook executes the buildconfigs post commit hook. 308 StepExecPostCommitHook StepName = "RunPostCommitHook" 309 310 // StepFetchGitSource fetches source code for the build. 311 StepFetchGitSource StepName = "FetchGitSource" 312 313 // StepPullBaseImage pulls a base image for the build. 314 StepPullBaseImage StepName = "PullBaseImage" 315 316 // StepPullInputImage pulls an input image for the build. 317 StepPullInputImage StepName = "PullInputImage" 318 319 // StepPushImage pushes an image to the registry. 320 StepPushImage StepName = "PushImage" 321 322 // StepPushDockerImage pushes a container image to the registry. 323 StepPushDockerImage StepName = "PushDockerImage" 324 325 //StepDockerBuild performs the container image build 326 StepDockerBuild StepName = "DockerBuild" 327 ) 328 329 // BuildPhase represents the status of a build at a point in time. 330 type BuildPhase string 331 332 // Valid values for BuildPhase. 333 const ( 334 // BuildPhaseNew is automatically assigned to a newly created build. 335 BuildPhaseNew BuildPhase = "New" 336 337 // BuildPhasePending indicates that a pod name has been assigned and a build is 338 // about to start running. 339 BuildPhasePending BuildPhase = "Pending" 340 341 // BuildPhaseRunning indicates that a pod has been created and a build is running. 342 BuildPhaseRunning BuildPhase = "Running" 343 344 // BuildPhaseComplete indicates that a build has been successful. 345 BuildPhaseComplete BuildPhase = "Complete" 346 347 // BuildPhaseFailed indicates that a build has executed and failed. 348 BuildPhaseFailed BuildPhase = "Failed" 349 350 // BuildPhaseError indicates that an error prevented the build from executing. 351 BuildPhaseError BuildPhase = "Error" 352 353 // BuildPhaseCancelled indicates that a running/pending build was stopped from executing. 354 BuildPhaseCancelled BuildPhase = "Cancelled" 355 ) 356 357 type BuildConditionType string 358 359 // BuildCondition describes the state of a build at a certain point. 360 type BuildCondition struct { 361 // Type of build condition. 362 Type BuildConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=BuildConditionType"` 363 // Status of the condition, one of True, False, Unknown. 364 Status corev1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/kubernetes/pkg/api/v1.ConditionStatus"` 365 // The last time this condition was updated. 366 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"` 367 // The last time the condition transitioned from one status to another. 368 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 369 // The reason for the condition's last transition. 370 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 371 // A human readable message indicating details about the transition. 372 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 373 } 374 375 // StatusReason is a brief CamelCase string that describes a temporary or 376 // permanent build error condition, meant for machine parsing and tidy display 377 // in the CLI. 378 type StatusReason string 379 380 // BuildStatusOutput contains the status of the built image. 381 type BuildStatusOutput struct { 382 // to describes the status of the built image being pushed to a registry. 383 To *BuildStatusOutputTo `json:"to,omitempty" protobuf:"bytes,1,opt,name=to"` 384 } 385 386 // BuildStatusOutputTo describes the status of the built image with regards to 387 // image registry to which it was supposed to be pushed. 388 type BuildStatusOutputTo struct { 389 // imageDigest is the digest of the built container image. The digest uniquely 390 // identifies the image in the registry to which it was pushed. 391 // 392 // Please note that this field may not always be set even if the push 393 // completes successfully - e.g. when the registry returns no digest or 394 // returns it in a format that the builder doesn't understand. 395 ImageDigest string `json:"imageDigest,omitempty" protobuf:"bytes,1,opt,name=imageDigest"` 396 } 397 398 // BuildSourceType is the type of SCM used. 399 type BuildSourceType string 400 401 // Valid values for BuildSourceType. 402 const ( 403 //BuildSourceGit instructs a build to use a Git source control repository as the build input. 404 BuildSourceGit BuildSourceType = "Git" 405 // BuildSourceDockerfile uses a Dockerfile as the start of a build 406 BuildSourceDockerfile BuildSourceType = "Dockerfile" 407 // BuildSourceBinary indicates the build will accept a Binary file as input. 408 BuildSourceBinary BuildSourceType = "Binary" 409 // BuildSourceImage indicates the build will accept an image as input 410 BuildSourceImage BuildSourceType = "Image" 411 // BuildSourceNone indicates the build has no predefined input (only valid for Source and Custom Strategies) 412 BuildSourceNone BuildSourceType = "None" 413 ) 414 415 // BuildSource is the SCM used for the build. 416 type BuildSource struct { 417 // type of build input to accept 418 // +k8s:conversion-gen=false 419 // +optional 420 Type BuildSourceType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=BuildSourceType"` 421 422 // binary builds accept a binary as their input. The binary is generally assumed to be a tar, 423 // gzipped tar, or zip file depending on the strategy. For container image builds, this is the build 424 // context and an optional Dockerfile may be specified to override any Dockerfile in the 425 // build context. For Source builds, this is assumed to be an archive as described above. For 426 // Source and container image builds, if binary.asFile is set the build will receive a directory with 427 // a single file. contextDir may be used when an archive is provided. Custom builds will 428 // receive this binary as input on STDIN. 429 Binary *BinaryBuildSource `json:"binary,omitempty" protobuf:"bytes,2,opt,name=binary"` 430 431 // dockerfile is the raw contents of a Dockerfile which should be built. When this option is 432 // specified, the FROM may be modified based on your strategy base image and additional ENV 433 // stanzas from your strategy environment will be added after the FROM, but before the rest 434 // of your Dockerfile stanzas. The Dockerfile source type may be used with other options like 435 // git - in those cases the Git repo will have any innate Dockerfile replaced in the context 436 // dir. 437 Dockerfile *string `json:"dockerfile,omitempty" protobuf:"bytes,3,opt,name=dockerfile"` 438 439 // git contains optional information about git build source 440 Git *GitBuildSource `json:"git,omitempty" protobuf:"bytes,4,opt,name=git"` 441 442 // images describes a set of images to be used to provide source for the build 443 Images []ImageSource `json:"images,omitempty" protobuf:"bytes,5,rep,name=images"` 444 445 // contextDir specifies the sub-directory where the source code for the application exists. 446 // This allows to have buildable sources in directory other than root of 447 // repository. 448 ContextDir string `json:"contextDir,omitempty" protobuf:"bytes,6,opt,name=contextDir"` 449 450 // sourceSecret is the name of a Secret that would be used for setting 451 // up the authentication for cloning private repository. 452 // The secret contains valid credentials for remote repository, where the 453 // data's key represent the authentication method to be used and value is 454 // the base64 encoded credentials. Supported auth methods are: ssh-privatekey. 455 SourceSecret *corev1.LocalObjectReference `json:"sourceSecret,omitempty" protobuf:"bytes,7,opt,name=sourceSecret"` 456 457 // secrets represents a list of secrets and their destinations that will 458 // be used only for the build. 459 Secrets []SecretBuildSource `json:"secrets,omitempty" protobuf:"bytes,8,rep,name=secrets"` 460 461 // configMaps represents a list of configMaps and their destinations that will 462 // be used for the build. 463 ConfigMaps []ConfigMapBuildSource `json:"configMaps,omitempty" protobuf:"bytes,9,rep,name=configMaps"` 464 } 465 466 // ImageSource is used to describe build source that will be extracted from an image or used during a 467 // multi stage build. A reference of type ImageStreamTag, ImageStreamImage or DockerImage may be used. 468 // A pull secret can be specified to pull the image from an external registry or override the default 469 // service account secret if pulling from the internal registry. Image sources can either be used to 470 // extract content from an image and place it into the build context along with the repository source, 471 // or used directly during a multi-stage container image build to allow content to be copied without overwriting 472 // the contents of the repository source (see the 'paths' and 'as' fields). 473 type ImageSource struct { 474 // from is a reference to an ImageStreamTag, ImageStreamImage, or DockerImage to 475 // copy source from. 476 From corev1.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"` 477 478 // A list of image names that this source will be used in place of during a multi-stage container image 479 // build. For instance, a Dockerfile that uses "COPY --from=nginx:latest" will first check for an image 480 // source that has "nginx:latest" in this field before attempting to pull directly. If the Dockerfile 481 // does not reference an image source it is ignored. This field and paths may both be set, in which case 482 // the contents will be used twice. 483 // +optional 484 As []string `json:"as,omitempty" protobuf:"bytes,4,rep,name=as"` 485 486 // paths is a list of source and destination paths to copy from the image. This content will be copied 487 // into the build context prior to starting the build. If no paths are set, the build context will 488 // not be altered. 489 // +optional 490 Paths []ImageSourcePath `json:"paths,omitempty" protobuf:"bytes,2,rep,name=paths"` 491 492 // pullSecret is a reference to a secret to be used to pull the image from a registry 493 // If the image is pulled from the OpenShift registry, this field does not need to be set. 494 PullSecret *corev1.LocalObjectReference `json:"pullSecret,omitempty" protobuf:"bytes,3,opt,name=pullSecret"` 495 } 496 497 // ImageSourcePath describes a path to be copied from a source image and its destination within the build directory. 498 type ImageSourcePath struct { 499 // sourcePath is the absolute path of the file or directory inside the image to 500 // copy to the build directory. If the source path ends in /. then the content of 501 // the directory will be copied, but the directory itself will not be created at the 502 // destination. 503 SourcePath string `json:"sourcePath" protobuf:"bytes,1,opt,name=sourcePath"` 504 505 // destinationDir is the relative directory within the build directory 506 // where files copied from the image are placed. 507 DestinationDir string `json:"destinationDir" protobuf:"bytes,2,opt,name=destinationDir"` 508 } 509 510 // SecretBuildSource describes a secret and its destination directory that will be 511 // used only at the build time. The content of the secret referenced here will 512 // be copied into the destination directory instead of mounting. 513 type SecretBuildSource struct { 514 // secret is a reference to an existing secret that you want to use in your 515 // build. 516 Secret corev1.LocalObjectReference `json:"secret" protobuf:"bytes,1,opt,name=secret"` 517 518 // destinationDir is the directory where the files from the secret should be 519 // available for the build time. 520 // For the Source build strategy, these will be injected into a container 521 // where the assemble script runs. Later, when the script finishes, all files 522 // injected will be truncated to zero length. 523 // For the container image build strategy, these will be copied into the build 524 // directory, where the Dockerfile is located, so users can ADD or COPY them 525 // during container image build. 526 DestinationDir string `json:"destinationDir,omitempty" protobuf:"bytes,2,opt,name=destinationDir"` 527 } 528 529 // ConfigMapBuildSource describes a configmap and its destination directory that will be 530 // used only at the build time. The content of the configmap referenced here will 531 // be copied into the destination directory instead of mounting. 532 type ConfigMapBuildSource struct { 533 // configMap is a reference to an existing configmap that you want to use in your 534 // build. 535 ConfigMap corev1.LocalObjectReference `json:"configMap" protobuf:"bytes,1,opt,name=configMap"` 536 537 // destinationDir is the directory where the files from the configmap should be 538 // available for the build time. 539 // For the Source build strategy, these will be injected into a container 540 // where the assemble script runs. 541 // For the container image build strategy, these will be copied into the build 542 // directory, where the Dockerfile is located, so users can ADD or COPY them 543 // during container image build. 544 DestinationDir string `json:"destinationDir,omitempty" protobuf:"bytes,2,opt,name=destinationDir"` 545 } 546 547 // BinaryBuildSource describes a binary file to be used for the Docker and Source build strategies, 548 // where the file will be extracted and used as the build source. 549 type BinaryBuildSource struct { 550 // asFile indicates that the provided binary input should be considered a single file 551 // within the build input. For example, specifying "webapp.war" would place the provided 552 // binary as `/webapp.war` for the builder. If left empty, the Docker and Source build 553 // strategies assume this file is a zip, tar, or tar.gz file and extract it as the source. 554 // The custom strategy receives this binary as standard input. This filename may not 555 // contain slashes or be '..' or '.'. 556 AsFile string `json:"asFile,omitempty" protobuf:"bytes,1,opt,name=asFile"` 557 } 558 559 // SourceRevision is the revision or commit information from the source for the build 560 type SourceRevision struct { 561 // type of the build source, may be one of 'Source', 'Dockerfile', 'Binary', or 'Images' 562 // +k8s:conversion-gen=false 563 Type BuildSourceType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=BuildSourceType"` 564 565 // Git contains information about git-based build source 566 Git *GitSourceRevision `json:"git,omitempty" protobuf:"bytes,2,opt,name=git"` 567 } 568 569 // GitSourceRevision is the commit information from a git source for a build 570 type GitSourceRevision struct { 571 // commit is the commit hash identifying a specific commit 572 Commit string `json:"commit,omitempty" protobuf:"bytes,1,opt,name=commit"` 573 574 // author is the author of a specific commit 575 Author SourceControlUser `json:"author,omitempty" protobuf:"bytes,2,opt,name=author"` 576 577 // committer is the committer of a specific commit 578 Committer SourceControlUser `json:"committer,omitempty" protobuf:"bytes,3,opt,name=committer"` 579 580 // message is the description of a specific commit 581 Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` 582 } 583 584 // ProxyConfig defines what proxies to use for an operation 585 type ProxyConfig struct { 586 // httpProxy is a proxy used to reach the git repository over http 587 HTTPProxy *string `json:"httpProxy,omitempty" protobuf:"bytes,3,opt,name=httpProxy"` 588 589 // httpsProxy is a proxy used to reach the git repository over https 590 HTTPSProxy *string `json:"httpsProxy,omitempty" protobuf:"bytes,4,opt,name=httpsProxy"` 591 592 // noProxy is the list of domains for which the proxy should not be used 593 NoProxy *string `json:"noProxy,omitempty" protobuf:"bytes,5,opt,name=noProxy"` 594 } 595 596 // GitBuildSource defines the parameters of a Git SCM 597 type GitBuildSource struct { 598 // uri points to the source that will be built. The structure of the source 599 // will depend on the type of build to run 600 URI string `json:"uri" protobuf:"bytes,1,opt,name=uri"` 601 602 // ref is the branch/tag/ref to build. 603 Ref string `json:"ref,omitempty" protobuf:"bytes,2,opt,name=ref"` 604 605 // proxyConfig defines the proxies to use for the git clone operation. Values 606 // not set here are inherited from cluster-wide build git proxy settings. 607 ProxyConfig `json:",inline" protobuf:"bytes,3,opt,name=proxyConfig"` 608 } 609 610 // SourceControlUser defines the identity of a user of source control 611 type SourceControlUser struct { 612 // name of the source control user 613 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 614 615 // email of the source control user 616 Email string `json:"email,omitempty" protobuf:"bytes,2,opt,name=email"` 617 } 618 619 // BuildStrategy contains the details of how to perform a build. 620 type BuildStrategy struct { 621 // type is the kind of build strategy. 622 // +k8s:conversion-gen=false 623 // +optional 624 Type BuildStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=BuildStrategyType"` 625 626 // dockerStrategy holds the parameters to the container image build strategy. 627 DockerStrategy *DockerBuildStrategy `json:"dockerStrategy,omitempty" protobuf:"bytes,2,opt,name=dockerStrategy"` 628 629 // sourceStrategy holds the parameters to the Source build strategy. 630 SourceStrategy *SourceBuildStrategy `json:"sourceStrategy,omitempty" protobuf:"bytes,3,opt,name=sourceStrategy"` 631 632 // customStrategy holds the parameters to the Custom build strategy 633 CustomStrategy *CustomBuildStrategy `json:"customStrategy,omitempty" protobuf:"bytes,4,opt,name=customStrategy"` 634 635 // JenkinsPipelineStrategy holds the parameters to the Jenkins Pipeline build strategy. 636 // Deprecated: use OpenShift Pipelines 637 JenkinsPipelineStrategy *JenkinsPipelineBuildStrategy `json:"jenkinsPipelineStrategy,omitempty" protobuf:"bytes,5,opt,name=jenkinsPipelineStrategy"` 638 } 639 640 // BuildStrategyType describes a particular way of performing a build. 641 type BuildStrategyType string 642 643 // Valid values for BuildStrategyType. 644 const ( 645 // DockerBuildStrategyType performs builds using a Dockerfile. 646 DockerBuildStrategyType BuildStrategyType = "Docker" 647 648 // SourceBuildStrategyType performs builds build using Source To Images with a Git repository 649 // and a builder image. 650 SourceBuildStrategyType BuildStrategyType = "Source" 651 652 // CustomBuildStrategyType performs builds using custom builder container image. 653 CustomBuildStrategyType BuildStrategyType = "Custom" 654 655 // JenkinsPipelineBuildStrategyType indicates the build will run via Jenkine Pipeline. 656 JenkinsPipelineBuildStrategyType BuildStrategyType = "JenkinsPipeline" 657 ) 658 659 // CustomBuildStrategy defines input parameters specific to Custom build. 660 type CustomBuildStrategy struct { 661 // from is reference to an DockerImage, ImageStreamTag, or ImageStreamImage from which 662 // the container image should be pulled 663 From corev1.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"` 664 665 // pullSecret is the name of a Secret that would be used for setting up 666 // the authentication for pulling the container images from the private Docker 667 // registries 668 PullSecret *corev1.LocalObjectReference `json:"pullSecret,omitempty" protobuf:"bytes,2,opt,name=pullSecret"` 669 670 // env contains additional environment variables you want to pass into a builder container. 671 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,3,rep,name=env"` 672 673 // exposeDockerSocket will allow running Docker commands (and build container images) from 674 // inside the container. 675 // TODO: Allow admins to enforce 'false' for this option 676 ExposeDockerSocket bool `json:"exposeDockerSocket,omitempty" protobuf:"varint,4,opt,name=exposeDockerSocket"` 677 678 // forcePull describes if the controller should configure the build pod to always pull the images 679 // for the builder or only pull if it is not present locally 680 ForcePull bool `json:"forcePull,omitempty" protobuf:"varint,5,opt,name=forcePull"` 681 682 // secrets is a list of additional secrets that will be included in the build pod 683 Secrets []SecretSpec `json:"secrets,omitempty" protobuf:"bytes,6,rep,name=secrets"` 684 685 // buildAPIVersion is the requested API version for the Build object serialized and passed to the custom builder 686 BuildAPIVersion string `json:"buildAPIVersion,omitempty" protobuf:"bytes,7,opt,name=buildAPIVersion"` 687 } 688 689 // ImageOptimizationPolicy describes what optimizations the builder can perform when building images. 690 type ImageOptimizationPolicy string 691 692 const ( 693 // ImageOptimizationNone will generate a canonical container image as produced by the 694 // `container image build` command. 695 ImageOptimizationNone ImageOptimizationPolicy = "None" 696 697 // ImageOptimizationSkipLayers is an experimental policy and will avoid creating 698 // unique layers for each dockerfile line, resulting in smaller images and saving time 699 // during creation. Some Dockerfile syntax is not fully supported - content added to 700 // a VOLUME by an earlier layer may have incorrect uid, gid, and filesystem permissions. 701 // If an unsupported setting is detected, the build will fail. 702 ImageOptimizationSkipLayers ImageOptimizationPolicy = "SkipLayers" 703 704 // ImageOptimizationSkipLayersAndWarn is the same as SkipLayers, but will only 705 // warn to the build output instead of failing when unsupported syntax is detected. This 706 // policy is experimental. 707 ImageOptimizationSkipLayersAndWarn ImageOptimizationPolicy = "SkipLayersAndWarn" 708 ) 709 710 // DockerBuildStrategy defines input parameters specific to container image build. 711 type DockerBuildStrategy struct { 712 // from is a reference to an DockerImage, ImageStreamTag, or ImageStreamImage which overrides 713 // the FROM image in the Dockerfile for the build. If the Dockerfile uses multi-stage builds, 714 // this will replace the image in the last FROM directive of the file. 715 From *corev1.ObjectReference `json:"from,omitempty" protobuf:"bytes,1,opt,name=from"` 716 717 // pullSecret is the name of a Secret that would be used for setting up 718 // the authentication for pulling the container images from the private Docker 719 // registries 720 PullSecret *corev1.LocalObjectReference `json:"pullSecret,omitempty" protobuf:"bytes,2,opt,name=pullSecret"` 721 722 // noCache if set to true indicates that the container image build must be executed with the 723 // --no-cache=true flag 724 NoCache bool `json:"noCache,omitempty" protobuf:"varint,3,opt,name=noCache"` 725 726 // env contains additional environment variables you want to pass into a builder container. 727 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,4,rep,name=env"` 728 729 // forcePull describes if the builder should pull the images from registry prior to building. 730 ForcePull bool `json:"forcePull,omitempty" protobuf:"varint,5,opt,name=forcePull"` 731 732 // dockerfilePath is the path of the Dockerfile that will be used to build the container image, 733 // relative to the root of the context (contextDir). 734 // Defaults to `Dockerfile` if unset. 735 DockerfilePath string `json:"dockerfilePath,omitempty" protobuf:"bytes,6,opt,name=dockerfilePath"` 736 737 // buildArgs contains build arguments that will be resolved in the Dockerfile. See 738 // https://docs.docker.com/engine/reference/builder/#/arg for more details. 739 // NOTE: Only the 'name' and 'value' fields are supported. Any settings on the 'valueFrom' field 740 // are ignored. 741 BuildArgs []corev1.EnvVar `json:"buildArgs,omitempty" protobuf:"bytes,7,rep,name=buildArgs"` 742 743 // imageOptimizationPolicy describes what optimizations the system can use when building images 744 // to reduce the final size or time spent building the image. The default policy is 'None' which 745 // means the final build image will be equivalent to an image created by the container image build API. 746 // The experimental policy 'SkipLayers' will avoid commiting new layers in between each 747 // image step, and will fail if the Dockerfile cannot provide compatibility with the 'None' 748 // policy. An additional experimental policy 'SkipLayersAndWarn' is the same as 749 // 'SkipLayers' but simply warns if compatibility cannot be preserved. 750 ImageOptimizationPolicy *ImageOptimizationPolicy `json:"imageOptimizationPolicy,omitempty" protobuf:"bytes,8,opt,name=imageOptimizationPolicy,casttype=ImageOptimizationPolicy"` 751 752 // volumes is a list of input volumes that can be mounted into the builds runtime environment. 753 // Only a subset of Kubernetes Volume sources are supported by builds. 754 // More info: https://kubernetes.io/docs/concepts/storage/volumes 755 // +listType=map 756 // +listMapKey=name 757 // +patchMergeKey=name 758 // +patchStrategy=merge 759 Volumes []BuildVolume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,9,opt,name=volumes"` 760 } 761 762 // SourceBuildStrategy defines input parameters specific to an Source build. 763 type SourceBuildStrategy struct { 764 // from is reference to an DockerImage, ImageStreamTag, or ImageStreamImage from which 765 // the container image should be pulled 766 From corev1.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"` 767 768 // pullSecret is the name of a Secret that would be used for setting up 769 // the authentication for pulling the container images from the private Docker 770 // registries 771 PullSecret *corev1.LocalObjectReference `json:"pullSecret,omitempty" protobuf:"bytes,2,opt,name=pullSecret"` 772 773 // env contains additional environment variables you want to pass into a builder container. 774 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,3,rep,name=env"` 775 776 // scripts is the location of Source scripts 777 Scripts string `json:"scripts,omitempty" protobuf:"bytes,4,opt,name=scripts"` 778 779 // incremental flag forces the Source build to do incremental builds if true. 780 Incremental *bool `json:"incremental,omitempty" protobuf:"varint,5,opt,name=incremental"` 781 782 // forcePull describes if the builder should pull the images from registry prior to building. 783 ForcePull bool `json:"forcePull,omitempty" protobuf:"varint,6,opt,name=forcePull"` 784 785 // deprecated json field, do not reuse: runtimeImage 786 // +k8s:protobuf-deprecated=runtimeImage,7 787 788 // deprecated json field, do not reuse: runtimeArtifacts 789 // +k8s:protobuf-deprecated=runtimeArtifacts,8 790 791 // volumes is a list of input volumes that can be mounted into the builds runtime environment. 792 // Only a subset of Kubernetes Volume sources are supported by builds. 793 // More info: https://kubernetes.io/docs/concepts/storage/volumes 794 // +listType=map 795 // +listMapKey=name 796 // +patchMergeKey=name 797 // +patchStrategy=merge 798 Volumes []BuildVolume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,9,opt,name=volumes"` 799 } 800 801 // JenkinsPipelineBuildStrategy holds parameters specific to a Jenkins Pipeline build. 802 // Deprecated: use OpenShift Pipelines 803 type JenkinsPipelineBuildStrategy struct { 804 // JenkinsfilePath is the optional path of the Jenkinsfile that will be used to configure the pipeline 805 // relative to the root of the context (contextDir). If both JenkinsfilePath & Jenkinsfile are 806 // both not specified, this defaults to Jenkinsfile in the root of the specified contextDir. 807 JenkinsfilePath string `json:"jenkinsfilePath,omitempty" protobuf:"bytes,1,opt,name=jenkinsfilePath"` 808 809 // Jenkinsfile defines the optional raw contents of a Jenkinsfile which defines a Jenkins pipeline build. 810 Jenkinsfile string `json:"jenkinsfile,omitempty" protobuf:"bytes,2,opt,name=jenkinsfile"` 811 812 // env contains additional environment variables you want to pass into a build pipeline. 813 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,3,rep,name=env"` 814 } 815 816 // A BuildPostCommitSpec holds a build post commit hook specification. The hook 817 // executes a command in a temporary container running the build output image, 818 // immediately after the last layer of the image is committed and before the 819 // image is pushed to a registry. The command is executed with the current 820 // working directory ($PWD) set to the image's WORKDIR. 821 // 822 // The build will be marked as failed if the hook execution fails. It will fail 823 // if the script or command return a non-zero exit code, or if there is any 824 // other error related to starting the temporary container. 825 // 826 // There are five different ways to configure the hook. As an example, all forms 827 // below are equivalent and will execute `rake test --verbose`. 828 // 829 // 1. Shell script: 830 // 831 // "postCommit": { 832 // "script": "rake test --verbose", 833 // } 834 // 835 // The above is a convenient form which is equivalent to: 836 // 837 // "postCommit": { 838 // "command": ["/bin/sh", "-ic"], 839 // "args": ["rake test --verbose"] 840 // } 841 // 842 // 2. A command as the image entrypoint: 843 // 844 // "postCommit": { 845 // "commit": ["rake", "test", "--verbose"] 846 // } 847 // 848 // Command overrides the image entrypoint in the exec form, as documented in 849 // Docker: https://docs.docker.com/engine/reference/builder/#entrypoint. 850 // 851 // 3. Pass arguments to the default entrypoint: 852 // 853 // "postCommit": { 854 // "args": ["rake", "test", "--verbose"] 855 // } 856 // 857 // This form is only useful if the image entrypoint can handle arguments. 858 // 859 // 4. Shell script with arguments: 860 // 861 // "postCommit": { 862 // "script": "rake test $1", 863 // "args": ["--verbose"] 864 // } 865 // 866 // This form is useful if you need to pass arguments that would otherwise be 867 // hard to quote properly in the shell script. In the script, $0 will be 868 // "/bin/sh" and $1, $2, etc, are the positional arguments from Args. 869 // 870 // 5. Command with arguments: 871 // 872 // "postCommit": { 873 // "command": ["rake", "test"], 874 // "args": ["--verbose"] 875 // } 876 // 877 // This form is equivalent to appending the arguments to the Command slice. 878 // 879 // It is invalid to provide both Script and Command simultaneously. If none of 880 // the fields are specified, the hook is not executed. 881 type BuildPostCommitSpec struct { 882 // command is the command to run. It may not be specified with Script. 883 // This might be needed if the image doesn't have `/bin/sh`, or if you 884 // do not want to use a shell. In all other cases, using Script might be 885 // more convenient. 886 Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"` 887 // args is a list of arguments that are provided to either Command, 888 // Script or the container image's default entrypoint. The arguments are 889 // placed immediately after the command to be run. 890 Args []string `json:"args,omitempty" protobuf:"bytes,2,rep,name=args"` 891 // script is a shell script to be run with `/bin/sh -ic`. It may not be 892 // specified with Command. Use Script when a shell script is appropriate 893 // to execute the post build hook, for example for running unit tests 894 // with `rake test`. If you need control over the image entrypoint, or 895 // if the image does not have `/bin/sh`, use Command and/or Args. 896 // The `-i` flag is needed to support CentOS and RHEL images that use 897 // Software Collections (SCL), in order to have the appropriate 898 // collections enabled in the shell. E.g., in the Ruby image, this is 899 // necessary to make `ruby`, `bundle` and other binaries available in 900 // the PATH. 901 Script string `json:"script,omitempty" protobuf:"bytes,3,opt,name=script"` 902 } 903 904 // BuildOutput is input to a build strategy and describes the container image that the strategy 905 // should produce. 906 type BuildOutput struct { 907 // to defines an optional location to push the output of this build to. 908 // Kind must be one of 'ImageStreamTag' or 'DockerImage'. 909 // This value will be used to look up a container image repository to push to. 910 // In the case of an ImageStreamTag, the ImageStreamTag will be looked for in the namespace of 911 // the build unless Namespace is specified. 912 To *corev1.ObjectReference `json:"to,omitempty" protobuf:"bytes,1,opt,name=to"` 913 914 // PushSecret is the name of a Secret that would be used for setting 915 // up the authentication for executing the Docker push to authentication 916 // enabled Docker Registry (or Docker Hub). 917 PushSecret *corev1.LocalObjectReference `json:"pushSecret,omitempty" protobuf:"bytes,2,opt,name=pushSecret"` 918 919 // imageLabels define a list of labels that are applied to the resulting image. If there 920 // are multiple labels with the same name then the last one in the list is used. 921 ImageLabels []ImageLabel `json:"imageLabels,omitempty" protobuf:"bytes,3,rep,name=imageLabels"` 922 } 923 924 // ImageLabel represents a label applied to the resulting image. 925 type ImageLabel struct { 926 // name defines the name of the label. It must have non-zero length. 927 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 928 929 // value defines the literal value of the label. 930 Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` 931 } 932 933 // +genclient 934 // +genclient:method=Instantiate,verb=create,subresource=instantiate,input=BuildRequest,result=Build 935 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 936 937 // 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. 938 // 939 // 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. 940 // 941 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 942 // +openshift:compatibility-gen:level=1 943 type BuildConfig struct { 944 metav1.TypeMeta `json:",inline"` 945 946 // metadata is the standard object's metadata. 947 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 948 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 949 950 // spec holds all the input necessary to produce a new build, and the conditions when 951 // to trigger them. 952 Spec BuildConfigSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` 953 // status holds any relevant information about a build config 954 // +optional 955 Status BuildConfigStatus `json:"status" protobuf:"bytes,3,opt,name=status"` 956 } 957 958 // BuildConfigSpec describes when and how builds are created 959 type BuildConfigSpec struct { 960 961 //triggers determine how new Builds can be launched from a BuildConfig. If 962 //no triggers are defined, a new build can only occur as a result of an 963 //explicit client build creation. 964 // +optional 965 Triggers []BuildTriggerPolicy `json:"triggers,omitempty" protobuf:"bytes,1,rep,name=triggers"` 966 967 // RunPolicy describes how the new build created from this build 968 // configuration will be scheduled for execution. 969 // This is optional, if not specified we default to "Serial". 970 RunPolicy BuildRunPolicy `json:"runPolicy,omitempty" protobuf:"bytes,2,opt,name=runPolicy,casttype=BuildRunPolicy"` 971 972 // CommonSpec is the desired build specification 973 CommonSpec `json:",inline" protobuf:"bytes,3,opt,name=commonSpec"` 974 975 // successfulBuildsHistoryLimit is the number of old successful builds to retain. 976 // When a BuildConfig is created, the 5 most recent successful builds are retained unless this value is set. 977 // If removed after the BuildConfig has been created, all successful builds are retained. 978 SuccessfulBuildsHistoryLimit *int32 `json:"successfulBuildsHistoryLimit,omitempty" protobuf:"varint,4,opt,name=successfulBuildsHistoryLimit"` 979 980 // failedBuildsHistoryLimit is the number of old failed builds to retain. 981 // When a BuildConfig is created, the 5 most recent failed builds are retained unless this value is set. 982 // If removed after the BuildConfig has been created, all failed builds are retained. 983 FailedBuildsHistoryLimit *int32 `json:"failedBuildsHistoryLimit,omitempty" protobuf:"varint,5,opt,name=failedBuildsHistoryLimit"` 984 } 985 986 // BuildRunPolicy defines the behaviour of how the new builds are executed 987 // from the existing build configuration. 988 type BuildRunPolicy string 989 990 const ( 991 // BuildRunPolicyParallel schedules new builds immediately after they are 992 // created. Builds will be executed in parallel. 993 BuildRunPolicyParallel BuildRunPolicy = "Parallel" 994 995 // BuildRunPolicySerial schedules new builds to execute in a sequence as 996 // they are created. Every build gets queued up and will execute when the 997 // previous build completes. This is the default policy. 998 BuildRunPolicySerial BuildRunPolicy = "Serial" 999 1000 // BuildRunPolicySerialLatestOnly schedules only the latest build to execute, 1001 // cancelling all the previously queued build. 1002 BuildRunPolicySerialLatestOnly BuildRunPolicy = "SerialLatestOnly" 1003 ) 1004 1005 // BuildConfigStatus contains current state of the build config object. 1006 type BuildConfigStatus struct { 1007 // lastVersion is used to inform about number of last triggered build. 1008 LastVersion int64 `json:"lastVersion" protobuf:"varint,1,opt,name=lastVersion"` 1009 1010 // ImageChangeTriggers captures the runtime state of any ImageChangeTrigger specified in the BuildConfigSpec, 1011 // including the value reconciled by the OpenShift APIServer for the lastTriggeredImageID. There is a single entry 1012 // in this array for each image change trigger in spec. Each trigger status references the ImageStreamTag that acts as the source of the trigger. 1013 ImageChangeTriggers []ImageChangeTriggerStatus `json:"imageChangeTriggers,omitempty" protobuf:"bytes,2,rep,name=imageChangeTriggers"` 1014 } 1015 1016 // SecretLocalReference contains information that points to the local secret being used 1017 type SecretLocalReference struct { 1018 // Name is the name of the resource in the same namespace being referenced 1019 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1020 } 1021 1022 // WebHookTrigger is a trigger that gets invoked using a webhook type of post 1023 type WebHookTrigger struct { 1024 // secret used to validate requests. 1025 // Deprecated: use SecretReference instead. 1026 Secret string `json:"secret,omitempty" protobuf:"bytes,1,opt,name=secret"` 1027 1028 // allowEnv determines whether the webhook can set environment variables; can only 1029 // be set to true for GenericWebHook. 1030 AllowEnv bool `json:"allowEnv,omitempty" protobuf:"varint,2,opt,name=allowEnv"` 1031 1032 // secretReference is a reference to a secret in the same namespace, 1033 // containing the value to be validated when the webhook is invoked. 1034 // The secret being referenced must contain a key named "WebHookSecretKey", the value 1035 // of which will be checked against the value supplied in the webhook invocation. 1036 SecretReference *SecretLocalReference `json:"secretReference,omitempty" protobuf:"bytes,3,opt,name=secretReference"` 1037 } 1038 1039 // ImageChangeTrigger allows builds to be triggered when an ImageStream changes 1040 type ImageChangeTrigger struct { 1041 // lastTriggeredImageID is used internally by the ImageChangeController to save last 1042 // used image ID for build 1043 // This field is deprecated and will be removed in a future release. 1044 // Deprecated 1045 LastTriggeredImageID string `json:"lastTriggeredImageID,omitempty" protobuf:"bytes,1,opt,name=lastTriggeredImageID"` 1046 1047 // from is a reference to an ImageStreamTag that will trigger a build when updated 1048 // It is optional. If no From is specified, the From image from the build strategy 1049 // will be used. Only one ImageChangeTrigger with an empty From reference is allowed in 1050 // a build configuration. 1051 From *corev1.ObjectReference `json:"from,omitempty" protobuf:"bytes,2,opt,name=from"` 1052 1053 // paused is true if this trigger is temporarily disabled. Optional. 1054 Paused bool `json:"paused,omitempty" protobuf:"varint,3,opt,name=paused"` 1055 } 1056 1057 // ImageStreamTagReference references the ImageStreamTag in an image change trigger by namespace and name. 1058 type ImageStreamTagReference struct { 1059 // namespace is the namespace where the ImageStreamTag for an ImageChangeTrigger is located 1060 Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` 1061 1062 // name is the name of the ImageStreamTag for an ImageChangeTrigger 1063 Name string `json:"name,omitempty" protobuf:"bytes,2,opt,name=name"` 1064 } 1065 1066 // ImageChangeTriggerStatus tracks the latest resolved status of the associated ImageChangeTrigger policy 1067 // specified in the BuildConfigSpec.Triggers struct. 1068 type ImageChangeTriggerStatus struct { 1069 // lastTriggeredImageID represents the sha/id of the ImageStreamTag when a Build for this BuildConfig was started. 1070 // 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. 1071 LastTriggeredImageID string `json:"lastTriggeredImageID,omitempty" protobuf:"bytes,1,opt,name=lastTriggeredImageID"` 1072 1073 // from is the ImageStreamTag that is the source of the trigger. 1074 From ImageStreamTagReference `json:"from,omitempty" protobuf:"bytes,2,opt,name=from"` 1075 1076 // lastTriggerTime is the last time this particular ImageStreamTag triggered a Build to start. 1077 // This field is only updated when this trigger specifically started a Build. 1078 LastTriggerTime metav1.Time `json:"lastTriggerTime,omitempty" protobuf:"bytes,3,opt,name=lastTriggerTime"` 1079 } 1080 1081 // BuildTriggerPolicy describes a policy for a single trigger that results in a new Build. 1082 type BuildTriggerPolicy struct { 1083 // type is the type of build trigger. Valid values: 1084 // 1085 // - GitHub 1086 // GitHubWebHookBuildTriggerType represents a trigger that launches builds on 1087 // GitHub webhook invocations 1088 // 1089 // - Generic 1090 // GenericWebHookBuildTriggerType represents a trigger that launches builds on 1091 // generic webhook invocations 1092 // 1093 // - GitLab 1094 // GitLabWebHookBuildTriggerType represents a trigger that launches builds on 1095 // GitLab webhook invocations 1096 // 1097 // - Bitbucket 1098 // BitbucketWebHookBuildTriggerType represents a trigger that launches builds on 1099 // Bitbucket webhook invocations 1100 // 1101 // - ImageChange 1102 // ImageChangeBuildTriggerType represents a trigger that launches builds on 1103 // availability of a new version of an image 1104 // 1105 // - ConfigChange 1106 // ConfigChangeBuildTriggerType will trigger a build on an initial build config creation 1107 // WARNING: In the future the behavior will change to trigger a build on any config change 1108 Type BuildTriggerType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=BuildTriggerType"` 1109 1110 // github contains the parameters for a GitHub webhook type of trigger 1111 GitHubWebHook *WebHookTrigger `json:"github,omitempty" protobuf:"bytes,2,opt,name=github"` 1112 1113 // generic contains the parameters for a Generic webhook type of trigger 1114 GenericWebHook *WebHookTrigger `json:"generic,omitempty" protobuf:"bytes,3,opt,name=generic"` 1115 1116 // imageChange contains parameters for an ImageChange type of trigger 1117 ImageChange *ImageChangeTrigger `json:"imageChange,omitempty" protobuf:"bytes,4,opt,name=imageChange"` 1118 1119 // GitLabWebHook contains the parameters for a GitLab webhook type of trigger 1120 GitLabWebHook *WebHookTrigger `json:"gitlab,omitempty" protobuf:"bytes,5,opt,name=gitlab"` 1121 1122 // BitbucketWebHook contains the parameters for a Bitbucket webhook type of 1123 // trigger 1124 BitbucketWebHook *WebHookTrigger `json:"bitbucket,omitempty" protobuf:"bytes,6,opt,name=bitbucket"` 1125 } 1126 1127 // BuildTriggerType refers to a specific BuildTriggerPolicy implementation. 1128 type BuildTriggerType string 1129 1130 const ( 1131 // GitHubWebHookBuildTriggerType represents a trigger that launches builds on 1132 // GitHub webhook invocations 1133 GitHubWebHookBuildTriggerType BuildTriggerType = "GitHub" 1134 GitHubWebHookBuildTriggerTypeDeprecated BuildTriggerType = "github" 1135 1136 // GenericWebHookBuildTriggerType represents a trigger that launches builds on 1137 // generic webhook invocations 1138 GenericWebHookBuildTriggerType BuildTriggerType = "Generic" 1139 GenericWebHookBuildTriggerTypeDeprecated BuildTriggerType = "generic" 1140 1141 // GitLabWebHookBuildTriggerType represents a trigger that launches builds on 1142 // GitLab webhook invocations 1143 GitLabWebHookBuildTriggerType BuildTriggerType = "GitLab" 1144 1145 // BitbucketWebHookBuildTriggerType represents a trigger that launches builds on 1146 // Bitbucket webhook invocations 1147 BitbucketWebHookBuildTriggerType BuildTriggerType = "Bitbucket" 1148 1149 // ImageChangeBuildTriggerType represents a trigger that launches builds on 1150 // availability of a new version of an image 1151 ImageChangeBuildTriggerType BuildTriggerType = "ImageChange" 1152 ImageChangeBuildTriggerTypeDeprecated BuildTriggerType = "imageChange" 1153 1154 // ConfigChangeBuildTriggerType will trigger a build on an initial build config creation 1155 // WARNING: In the future the behavior will change to trigger a build on any config change 1156 ConfigChangeBuildTriggerType BuildTriggerType = "ConfigChange" 1157 ) 1158 1159 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1160 1161 // BuildList is a collection of Builds. 1162 // 1163 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1164 // +openshift:compatibility-gen:level=1 1165 type BuildList struct { 1166 metav1.TypeMeta `json:",inline"` 1167 1168 // metadata is the standard list's metadata. 1169 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 1170 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 1171 1172 // items is a list of builds 1173 Items []Build `json:"items" protobuf:"bytes,2,rep,name=items"` 1174 } 1175 1176 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1177 1178 // BuildConfigList is a collection of BuildConfigs. 1179 // 1180 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1181 // +openshift:compatibility-gen:level=1 1182 type BuildConfigList struct { 1183 metav1.TypeMeta `json:",inline"` 1184 1185 // metadata is the standard list's metadata. 1186 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 1187 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 1188 1189 // items is a list of build configs 1190 Items []BuildConfig `json:"items" protobuf:"bytes,2,rep,name=items"` 1191 } 1192 1193 // GenericWebHookEvent is the payload expected for a generic webhook post 1194 type GenericWebHookEvent struct { 1195 // type is the type of source repository 1196 // +k8s:conversion-gen=false 1197 Type BuildSourceType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=BuildSourceType"` 1198 1199 // git is the git information if the Type is BuildSourceGit 1200 Git *GitInfo `json:"git,omitempty" protobuf:"bytes,2,opt,name=git"` 1201 1202 // env contains additional environment variables you want to pass into a builder container. 1203 // ValueFrom is not supported. 1204 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,3,rep,name=env"` 1205 1206 // DockerStrategyOptions contains additional docker-strategy specific options for the build 1207 DockerStrategyOptions *DockerStrategyOptions `json:"dockerStrategyOptions,omitempty" protobuf:"bytes,4,opt,name=dockerStrategyOptions"` 1208 } 1209 1210 // GitInfo is the aggregated git information for a generic webhook post 1211 type GitInfo struct { 1212 GitBuildSource `json:",inline" protobuf:"bytes,1,opt,name=gitBuildSource"` 1213 GitSourceRevision `json:",inline" protobuf:"bytes,2,opt,name=gitSourceRevision"` 1214 1215 // Refs is a list of GitRefs for the provided repo - generally sent 1216 // when used from a post-receive hook. This field is optional and is 1217 // used when sending multiple refs 1218 Refs []GitRefInfo `json:"refs" protobuf:"bytes,3,rep,name=refs"` 1219 } 1220 1221 // GitRefInfo is a single ref 1222 type GitRefInfo struct { 1223 GitBuildSource `json:",inline" protobuf:"bytes,1,opt,name=gitBuildSource"` 1224 GitSourceRevision `json:",inline" protobuf:"bytes,2,opt,name=gitSourceRevision"` 1225 } 1226 1227 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1228 1229 // BuildLog is the (unused) resource associated with the build log redirector 1230 // 1231 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1232 // +openshift:compatibility-gen:level=1 1233 type BuildLog struct { 1234 metav1.TypeMeta `json:",inline"` 1235 } 1236 1237 // DockerStrategyOptions contains extra strategy options for container image builds 1238 type DockerStrategyOptions struct { 1239 // Args contains any build arguments that are to be passed to Docker. See 1240 // https://docs.docker.com/engine/reference/builder/#/arg for more details 1241 BuildArgs []corev1.EnvVar `json:"buildArgs,omitempty" protobuf:"bytes,1,rep,name=buildArgs"` 1242 1243 // noCache overrides the docker-strategy noCache option in the build config 1244 NoCache *bool `json:"noCache,omitempty" protobuf:"varint,2,opt,name=noCache"` 1245 } 1246 1247 // SourceStrategyOptions contains extra strategy options for Source builds 1248 type SourceStrategyOptions struct { 1249 // incremental overrides the source-strategy incremental option in the build config 1250 Incremental *bool `json:"incremental,omitempty" protobuf:"varint,1,opt,name=incremental"` 1251 } 1252 1253 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1254 1255 // BuildRequest is the resource used to pass parameters to build generator 1256 // 1257 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1258 // +openshift:compatibility-gen:level=1 1259 type BuildRequest struct { 1260 metav1.TypeMeta `json:",inline"` 1261 1262 // metadata is the standard object's metadata. 1263 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 1264 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 1265 1266 // revision is the information from the source for a specific repo snapshot. 1267 Revision *SourceRevision `json:"revision,omitempty" protobuf:"bytes,2,opt,name=revision"` 1268 1269 // triggeredByImage is the Image that triggered this build. 1270 TriggeredByImage *corev1.ObjectReference `json:"triggeredByImage,omitempty" protobuf:"bytes,3,opt,name=triggeredByImage"` 1271 1272 // from is the reference to the ImageStreamTag that triggered the build. 1273 From *corev1.ObjectReference `json:"from,omitempty" protobuf:"bytes,4,opt,name=from"` 1274 1275 // binary indicates a request to build from a binary provided to the builder 1276 Binary *BinaryBuildSource `json:"binary,omitempty" protobuf:"bytes,5,opt,name=binary"` 1277 1278 // lastVersion (optional) is the LastVersion of the BuildConfig that was used 1279 // to generate the build. If the BuildConfig in the generator doesn't match, a build will 1280 // not be generated. 1281 LastVersion *int64 `json:"lastVersion,omitempty" protobuf:"varint,6,opt,name=lastVersion"` 1282 1283 // env contains additional environment variables you want to pass into a builder container. 1284 Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,7,rep,name=env"` 1285 1286 // triggeredBy describes which triggers started the most recent update to the 1287 // build configuration and contains information about those triggers. 1288 TriggeredBy []BuildTriggerCause `json:"triggeredBy,omitempty" protobuf:"bytes,8,rep,name=triggeredBy"` 1289 1290 // DockerStrategyOptions contains additional docker-strategy specific options for the build 1291 DockerStrategyOptions *DockerStrategyOptions `json:"dockerStrategyOptions,omitempty" protobuf:"bytes,9,opt,name=dockerStrategyOptions"` 1292 1293 // SourceStrategyOptions contains additional source-strategy specific options for the build 1294 SourceStrategyOptions *SourceStrategyOptions `json:"sourceStrategyOptions,omitempty" protobuf:"bytes,10,opt,name=sourceStrategyOptions"` 1295 } 1296 1297 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1298 1299 // BinaryBuildRequestOptions are the options required to fully speficy a binary build request 1300 // 1301 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1302 // +openshift:compatibility-gen:level=1 1303 type BinaryBuildRequestOptions struct { 1304 metav1.TypeMeta `json:",inline"` 1305 1306 // metadata is the standard object's metadata. 1307 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 1308 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 1309 1310 // asFile determines if the binary should be created as a file within the source rather than extracted as an archive 1311 AsFile string `json:"asFile,omitempty" protobuf:"bytes,2,opt,name=asFile"` 1312 1313 // TODO: Improve map[string][]string conversion so we can handled nested objects 1314 1315 // revision.commit is the value identifying a specific commit 1316 Commit string `json:"revision.commit,omitempty" protobuf:"bytes,3,opt,name=revisionCommit"` 1317 1318 // revision.message is the description of a specific commit 1319 Message string `json:"revision.message,omitempty" protobuf:"bytes,4,opt,name=revisionMessage"` 1320 1321 // revision.authorName of the source control user 1322 AuthorName string `json:"revision.authorName,omitempty" protobuf:"bytes,5,opt,name=revisionAuthorName"` 1323 1324 // revision.authorEmail of the source control user 1325 AuthorEmail string `json:"revision.authorEmail,omitempty" protobuf:"bytes,6,opt,name=revisionAuthorEmail"` 1326 1327 // revision.committerName of the source control user 1328 CommitterName string `json:"revision.committerName,omitempty" protobuf:"bytes,7,opt,name=revisionCommitterName"` 1329 1330 // revision.committerEmail of the source control user 1331 CommitterEmail string `json:"revision.committerEmail,omitempty" protobuf:"bytes,8,opt,name=revisionCommitterEmail"` 1332 } 1333 1334 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 1335 1336 // BuildLogOptions is the REST options for a build log 1337 // 1338 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 1339 // +openshift:compatibility-gen:level=1 1340 type BuildLogOptions struct { 1341 metav1.TypeMeta `json:",inline"` 1342 1343 // cointainer for which to stream logs. Defaults to only container if there is one container in the pod. 1344 Container string `json:"container,omitempty" protobuf:"bytes,1,opt,name=container"` 1345 // follow if true indicates that the build log should be streamed until 1346 // the build terminates. 1347 Follow bool `json:"follow,omitempty" protobuf:"varint,2,opt,name=follow"` 1348 // previous returns previous build logs. Defaults to false. 1349 Previous bool `json:"previous,omitempty" protobuf:"varint,3,opt,name=previous"` 1350 // sinceSeconds is a relative time in seconds before the current time from which to show logs. If this value 1351 // precedes the time a pod was started, only logs since the pod start will be returned. 1352 // If this value is in the future, no logs will be returned. 1353 // Only one of sinceSeconds or sinceTime may be specified. 1354 SinceSeconds *int64 `json:"sinceSeconds,omitempty" protobuf:"varint,4,opt,name=sinceSeconds"` 1355 // sinceTime is an RFC3339 timestamp from which to show logs. If this value 1356 // precedes the time a pod was started, only logs since the pod start will be returned. 1357 // If this value is in the future, no logs will be returned. 1358 // Only one of sinceSeconds or sinceTime may be specified. 1359 SinceTime *metav1.Time `json:"sinceTime,omitempty" protobuf:"bytes,5,opt,name=sinceTime"` 1360 // timestamps, If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line 1361 // of log output. Defaults to false. 1362 Timestamps bool `json:"timestamps,omitempty" protobuf:"varint,6,opt,name=timestamps"` 1363 // tailLines, If set, is the number of lines from the end of the logs to show. If not specified, 1364 // logs are shown from the creation of the container or sinceSeconds or sinceTime 1365 TailLines *int64 `json:"tailLines,omitempty" protobuf:"varint,7,opt,name=tailLines"` 1366 // limitBytes, If set, is the number of bytes to read from the server before terminating the 1367 // log output. This may not display a complete final line of logging, and may return 1368 // slightly more or slightly less than the specified limit. 1369 LimitBytes *int64 `json:"limitBytes,omitempty" protobuf:"varint,8,opt,name=limitBytes"` 1370 1371 // noWait if true causes the call to return immediately even if the build 1372 // is not available yet. Otherwise the server will wait until the build has started. 1373 // TODO: Fix the tag to 'noWait' in v2 1374 NoWait bool `json:"nowait,omitempty" protobuf:"varint,9,opt,name=nowait"` 1375 1376 // version of the build for which to view logs. 1377 Version *int64 `json:"version,omitempty" protobuf:"varint,10,opt,name=version"` 1378 1379 // insecureSkipTLSVerifyBackend indicates that the apiserver should not confirm the validity of the 1380 // serving certificate of the backend it is connecting to. This will make the HTTPS connection between the apiserver 1381 // and the backend insecure. This means the apiserver cannot verify the log data it is receiving came from the real 1382 // kubelet. If the kubelet is configured to verify the apiserver's TLS credentials, it does not mean the 1383 // connection to the real kubelet is vulnerable to a man in the middle attack (e.g. an attacker could not intercept 1384 // the actual log data coming from the real kubelet). 1385 // +optional 1386 InsecureSkipTLSVerifyBackend bool `json:"insecureSkipTLSVerifyBackend,omitempty" protobuf:"varint,11,opt,name=insecureSkipTLSVerifyBackend"` 1387 } 1388 1389 // SecretSpec specifies a secret to be included in a build pod and its corresponding mount point 1390 type SecretSpec struct { 1391 // secretSource is a reference to the secret 1392 SecretSource corev1.LocalObjectReference `json:"secretSource" protobuf:"bytes,1,opt,name=secretSource"` 1393 1394 // mountPath is the path at which to mount the secret 1395 MountPath string `json:"mountPath" protobuf:"bytes,2,opt,name=mountPath"` 1396 } 1397 1398 // BuildVolume describes a volume that is made available to build pods, 1399 // such that it can be mounted into buildah's runtime environment. 1400 // Only a subset of Kubernetes Volume sources are supported. 1401 type BuildVolume struct { 1402 // name is a unique identifier for this BuildVolume. 1403 // It must conform to the Kubernetes DNS label standard and be unique within the pod. 1404 // Names that collide with those added by the build controller will result in a 1405 // failed build with an error message detailing which name caused the error. 1406 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 1407 // +required 1408 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1409 1410 // source represents the location and type of the mounted volume. 1411 // +required 1412 Source BuildVolumeSource `json:"source" protobuf:"bytes,2,opt,name=source"` 1413 1414 // mounts represents the location of the volume in the image build container 1415 // +required 1416 // +listType=map 1417 // +listMapKey=destinationPath 1418 // +patchMergeKey=destinationPath 1419 // +patchStrategy=merge 1420 Mounts []BuildVolumeMount `json:"mounts" patchStrategy:"merge" patchMergeKey:"destinationPath" protobuf:"bytes,3,opt,name=mounts"` 1421 } 1422 1423 // BuildVolumeSourceType represents a build volume source type 1424 type BuildVolumeSourceType string 1425 1426 const ( 1427 // BuildVolumeSourceTypeSecret is the Secret build source volume type 1428 BuildVolumeSourceTypeSecret BuildVolumeSourceType = "Secret" 1429 1430 // BuildVolumeSourceTypeConfigmap is the ConfigMap build source volume type 1431 BuildVolumeSourceTypeConfigMap BuildVolumeSourceType = "ConfigMap" 1432 1433 // BuildVolumeSourceTypeCSI is the CSI build source volume type 1434 BuildVolumeSourceTypeCSI BuildVolumeSourceType = "CSI" 1435 ) 1436 1437 // BuildVolumeSource represents the source of a volume to mount 1438 // Only one of its supported types may be specified at any given time. 1439 type BuildVolumeSource struct { 1440 1441 // type is the BuildVolumeSourceType for the volume source. 1442 // Type must match the populated volume source. 1443 // Valid types are: Secret, ConfigMap 1444 Type BuildVolumeSourceType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=BuildVolumeSourceType"` 1445 1446 // secret represents a Secret that should populate this volume. 1447 // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret 1448 // +optional 1449 Secret *corev1.SecretVolumeSource `json:"secret,omitempty" protobuf:"bytes,2,opt,name=secret"` 1450 1451 // configMap represents a ConfigMap that should populate this volume 1452 // +optional 1453 ConfigMap *corev1.ConfigMapVolumeSource `json:"configMap,omitempty" protobuf:"bytes,3,opt,name=configMap"` 1454 1455 // csi represents ephemeral storage provided by external CSI drivers which support this capability 1456 // +optional 1457 CSI *corev1.CSIVolumeSource `json:"csi,omitempty" protobuf:"bytes,4,opt,name=csi"` 1458 } 1459 1460 // BuildVolumeMount describes the mounting of a Volume within buildah's runtime environment. 1461 type BuildVolumeMount struct { 1462 // destinationPath is the path within the buildah runtime environment at which the volume should be mounted. 1463 // The transient mount within the build image and the backing volume will both be mounted read only. 1464 // Must be an absolute path, must not contain '..' or ':', and must not collide with a destination path generated 1465 // by the builder process 1466 // Paths that collide with those added by the build controller will result in a 1467 // failed build with an error message detailing which path caused the error. 1468 DestinationPath string `json:"destinationPath" protobuf:"bytes,1,opt,name=destinationPath"` 1469 } 1470