Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

202
vendor/github.com/knative/build/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

31
vendor/github.com/knative/build/pkg/apis/build/BUILD generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["register.go"],
importpath = "github.com/knative/build/pkg/apis/build",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//vendor/github.com/knative/build/pkg/apis/build/v1alpha1:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,20 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package build
// GroupName is the Kubernetes resource group name for Build types.
const GroupName = "build.knative.dev"

View File

@@ -0,0 +1,52 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"build_defaults.go",
"build_template_interface.go",
"build_template_types.go",
"build_template_validation.go",
"build_types.go",
"build_validation.go",
"cluster_build_template_types.go",
"cluster_build_template_validation.go",
"doc.go",
"metadata_validation.go",
"register.go",
"target_path_validation.go",
"zz_generated.deepcopy.go",
],
importpath = "github.com/knative/build/pkg/apis/build/v1alpha1",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/knative/build/pkg/apis/build:go_default_library",
"//vendor/github.com/knative/pkg/apis:go_default_library",
"//vendor/github.com/knative/pkg/apis/duck/v1alpha1:go_default_library",
"//vendor/github.com/knative/pkg/kmeta:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,42 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// DefaultTimeout is 10min
const DefaultTimeout = 10 * time.Minute
// SetDefaults for build
func (b *Build) SetDefaults() {
if b == nil {
return
}
if b.Spec.ServiceAccountName == "" {
b.Spec.ServiceAccountName = "default"
}
if b.Spec.Timeout == nil {
b.Spec.Timeout = &metav1.Duration{Duration: DefaultTimeout}
}
if b.Spec.Template != nil && b.Spec.Template.Kind == "" {
b.Spec.Template.Kind = BuildTemplateKind
}
}

View File

@@ -0,0 +1,23 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
// BuildTemplateInterface is implemented by BuildTemplate and ClusterBuildTemplate
type BuildTemplateInterface interface {
TemplateSpec() BuildTemplateSpec
Copy() BuildTemplateInterface
}

View File

@@ -0,0 +1,116 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"github.com/knative/pkg/apis"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/knative/pkg/kmeta"
)
// Template is an interface for accessing the BuildTemplateSpec
// from various forms of template (namespace-/cluster-scoped).
type Template interface {
TemplateSpec() BuildTemplateSpec
}
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BuildTemplate is a template that can used to easily create Builds.
type BuildTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BuildTemplateSpec `json:"spec"`
}
// Check that our resource implements several interfaces.
var _ kmeta.OwnerRefable = (*BuildTemplate)(nil)
var _ Template = (*BuildTemplate)(nil)
var _ BuildTemplateInterface = (*BuildTemplate)(nil)
// Check that BuildTemplate may be validated and defaulted.
var _ apis.Validatable = (*BuildTemplate)(nil)
var _ apis.Defaultable = (*BuildTemplate)(nil)
// BuildTemplateSpec is the spec for a BuildTemplate.
type BuildTemplateSpec struct {
// TODO: Generation does not work correctly with CRD. They are scrubbed
// by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778)
// So, we add Generation here. Once that gets fixed, remove this and use
// ObjectMeta.Generation instead.
// +optional
Generation int64 `json:"generation,omitempty"`
// Parameters defines the parameters that can be populated in a template.
Parameters []ParameterSpec `json:"parameters,omitempty"`
// Steps are the steps of the build; each step is run sequentially with the
// source mounted into /workspace.
Steps []corev1.Container `json:"steps"`
// Volumes is a collection of volumes that are available to mount into the
// steps of the build.
Volumes []corev1.Volume `json:"volumes"`
}
// ParameterSpec defines the possible parameters that can be populated in a
// template.
type ParameterSpec struct {
// Name is the unique name of this template parameter.
Name string `json:"name"`
// Description is a human-readable explanation of this template parameter.
Description string `json:"description,omitempty"`
// Default, if specified, defines the default value that should be applied if
// the build does not specify the value for this parameter.
Default *string `json:"default,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BuildTemplateList is a list of BuildTemplate resources.
type BuildTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []BuildTemplate `json:"items"`
}
// TemplateSpec returnes the Spec used by the template
func (bt *BuildTemplate) TemplateSpec() BuildTemplateSpec {
return bt.Spec
}
// Copy performes a deep copy
func (bt *BuildTemplate) Copy() BuildTemplateInterface {
return bt.DeepCopy()
}
// GetGroupVersionKind gives kind
func (bt *BuildTemplate) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("BuildTemplate")
}
// SetDefaults for build template
func (bt *BuildTemplate) SetDefaults() {}

View File

@@ -0,0 +1,86 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"github.com/knative/pkg/apis"
corev1 "k8s.io/api/core/v1"
)
// Validate build template
func (b *BuildTemplate) Validate() *apis.FieldError {
return validateObjectMetadata(b.GetObjectMeta()).ViaField("metadata").Also(b.Spec.Validate().ViaField("spec"))
}
// Validate Build Template
func (b *BuildTemplateSpec) Validate() *apis.FieldError {
if err := validateSteps(b.Steps); err != nil {
return err
}
if err := ValidateVolumes(b.Volumes); err != nil {
return err
}
if err := validateParameters(b.Parameters); err != nil {
return err
}
return nil
}
//ValidateVolumes validates collection of volumes that are available to mount into the
// steps of the build ot build template.
func ValidateVolumes(volumes []corev1.Volume) *apis.FieldError {
// Build must not duplicate volume names.
vols := map[string]struct{}{}
for _, v := range volumes {
if _, ok := vols[v.Name]; ok {
return apis.ErrMultipleOneOf("volumeName")
}
vols[v.Name] = struct{}{}
}
return nil
}
func validateSteps(steps []corev1.Container) *apis.FieldError {
// Build must not duplicate step names.
names := map[string]struct{}{}
for _, s := range steps {
if s.Image == "" {
return apis.ErrMissingField("Image")
}
if s.Name == "" {
continue
}
if _, ok := names[s.Name]; ok {
return apis.ErrMultipleOneOf("stepName")
}
names[s.Name] = struct{}{}
}
return nil
}
func validateParameters(params []ParameterSpec) *apis.FieldError {
// Template must not duplicate parameter names.
seen := map[string]struct{}{}
for _, p := range params {
if _, ok := seen[p.Name]; ok {
return apis.ErrInvalidKeyName("ParamName", "b.spec.params")
}
seen[p.Name] = struct{}{}
}
return nil
}

View File

@@ -0,0 +1,326 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/knative/pkg/apis"
duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
"github.com/knative/pkg/kmeta"
)
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Build represents a build of a container image. A Build is made up of a
// source, and a set of steps. Steps can mount volumes to share data between
// themselves. A build may be created by instantiating a BuildTemplate.
type Build struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BuildSpec `json:"spec"`
Status BuildStatus `json:"status"`
}
// Check that our resource implements several interfaces.
var _ kmeta.OwnerRefable = (*Build)(nil)
// Check that Build may be validated and defaulted.
var _ apis.Validatable = (*Build)(nil)
var _ apis.Defaultable = (*Build)(nil)
// BuildSpec is the spec for a Build resource.
type BuildSpec struct {
// TODO: Generation does not work correctly with CRD. They are scrubbed
// by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778)
// So, we add Generation here. Once that gets fixed, remove this and use
// ObjectMeta.Generation instead.
// +optional
Generation int64 `json:"generation,omitempty"`
// Source specifies the input to the build.
// +optional
Source *SourceSpec `json:"source,omitempty"`
// Sources specifies the inputs to the build.
// +optional
Sources []SourceSpec `json:"sources,omitempty"`
// Steps are the steps of the build; each step is run sequentially with the
// source mounted into /workspace.
// +optional
Steps []corev1.Container `json:"steps,omitempty"`
// Volumes is a collection of volumes that are available to mount into the
// steps of the build.
// +optional
Volumes []corev1.Volume `json:"volumes,omitempty"`
// The name of the service account as which to run this build.
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`
// Template, if specified, references a BuildTemplate resource to use to
// populate fields in the build, and optional Arguments to pass to the
// template. The default Kind of template is BuildTemplate
// +optional
Template *TemplateInstantiationSpec `json:"template,omitempty"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Time after which the build times out. Defaults to 10 minutes.
// Specified build timeout should be less than 24h.
// Refer Go's ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
}
// TemplateKind defines the type of BuildTemplate used by the build.
type TemplateKind string
const (
// BuildTemplateKind indicates that the template type has a namepace scope.
BuildTemplateKind TemplateKind = "BuildTemplate"
// ClusterBuildTemplateKind indicates that template type has a cluster scope.
ClusterBuildTemplateKind TemplateKind = "ClusterBuildTemplate"
)
// TemplateInstantiationSpec specifies how a BuildTemplate is instantiated into
// a Build.
type TemplateInstantiationSpec struct {
// Name references the BuildTemplate resource to use.
// The template is assumed to exist in the Build's namespace.
Name string `json:"name"`
// The Kind of the template to be used, possible values are BuildTemplate
// or ClusterBuildTemplate. If nothing is specified, the default if is BuildTemplate
// +optional
Kind TemplateKind `json:"kind,omitempty"`
// Arguments, if specified, lists values that should be applied to the
// parameters specified by the template.
// +optional
Arguments []ArgumentSpec `json:"arguments,omitempty"`
// Env, if specified will provide variables to all build template steps.
// This will override any of the template's steps environment variables.
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`
}
// ArgumentSpec defines the actual values to use to populate a template's
// parameters.
type ArgumentSpec struct {
// Name is the name of the argument.
Name string `json:"name"`
// Value is the value of the argument.
Value string `json:"value"`
// TODO(jasonhall): ValueFrom?
}
// SourceSpec defines the input to the Build
type SourceSpec struct {
// Git represents source in a Git repository.
// +optional
Git *GitSourceSpec `json:"git,omitempty"`
// GCS represents source in Google Cloud Storage.
// +optional
GCS *GCSSourceSpec `json:"gcs,omitempty"`
// Custom indicates that source should be retrieved using a custom
// process defined in a container invocation.
// +optional
Custom *corev1.Container `json:"custom,omitempty"`
// SubPath specifies a path within the fetched source which should be
// built. This option makes parent directories *inaccessible* to the
// build steps. (The specific source type may, in fact, not even fetch
// files not in the SubPath.)
// +optional
SubPath string `json:"subPath,omitempty"`
// Name is the name of source. This field is used to uniquely identify the
// source init containers
// Restrictions on the allowed charatcers
// Must be a basename (no /)
// Must be a valid DNS name (only alphanumeric characters, no _)
// https://tools.ietf.org/html/rfc1123#section-2
// +optional
Name string `json:"name,omitempty"`
// TargetPath is the path in workspace directory where the source will be copied.
// TargetPath is optional and if its not set source will be copied under workspace.
// TargetPath should not be set for custom source.
TargetPath string `json:"targetPath,omitempty"`
}
// GitSourceSpec describes a Git repo source input to the Build.
type GitSourceSpec struct {
// URL of the Git repository to clone from.
Url string `json:"url"`
// Git revision (branch, tag, commit SHA or ref) to clone. See
// https://git-scm.com/docs/gitrevisions#_specifying_revisions for more
// information.
Revision string `json:"revision"`
}
// GCSSourceSpec describes source input to the Build in the form of an archive,
// or a source manifest describing files to fetch.
type GCSSourceSpec struct {
// Type declares the style of source to fetch.
Type GCSSourceType `json:"type,omitempty"`
// Location specifies the location of the source archive or manifest file.
Location string `json:"location,omitempty"`
}
// GCSSourceType defines a type of GCS source fetch.
type GCSSourceType string
const (
// GCSArchive indicates that source should be fetched from a typical archive file.
GCSArchive GCSSourceType = "Archive"
// GCSManifest indicates that source should be fetched using a
// manifest-based protocol which enables incremental source upload.
GCSManifest GCSSourceType = "Manifest"
)
// BuildProvider defines a build execution implementation.
type BuildProvider string
const (
// GoogleBuildProvider indicates that this build was performed with Google Cloud Build.
GoogleBuildProvider BuildProvider = "Google"
// ClusterBuildProvider indicates that this build was performed on-cluster.
ClusterBuildProvider BuildProvider = "Cluster"
)
// BuildStatus is the status for a Build resource
type BuildStatus struct {
// +optional
Builder BuildProvider `json:"builder,omitempty"`
// Cluster provides additional information if the builder is Cluster.
// +optional
Cluster *ClusterSpec `json:"cluster,omitempty"`
// Google provides additional information if the builder is Google.
// +optional
Google *GoogleSpec `json:"google,omitempty"`
// StartTime is the time the build is actually started.
// +optional
StartTime *metav1.Time `json:"startTime,omitempty"`
// CompletionTime is the time the build completed.
// +optional
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
// StepStates describes the state of each build step container.
// +optional
StepStates []corev1.ContainerState `json:"stepStates,omitempty"`
// StepsCompleted lists the name of build steps completed.
// +optional
StepsCompleted []string `json:"stepsCompleted",omitempty`
// Conditions describes the set of conditions of this build.
// +optional
Conditions duckv1alpha1.Conditions `json:"conditions,omitempty"`
}
// Check that BuildStatus may have its conditions managed.
var _ duckv1alpha1.ConditionsAccessor = (*BuildStatus)(nil)
// ClusterSpec provides information about the on-cluster build, if applicable.
type ClusterSpec struct {
// Namespace is the namespace in which the pod is running.
Namespace string `json:"namespace"`
// PodName is the name of the pod responsible for executing this build's steps.
PodName string `json:"podName"`
}
// GoogleSpec provides information about the GCB build, if applicable.
type GoogleSpec struct {
// Operation is the unique name of the GCB API Operation for the build.
Operation string `json:"operation"`
}
// BuildSucceeded is set when the build is running, and becomes True when the
// build finishes successfully.
//
// If the build is ongoing, its status will be Unknown. If it fails, its status
// will be False.
const BuildSucceeded = duckv1alpha1.ConditionSucceeded
var buildCondSet = duckv1alpha1.NewBatchConditionSet()
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BuildList is a list of Build resources
type BuildList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// Items is the list of Build items in this list.
Items []Build `json:"items"`
}
// GetCondition returns the Condition matching the given type.
func (bs *BuildStatus) GetCondition(t duckv1alpha1.ConditionType) *duckv1alpha1.Condition {
return buildCondSet.Manage(bs).GetCondition(t)
}
// SetCondition sets the condition, unsetting previous conditions with the same
// type as necessary.
func (bs *BuildStatus) SetCondition(newCond *duckv1alpha1.Condition) {
if newCond != nil {
buildCondSet.Manage(bs).SetCondition(*newCond)
}
}
// GetConditions returns the Conditions array. This enables generic handling of
// conditions by implementing the duckv1alpha1.Conditions interface.
func (bs *BuildStatus) GetConditions() duckv1alpha1.Conditions {
return bs.Conditions
}
// SetConditions sets the Conditions array. This enables generic handling of
// conditions by implementing the duckv1alpha1.Conditions interface.
func (bs *BuildStatus) SetConditions(conditions duckv1alpha1.Conditions) {
bs.Conditions = conditions
}
func (b *Build) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("Build")
}

View File

@@ -0,0 +1,146 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"fmt"
"time"
"github.com/knative/pkg/apis"
)
// Validate Build
func (b *Build) Validate() *apis.FieldError {
return validateObjectMetadata(b.GetObjectMeta()).ViaField("metadata").Also(b.Spec.Validate().ViaField("spec"))
}
// Validate for build spec
func (bs *BuildSpec) Validate() *apis.FieldError {
if bs.Template == nil && len(bs.Steps) == 0 {
return apis.ErrMissingField("b.spec.template").Also(apis.ErrMissingField("b.spec.steps"))
}
if bs.Template != nil && len(bs.Steps) > 0 {
return apis.ErrMissingField("b.spec.template").Also(apis.ErrMissingField("b.spec.steps"))
}
if bs.Template != nil && bs.Template.Name == "" {
apis.ErrMissingField("build.spec.template.name")
}
if err := bs.validateSources(); err != nil {
return err
}
// If a build specifies a template, all the template's parameters without
// defaults must be satisfied by the build's parameters.
if bs.Template != nil {
return bs.Template.Validate()
}
if err := ValidateVolumes(bs.Volumes); err != nil {
return err
}
if err := bs.validateTimeout(); err != nil {
return err
}
if err := validateSteps(bs.Steps); err != nil {
return err
}
return nil
}
// Validate templateKind
func (b *TemplateInstantiationSpec) Validate() *apis.FieldError {
if b == nil {
return nil
}
if b.Name == "" {
return apis.ErrMissingField("build.spec.template.name")
}
if b.Kind != "" {
switch b.Kind {
case ClusterBuildTemplateKind,
BuildTemplateKind:
return nil
default:
return apis.ErrInvalidValue(string(b.Kind), apis.CurrentField)
}
}
return nil
}
// Validate build timeout
func (bt *BuildSpec) validateTimeout() *apis.FieldError {
if bt.Timeout == nil {
return nil
}
maxTimeout := time.Duration(24 * time.Hour)
if bt.Timeout.Duration > maxTimeout {
return apis.ErrInvalidValue(fmt.Sprintf("%s should be < 24h", bt.Timeout), "b.spec.timeout")
} else if bt.Timeout.Duration < 0 {
return apis.ErrInvalidValue(fmt.Sprintf("%s should be > 0", bt.Timeout), "b.spec.timeout")
}
return nil
}
// Validate source
func (bs BuildSpec) validateSources() *apis.FieldError {
var subPathExists bool
var emptyTargetPath bool
names := map[string]string{}
pathtree := pathTree{
nodeMap: map[string]map[string]string{},
}
// both source and sources cannot be defined in build
if len(bs.Sources) > 0 && bs.Source != nil {
return apis.ErrMultipleOneOf("b.spec.source", "b.spec.sources")
}
for _, source := range bs.Sources {
// check all source have unique names
if _, ok := names[source.Name]; ok {
return apis.ErrMultipleOneOf("b.spec.sources.names")
}
// multiple sources cannot have subpath defined
if source.SubPath != "" {
if subPathExists {
return apis.ErrInvalidValue("b.spec.sources.subpath", source.SubPath)
}
subPathExists = true
}
names[source.Name] = ""
if source.TargetPath == "" {
if source.Custom != nil {
continue
}
if emptyTargetPath {
return apis.ErrInvalidValue("empty target path", "b.spec.sources.targetPath")
}
emptyTargetPath = true
} else {
if source.Custom != nil {
return apis.ErrInvalidValue(source.TargetPath, "b.spec.sources.targetPath")
}
if err := insertNode(source.TargetPath, pathtree); err != nil {
return err
}
}
}
return nil
}

View File

@@ -0,0 +1,74 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/knative/pkg/apis"
"github.com/knative/pkg/kmeta"
)
// +genclient
// +genclient:noStatus
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterBuildTemplate is a template that can used to easily create Builds.
type ClusterBuildTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BuildTemplateSpec `json:"spec"`
}
// Check that our resource implements several interfaces.
var _ kmeta.OwnerRefable = (*ClusterBuildTemplate)(nil)
var _ Template = (*ClusterBuildTemplate)(nil)
var _ BuildTemplateInterface = (*ClusterBuildTemplate)(nil)
// Check that ClusterBuildTemplate may be validated and defaulted.
var _ apis.Validatable = (*ClusterBuildTemplate)(nil)
var _ apis.Defaultable = (*ClusterBuildTemplate)(nil)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterBuildTemplateList is a list of BuildTemplate resources.
type ClusterBuildTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ClusterBuildTemplate `json:"items"`
}
// TemplateSpec returnes the Spec used by the template
func (bt *ClusterBuildTemplate) TemplateSpec() BuildTemplateSpec {
return bt.Spec
}
// Copy performes a deep copy
func (bt *ClusterBuildTemplate) Copy() BuildTemplateInterface {
return bt.DeepCopy()
}
func (bt *ClusterBuildTemplate) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("ClusterBuildTemplate")
}
// SetDefaults
func (b *ClusterBuildTemplate) SetDefaults() {}

View File

@@ -0,0 +1,24 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import "github.com/knative/pkg/apis"
// Validate ClusterBuildTemplate
func (b *ClusterBuildTemplate) Validate() *apis.FieldError {
return validateObjectMetadata(b.GetObjectMeta()).ViaField("metadata").Also(b.Spec.Validate().ViaField("spec"))
}

View File

@@ -0,0 +1,21 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package
// Package v1alpha1 is the v1alpha1 version of the API.
// +groupName=build.knative.dev
package v1alpha1

View File

@@ -0,0 +1,47 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"strings"
"github.com/knative/pkg/apis"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
maxLength = 63
)
func validateObjectMetadata(meta metav1.Object) *apis.FieldError {
name := meta.GetName()
if strings.Contains(name, ".") {
return &apis.FieldError{
Message: "Invalid resource name: special character . must not be present",
Paths: []string{"name"},
}
}
if len(name) > maxLength {
return &apis.FieldError{
Message: "Invalid resource name: length must be no more than 63 characters",
Paths: []string{"name"},
}
}
return nil
}

View File

@@ -0,0 +1,59 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/knative/build/pkg/apis/build"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: build.GroupName, Version: "v1alpha1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme adds Build types to the scheme.
AddToScheme = schemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Build{},
&BuildList{},
&BuildTemplate{},
&BuildTemplateList{},
&ClusterBuildTemplate{},
&ClusterBuildTemplateList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@@ -0,0 +1,66 @@
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"strings"
"github.com/knative/pkg/apis"
)
type pathTree struct {
nodeMap map[string]map[string]string
}
// insertNode functions checks the path does not have overlap with existing
// paths in path.nodeMap. If not it creates a key for path and adds
func insertNode(path string, pathtree pathTree) *apis.FieldError {
err := apis.ErrMultipleOneOf("b.spec.sources.targetPath")
path = strings.Trim(path, "/")
parts := strings.Split(path, "/")
for nodePath, nodeMap := range pathtree.nodeMap {
if len(nodeMap) > len(parts) {
if strings.HasPrefix(nodePath, path) {
return err
}
}
if len(nodeMap) == len(parts) {
if path == nodePath {
return err
}
}
if len(nodeMap) < len(parts) {
if strings.HasPrefix(path, nodePath) {
return err
}
}
}
// path is trimmed with "/"
addNode(path, pathtree)
return nil
}
func addNode(path string, tree pathTree) {
parts := strings.Split(path, "/")
nm := map[string]string{}
for _, part := range parts {
nm[part] = part
}
tree.nodeMap[path] = nm
}

View File

@@ -0,0 +1,573 @@
// +build !ignore_autogenerated
/*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1alpha1
import (
duck_v1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArgumentSpec) DeepCopyInto(out *ArgumentSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgumentSpec.
func (in *ArgumentSpec) DeepCopy() *ArgumentSpec {
if in == nil {
return nil
}
out := new(ArgumentSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Build) DeepCopyInto(out *Build) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Build.
func (in *Build) DeepCopy() *Build {
if in == nil {
return nil
}
out := new(Build)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Build) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildList) DeepCopyInto(out *BuildList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Build, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildList.
func (in *BuildList) DeepCopy() *BuildList {
if in == nil {
return nil
}
out := new(BuildList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *BuildList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildSpec) DeepCopyInto(out *BuildSpec) {
*out = *in
if in.Source != nil {
in, out := &in.Source, &out.Source
if *in == nil {
*out = nil
} else {
*out = new(SourceSpec)
(*in).DeepCopyInto(*out)
}
}
if in.Sources != nil {
in, out := &in.Sources, &out.Sources
*out = make([]SourceSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Steps != nil {
in, out := &in.Steps, &out.Steps
*out = make([]v1.Container, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Volumes != nil {
in, out := &in.Volumes, &out.Volumes
*out = make([]v1.Volume, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Template != nil {
in, out := &in.Template, &out.Template
if *in == nil {
*out = nil
} else {
*out = new(TemplateInstantiationSpec)
(*in).DeepCopyInto(*out)
}
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Timeout != nil {
in, out := &in.Timeout, &out.Timeout
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.Duration)
**out = **in
}
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
if *in == nil {
*out = nil
} else {
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildSpec.
func (in *BuildSpec) DeepCopy() *BuildSpec {
if in == nil {
return nil
}
out := new(BuildSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildStatus) DeepCopyInto(out *BuildStatus) {
*out = *in
if in.Cluster != nil {
in, out := &in.Cluster, &out.Cluster
if *in == nil {
*out = nil
} else {
*out = new(ClusterSpec)
**out = **in
}
}
if in.Google != nil {
in, out := &in.Google, &out.Google
if *in == nil {
*out = nil
} else {
*out = new(GoogleSpec)
**out = **in
}
}
if in.StartTime != nil {
in, out := &in.StartTime, &out.StartTime
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.Time)
(*in).DeepCopyInto(*out)
}
}
if in.CompletionTime != nil {
in, out := &in.CompletionTime, &out.CompletionTime
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.Time)
(*in).DeepCopyInto(*out)
}
}
if in.StepStates != nil {
in, out := &in.StepStates, &out.StepStates
*out = make([]v1.ContainerState, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.StepsCompleted != nil {
in, out := &in.StepsCompleted, &out.StepsCompleted
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make(duck_v1alpha1.Conditions, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildStatus.
func (in *BuildStatus) DeepCopy() *BuildStatus {
if in == nil {
return nil
}
out := new(BuildStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildTemplate.
func (in *BuildTemplate) DeepCopy() *BuildTemplate {
if in == nil {
return nil
}
out := new(BuildTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *BuildTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildTemplateList) DeepCopyInto(out *BuildTemplateList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]BuildTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildTemplateList.
func (in *BuildTemplateList) DeepCopy() *BuildTemplateList {
if in == nil {
return nil
}
out := new(BuildTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *BuildTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BuildTemplateSpec) DeepCopyInto(out *BuildTemplateSpec) {
*out = *in
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
*out = make([]ParameterSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Steps != nil {
in, out := &in.Steps, &out.Steps
*out = make([]v1.Container, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Volumes != nil {
in, out := &in.Volumes, &out.Volumes
*out = make([]v1.Volume, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildTemplateSpec.
func (in *BuildTemplateSpec) DeepCopy() *BuildTemplateSpec {
if in == nil {
return nil
}
out := new(BuildTemplateSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterBuildTemplate) DeepCopyInto(out *ClusterBuildTemplate) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBuildTemplate.
func (in *ClusterBuildTemplate) DeepCopy() *ClusterBuildTemplate {
if in == nil {
return nil
}
out := new(ClusterBuildTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterBuildTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterBuildTemplateList) DeepCopyInto(out *ClusterBuildTemplateList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterBuildTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBuildTemplateList.
func (in *ClusterBuildTemplateList) DeepCopy() *ClusterBuildTemplateList {
if in == nil {
return nil
}
out := new(ClusterBuildTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterBuildTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.
func (in *ClusterSpec) DeepCopy() *ClusterSpec {
if in == nil {
return nil
}
out := new(ClusterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GCSSourceSpec) DeepCopyInto(out *GCSSourceSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCSSourceSpec.
func (in *GCSSourceSpec) DeepCopy() *GCSSourceSpec {
if in == nil {
return nil
}
out := new(GCSSourceSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GitSourceSpec) DeepCopyInto(out *GitSourceSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitSourceSpec.
func (in *GitSourceSpec) DeepCopy() *GitSourceSpec {
if in == nil {
return nil
}
out := new(GitSourceSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GoogleSpec) DeepCopyInto(out *GoogleSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GoogleSpec.
func (in *GoogleSpec) DeepCopy() *GoogleSpec {
if in == nil {
return nil
}
out := new(GoogleSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ParameterSpec) DeepCopyInto(out *ParameterSpec) {
*out = *in
if in.Default != nil {
in, out := &in.Default, &out.Default
if *in == nil {
*out = nil
} else {
*out = new(string)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParameterSpec.
func (in *ParameterSpec) DeepCopy() *ParameterSpec {
if in == nil {
return nil
}
out := new(ParameterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SourceSpec) DeepCopyInto(out *SourceSpec) {
*out = *in
if in.Git != nil {
in, out := &in.Git, &out.Git
if *in == nil {
*out = nil
} else {
*out = new(GitSourceSpec)
**out = **in
}
}
if in.GCS != nil {
in, out := &in.GCS, &out.GCS
if *in == nil {
*out = nil
} else {
*out = new(GCSSourceSpec)
**out = **in
}
}
if in.Custom != nil {
in, out := &in.Custom, &out.Custom
if *in == nil {
*out = nil
} else {
*out = new(v1.Container)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpec.
func (in *SourceSpec) DeepCopy() *SourceSpec {
if in == nil {
return nil
}
out := new(SourceSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TemplateInstantiationSpec) DeepCopyInto(out *TemplateInstantiationSpec) {
*out = *in
if in.Arguments != nil {
in, out := &in.Arguments, &out.Arguments
*out = make([]ArgumentSpec, len(*in))
copy(*out, *in)
}
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateInstantiationSpec.
func (in *TemplateInstantiationSpec) DeepCopy() *TemplateInstantiationSpec {
if in == nil {
return nil
}
out := new(TemplateInstantiationSpec)
in.DeepCopyInto(out)
return out
}