From 5eaca8abc3764f823b3756ed4724648eea2c92e0 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 7 Sep 2022 11:13:36 -0400 Subject: [PATCH] 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"`