From 518abf7c0b3ae62ba8c76649e3b466245c980c96 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 7 Sep 2022 09:56:27 -0400 Subject: [PATCH 1/4] Deprecate `spec.sources` This deprecates the `spec.sources` field, thereby deprecating the "remote artifact" download feature. Per discussion in the Beta API workshop, this feature will be removed from Shipwright once the beta API reaches stability. --- deploy/crds/shipwright.io_buildruns.yaml | 12 ++++++++---- deploy/crds/shipwright.io_builds.yaml | 6 ++++-- docs/build.md | 6 ++++-- pkg/apis/build/v1alpha1/build_source.go | 2 ++ pkg/apis/build/v1alpha1/build_types.go | 2 ++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/deploy/crds/shipwright.io_buildruns.yaml b/deploy/crds/shipwright.io_buildruns.yaml index 73c3f55bf3..aaa646d67d 100644 --- a/deploy/crds/shipwright.io_buildruns.yaml +++ b/deploy/crds/shipwright.io_buildruns.yaml @@ -419,8 +419,10 @@ spec: type: string type: object sources: - description: Sources slice of BuildSource, defining external build - artifacts complementary to VCS (`.spec.source`) data. + description: "Sources slice of BuildSource, defining external + build artifacts complementary to VCS (`.spec.source`) data. + \n NOTICE: Multiple sources in a build are deprecated. This + feature will be removed in a future release." items: description: BuildSource remote artifact definition, also known as "sources". Simple "name" and "url" pairs, initially without @@ -4224,8 +4226,10 @@ spec: type: string type: object sources: - description: Sources slice of BuildSource, defining external build - artifacts complementary to VCS (`.spec.source`) data. + description: "Sources slice of BuildSource, defining external + build artifacts complementary to VCS (`.spec.source`) data. + \n NOTICE: Multiple sources in a build are deprecated. This + feature will be removed in a future release." items: description: BuildSource remote artifact definition, also known as "sources". Simple "name" and "url" pairs, initially without diff --git a/deploy/crds/shipwright.io_builds.yaml b/deploy/crds/shipwright.io_builds.yaml index eee61b10ca..4a8843a8ff 100644 --- a/deploy/crds/shipwright.io_builds.yaml +++ b/deploy/crds/shipwright.io_builds.yaml @@ -397,8 +397,10 @@ spec: type: string type: object sources: - description: Sources slice of BuildSource, defining external build - artifacts complementary to VCS (`.spec.source`) data. + description: "Sources slice of BuildSource, defining external build + artifacts complementary to VCS (`.spec.source`) data. \n NOTICE: + Multiple sources in a build are deprecated. This feature will be + removed in a future release." items: description: BuildSource remote artifact definition, also known as "sources". Simple "name" and "url" pairs, initially without diff --git a/docs/build.md b/docs/build.md index f30bf8e06b..91434cc57f 100644 --- a/docs/build.md +++ b/docs/build.md @@ -25,7 +25,7 @@ SPDX-License-Identifier: Apache-2.0 A `Build` resource allows the user to define: - source -- sources +- sources (**this is deprecated, and will be removed in a future release**) - strategy - params - builder @@ -86,7 +86,7 @@ The `Build` definition supports the following fields: - Optional: - `spec.paramValues` - Refers to a name-value(s) list to specify values for `parameters` defined in the `BuildStrategy`. - `spec.dockerfile` - Path to a Dockerfile to be used for building an image. (_Use this path for strategies that require a Dockerfile_) - - `spec.sources` - [Sources](#Sources) describes a slice of artifacts that will be imported into the project context before the actual build process starts. + - `spec.sources` - [Sources](#Sources) describes a slice of artifacts that will be imported into the project context before the actual build process starts. **This field has been deprecated, and will be removed in a future release.** - `spec.timeout` - Defines a custom timeout. The value needs to be parsable by [ParseDuration](https://golang.org/pkg/time/#ParseDuration), for example, `5m`. The default is ten minutes. You can overwrite the value in the `BuildRun`. - `metadata.annotations[build.shipwright.io/build-run-deletion]` - Defines if delete all related BuildRuns when deleting the Build. The default is `false`. - `spec.output.annotations` - Refers to a list of `key/value` that could be used to [annotate](https://github.com/opencontainers/image-spec/blob/main/annotations.md) the output image. @@ -708,6 +708,8 @@ spec: ### Sources +**Note: This feature has been deprecated, and will be removed in a future release**. + Sources represent remote artifacts, as in external entities added to the build context before the actual Build starts. Therefore, you may employ `.spec.sources` to download artifacts from external repositories. ```yaml diff --git a/pkg/apis/build/v1alpha1/build_source.go b/pkg/apis/build/v1alpha1/build_source.go index c8753449e7..74f9f99769 100644 --- a/pkg/apis/build/v1alpha1/build_source.go +++ b/pkg/apis/build/v1alpha1/build_source.go @@ -17,6 +17,8 @@ const LocalCopy BuildSourceType = "LocalCopy" // HTTP defines a (HTTP) remote artifact, which will be downloaded into the build POD, right before // the build process starts. Represents a remote dependency. +// +// NOTICE: HTTP artifact downloads are deprecated. This feature will be removed in a future release. const HTTP BuildSourceType = "HTTP" // BuildSource remote artifact definition, also known as "sources". Simple "name" and "url" pairs, diff --git a/pkg/apis/build/v1alpha1/build_types.go b/pkg/apis/build/v1alpha1/build_types.go index 0ecd43e686..12631425e5 100644 --- a/pkg/apis/build/v1alpha1/build_types.go +++ b/pkg/apis/build/v1alpha1/build_types.go @@ -118,6 +118,8 @@ type BuildSpec struct { // (`.spec.source`) data. // // +optional + // + // NOTICE: Multiple sources in a build are deprecated. This feature will be removed in a future release. Sources []BuildSource `json:"sources,omitempty"` // Trigger defines the scenarios where a new build should be triggered. From c7ddd69a738c0bdbddcf235e6eb9f83a59bbbb66 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 7 Sep 2022 10:57:39 -0400 Subject: [PATCH 2/4] Deprecate Build Status Deprecate the build status subobject. This will be removed in the beta API. --- deploy/crds/shipwright.io_builds.yaml | 3 ++- docs/build.md | 2 ++ pkg/apis/build/v1alpha1/build_types.go | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy/crds/shipwright.io_builds.yaml b/deploy/crds/shipwright.io_builds.yaml index 4a8843a8ff..82a174d815 100644 --- a/deploy/crds/shipwright.io_builds.yaml +++ b/deploy/crds/shipwright.io_builds.yaml @@ -2012,7 +2012,8 @@ spec: - strategy type: object status: - description: BuildStatus defines the observed state of Build + description: "BuildStatus defines the observed state of Build \n NOTICE: + This is deprecated and will be removed in a future release." properties: message: description: The message of the registered Build, either an error diff --git a/docs/build.md b/docs/build.md index 91434cc57f..bc004d4e3c 100644 --- a/docs/build.md +++ b/docs/build.md @@ -51,6 +51,8 @@ When the controller reconciles it: ## Build Validations +**Note: reported validations in build status are deprecated, and will be removed in a future release.** + To prevent users from triggering `BuildRuns` (_execution of a Build_) that will eventually fail because of wrong or missing dependencies or configuration settings, the Build controller will validate them in advance. If all validations are successful, users can expect a `Succeeded` `status.reason`. However, if any validations fail, users can rely on the `status.reason` and `status.message` fields to understand the root cause. | Status.Reason | Description | diff --git a/pkg/apis/build/v1alpha1/build_types.go b/pkg/apis/build/v1alpha1/build_types.go index 12631425e5..277db4d684 100644 --- a/pkg/apis/build/v1alpha1/build_types.go +++ b/pkg/apis/build/v1alpha1/build_types.go @@ -222,6 +222,8 @@ type Image struct { } // BuildStatus defines the observed state of Build +// +// NOTICE: This is deprecated and will be removed in a future release. type BuildStatus struct { // The Register status of the Build // +optional From 5eaca8abc3764f823b3756ed4724648eea2c92e0 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 7 Sep 2022 11:13:36 -0400 Subject: [PATCH 3/4] Deprecate Build Builder and Dockerfile Fields Deprecate the following fields in the `Build` spec object: - `builder` - this is specific to source-to-image. - `dockerfile` - this is specific to Dockerfile-based tools. --- deploy/crds/shipwright.io_buildruns.yaml | 26 ++++++++++++++++-------- deploy/crds/shipwright.io_builds.yaml | 14 +++++++++---- docs/build.md | 6 ++++-- pkg/apis/build/v1alpha1/build_types.go | 6 ++++++ 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/deploy/crds/shipwright.io_buildruns.yaml b/deploy/crds/shipwright.io_buildruns.yaml index aaa646d67d..e6f2a8ca7b 100644 --- a/deploy/crds/shipwright.io_buildruns.yaml +++ b/deploy/crds/shipwright.io_buildruns.yaml @@ -72,8 +72,11 @@ spec: description: BuildSpec refers to an embedded build specification properties: builder: - description: Builder refers to the image containing the build - tools inside which the source code would be built. + description: "Builder refers to the image containing the build + tools inside which the source code would be built. \n NOTICE: + Builder is deprecated, and will be removed in a future release. + Build strategies which rely on \"builder\" should provide an + equivalent parameter instead." properties: annotations: additionalProperties: @@ -103,9 +106,11 @@ spec: - image type: object dockerfile: - description: Dockerfile is the path to the Dockerfile to be used + description: "Dockerfile is the path to the Dockerfile to be used for build strategies which bank on the Dockerfile for building - an image. + an image. \n NOTICE: Dockerfile is deprecated, and will be removed + in a future release. Build strategies which rely on \"dockerfile\" + should provide an equivalent parameter instead." type: string env: description: Env contains additional environment variables that @@ -3879,8 +3884,11 @@ spec: description: BuildSpec is the Build Spec of this BuildRun. properties: builder: - description: Builder refers to the image containing the build - tools inside which the source code would be built. + description: "Builder refers to the image containing the build + tools inside which the source code would be built. \n NOTICE: + Builder is deprecated, and will be removed in a future release. + Build strategies which rely on \"builder\" should provide an + equivalent parameter instead." properties: annotations: additionalProperties: @@ -3910,9 +3918,11 @@ spec: - image type: object dockerfile: - description: Dockerfile is the path to the Dockerfile to be used + description: "Dockerfile is the path to the Dockerfile to be used for build strategies which bank on the Dockerfile for building - an image. + an image. \n NOTICE: Dockerfile is deprecated, and will be removed + in a future release. Build strategies which rely on \"dockerfile\" + should provide an equivalent parameter instead." type: string env: description: Env contains additional environment variables that diff --git a/deploy/crds/shipwright.io_builds.yaml b/deploy/crds/shipwright.io_builds.yaml index 82a174d815..b2db555771 100644 --- a/deploy/crds/shipwright.io_builds.yaml +++ b/deploy/crds/shipwright.io_builds.yaml @@ -59,8 +59,11 @@ spec: description: BuildSpec defines the desired state of Build properties: builder: - description: Builder refers to the image containing the build tools - inside which the source code would be built. + description: "Builder refers to the image containing the build tools + inside which the source code would be built. \n NOTICE: Builder + is deprecated, and will be removed in a future release. Build strategies + which rely on \"builder\" should provide an equivalent parameter + instead." properties: annotations: additionalProperties: @@ -90,8 +93,11 @@ spec: - image type: object dockerfile: - description: Dockerfile is the path to the Dockerfile to be used for - build strategies which bank on the Dockerfile for building an image. + description: "Dockerfile is the path to the Dockerfile to be used + for build strategies which bank on the Dockerfile for building an + image. \n NOTICE: Dockerfile is deprecated, and will be removed + in a future release. Build strategies which rely on \"dockerfile\" + should provide an equivalent parameter instead." type: string env: description: Env contains additional environment variables that should diff --git a/docs/build.md b/docs/build.md index bc004d4e3c..751e81045c 100644 --- a/docs/build.md +++ b/docs/build.md @@ -81,13 +81,13 @@ The `Build` definition supports the following fields: - [`metadata`](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields) - Metadata that identify the CRD instance, for example the name of the `Build`. - `spec.source` - Refers to the location of the source code, for example a Git repository or source bundle image. - `spec.strategy` - Refers to the `BuildStrategy` to be used, see the [examples](../samples/buildstrategy) - - `spec.builder.image` - Refers to the image containing the build tools to build the source code. (_Use this path for Dockerless strategies, this is just required for `source-to-image` buildStrategy_) + - `spec.builder.image` - Refers to the image containing the build tools to build the source code. (_Use this path for Dockerless strategies, this is just required for `source-to-image` buildStrategy_) **This field has been deprecated, and will be removed in a future release.** - `spec.output`- Refers to the location where the generated image would be pushed. - `spec.output.credentials.name`- Reference an existing secret to get access to the container registry. - Optional: - `spec.paramValues` - Refers to a name-value(s) list to specify values for `parameters` defined in the `BuildStrategy`. - - `spec.dockerfile` - Path to a Dockerfile to be used for building an image. (_Use this path for strategies that require a Dockerfile_) + - `spec.dockerfile` - Path to a Dockerfile to be used for building an image. (_Use this path for strategies that require a Dockerfile_). **This field has been deprecated, and will be removed in a future release.** - `spec.sources` - [Sources](#Sources) describes a slice of artifacts that will be imported into the project context before the actual build process starts. **This field has been deprecated, and will be removed in a future release.** - `spec.timeout` - Defines a custom timeout. The value needs to be parsable by [ParseDuration](https://golang.org/pkg/time/#ParseDuration), for example, `5m`. The default is ten minutes. You can overwrite the value in the `BuildRun`. - `metadata.annotations[build.shipwright.io/build-run-deletion]` - Defines if delete all related BuildRuns when deleting the Build. The default is `false`. @@ -417,6 +417,8 @@ Here, we pass three items in the `build-args` array: ### Defining the Builder or Dockerfile +**Note: Builder and Dockerfile options are deprecated, and will be removed in a future release.** + In the `Build` resource, you use the `spec.builder` or `spec.dockerfile` parameters to specify the image that contains the tools to build the final image. For example, the following Build definition specifies a `Dockerfile` image. ```yaml diff --git a/pkg/apis/build/v1alpha1/build_types.go b/pkg/apis/build/v1alpha1/build_types.go index 277db4d684..60dd084d11 100644 --- a/pkg/apis/build/v1alpha1/build_types.go +++ b/pkg/apis/build/v1alpha1/build_types.go @@ -134,6 +134,9 @@ type BuildSpec struct { // Builder refers to the image containing the build tools inside which // the source code would be built. // + // NOTICE: Builder is deprecated, and will be removed in a future release. + // Build strategies which rely on "builder" should provide an equivalent parameter instead. + // // +optional Builder *Image `json:"builder,omitempty"` @@ -141,6 +144,9 @@ type BuildSpec struct { // build strategies which bank on the Dockerfile for building // an image. // + // NOTICE: Dockerfile is deprecated, and will be removed in a future release. + // Build strategies which rely on "dockerfile" should provide an equivalent parameter instead. + // // +optional Dockerfile *string `json:"dockerfile,omitempty"` From e1bbd1fcd7d0b86af243ffd93286f871373fdc3e Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 7 Sep 2022 14:21:27 -0400 Subject: [PATCH 4/4] Deprecate Generated Service Accounts Deprecate the generated service account behavior. This feature will eventually be removed from Shipwright. --- deploy/crds/shipwright.io_buildruns.yaml | 4 +++- docs/buildrun.md | 2 +- pkg/apis/build/v1alpha1/buildrun_types.go | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deploy/crds/shipwright.io_buildruns.yaml b/deploy/crds/shipwright.io_buildruns.yaml index e6f2a8ca7b..ce0415f6f2 100644 --- a/deploy/crds/shipwright.io_buildruns.yaml +++ b/deploy/crds/shipwright.io_buildruns.yaml @@ -2357,7 +2357,9 @@ spec: be set if it is empty properties: generate: - description: If generates a new ServiceAccount for the build + description: "If generates a new ServiceAccount for the build + \n NOTICE: Generated ServiceAccounts are deprecated, and will + be removed in a future release." type: boolean name: description: 'Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names' diff --git a/docs/buildrun.md b/docs/buildrun.md index 7962515c0d..093ac7930e 100644 --- a/docs/buildrun.md +++ b/docs/buildrun.md @@ -165,7 +165,7 @@ spec: name: pipeline ``` -You can also use set the `spec.serviceAccount.generate` path to `true`. This will generate the service account during runtime for you. The name of the generated service account is the name of the BuildRun. +You can also use set the `spec.serviceAccount.generate` path to `true`. This will generate the service account during runtime for you. The name of the generated service account is the name of the BuildRun. **This field is deprecated, and will be removed in a future release.** _**Note**_: When the service account is not defined, the `BuildRun` uses the `pipeline` service account if it exists in the namespace, and falls back to the `default` service account. diff --git a/pkg/apis/build/v1alpha1/buildrun_types.go b/pkg/apis/build/v1alpha1/buildrun_types.go index 850fd17047..3f85bdfec4 100644 --- a/pkg/apis/build/v1alpha1/buildrun_types.go +++ b/pkg/apis/build/v1alpha1/buildrun_types.go @@ -219,6 +219,8 @@ type ServiceAccount struct { // +optional Name *string `json:"name,omitempty"` // If generates a new ServiceAccount for the build + // + // NOTICE: Generated ServiceAccounts are deprecated, and will be removed in a future release. // +optional Generate *bool `json:"generate,omitempty"` }