From 2abd327d6a29a6a4e551d5d2efe0ddff9cfa11e1 Mon Sep 17 00:00:00 2001 From: Jackline Mutua Date: Wed, 10 Jan 2024 15:44:56 -0500 Subject: [PATCH 1/3] add an ignore annotation on fix failures in scanned files and update .wokeignore The current configuration on the `.wokeignore` file has an increasing number of warnings and some of the warnings cannot be immediately or directly resolved. These include link references to other repositories. In order to minimize noise caused by the woke scan results; a few additions are being suggested. Annotations have also been added to a few src files that still need to be scanned to suppress the warnings. `# Please enter the commit message for your changes. Lines starting --- .wokeignore | 10 +++++++++- docs/api-spec.md | 2 +- docs/developers/controller-logic.md | 1 + docs/developers/local-setup.md | 3 ++- docs/enabling-ha.md | 2 +- docs/pipeline-api.md | 2 ++ docs/pipelineruns.md | 2 +- docs/pipelines.md | 2 +- docs/taskruns.md | 1 + docs/tekton-bundle-contracts.md | 1 + docs/tekton-controller-performance-configuration.md | 3 ++- docs/trusted-resources.md | 1 + docs/workspaces.md | 2 +- pkg/apis/pipeline/v1/when_types.go | 2 ++ pkg/resolution/resolver/git/resolver_test.go | 2 +- 15 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.wokeignore b/.wokeignore index d10fbb27f5f..e0b99e3b845 100644 --- a/.wokeignore +++ b/.wokeignore @@ -1,5 +1,13 @@ go.mod go.sum -vendor config/dummy.go +examples/**/**/*.yaml +pkg/apis/pipeline/**/*.go +pkg/apis/pipeline/**/openapi_generated.go +pkg/apis/pipeline/**/swagger.json +pkg/resolution/resolver/git/*.go +test/custom-task-ctrls/wait-task-beta/config/controller.yaml +test/markdown-lint-config.rc +vendor .wokeignore + diff --git a/docs/api-spec.md b/docs/api-spec.md index 74a7b79a956..5be11c29119 100644 --- a/docs/api-spec.md +++ b/docs/api-spec.md @@ -499,7 +499,7 @@ A `ParamValue` may be a string, a list of string, or a map of string to string. **NB:** All other [EnvVar](https://godoc.org/k8s.io/api/core/v1#EnvVar) types inherited from [core.v1/EnvVar](https://godoc.org/k8s.io/api/core/v1#EnvVar) and supported by the Kubernetes implementation (e.g., `valueFrom`) are **OPTIONAL** for the purposes of this spec. ## Status Signalling - + The Tekton Pipelines API uses the [Kubernetes Conditions convention](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties) to communicate status and errors to the user. `TaskRun`'s `status` field MUST have a `conditions` field, which must be a list of `Condition` objects of the following form: diff --git a/docs/developers/controller-logic.md b/docs/developers/controller-logic.md index 10ebcd76e95..2fb614962d6 100644 --- a/docs/developers/controller-logic.md +++ b/docs/developers/controller-logic.md @@ -3,6 +3,7 @@ Before learning about how Tekton works, it's useful to take some time to understand what a Kubernetes object is. Please see [Understanding Kubernetes objects](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/) for an overview of working with objects. + Kubernetes [API conventions docs](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds) are another useful resource for understanding object terminology. diff --git a/docs/developers/local-setup.md b/docs/developers/local-setup.md index 8c82c313f7c..d8f72494b64 100644 --- a/docs/developers/local-setup.md +++ b/docs/developers/local-setup.md @@ -47,6 +47,7 @@ Complete these prerequisites to run Tekton locally using Minikube: minikube start --memory 6144 --cpus 2 ``` - Point your shell to minikube's docker-daemon by running `eval $(minikube -p minikube docker-env)` + - Set up a [registry on minikube](https://github.com/kubernetes/minikube/tree/master/deploy/addons/registry-aliases) by running `minikube addons enable registry` and `minikube addons enable registry-aliases` ### Reconfigure logging @@ -118,8 +119,8 @@ EOF # connect the registry to the cluster network # (the network may already be connected) docker network connect "kind" "${reg_name}" || true - # Document the local registry +# # https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry cat < By default, the Webhook deployment is _not_ configured to block a [Cluster Autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) from scaling down the node that's running the only replica of the deployment using the `cluster-autoscaler.kubernetes.io/safe-to-evict` annotation. This means that during node drains, the Webhook might be unavailable temporarily, during which time Tekton resources can't be created, updated or deleted. To avoid this, you can add the `safe-to-evict` annotation set to `false` to block node drains during autoscaling, or, better yet, configure multiple replicas of the Webhook deployment. diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index f7e0439660c..38e948b47cb 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -6026,6 +6026,7 @@ string (Optional)

CEL is a string of Common Language Expression, which can be used to conditionally execute the task based on the result of the expression evaluation + More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md

@@ -15335,6 +15336,7 @@ string (Optional)

CEL is a string of Common Language Expression, which can be used to conditionally execute the task based on the result of the expression evaluation + More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md

diff --git a/docs/pipelineruns.md b/docs/pipelineruns.md index 1fd3a008537..aec319734c2 100644 --- a/docs/pipelineruns.md +++ b/docs/pipelineruns.md @@ -1429,8 +1429,8 @@ If you set the timeout to 0, the `PipelineRun` fails immediately upon encounteri ### The `status` field Your `PipelineRun`'s `status` field can contain the following fields: - - Required: + - `status` - Most relevant, `status.conditions`, which contains the latest observations of the `PipelineRun`'s state. [See here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties) for information on typical status properties. - `startTime` - The time at which the `PipelineRun` began executing, in [RFC3339](https://tools.ietf.org/html/rfc3339) format. - `completionTime` - The time at which the `PipelineRun` finished executing, in [RFC3339](https://tools.ietf.org/html/rfc3339) format. diff --git a/docs/pipelines.md b/docs/pipelines.md index 2de52d549c0..c23002969f8 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -975,7 +975,7 @@ Whole `Array` and `Object` replacements are not supported yet. The following usa - cel: "'foo' in '$(params.array_params[*]']" - cel: "'foo' in '$(params.object_params[*]']" ``` - + In addition to the cases listed above, you can craft any valid CEL expression as defined by the [cel-spec language definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md) diff --git a/docs/taskruns.md b/docs/taskruns.md index 6db9c375f1b..bcfc4e34b2d 100644 --- a/docs/taskruns.md +++ b/docs/taskruns.md @@ -786,6 +786,7 @@ The `status` field defines the observed state of `TaskRun` ### The `status` field - Required: - `status` - The most relevant information about the TaskRun's state. This field includes: + - `status.conditions`, which contains the latest observations of the `TaskRun`'s state. [See here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties) for information on typical status properties. - `podName` - Name of the pod containing the containers responsible for executing this `task`'s `step`s. - `startTime` - The time at which the `TaskRun` began executing, conforms to [RFC3339](https://tools.ietf.org/html/rfc3339) format. diff --git a/docs/tekton-bundle-contracts.md b/docs/tekton-bundle-contracts.md index 323366e5b99..dc1a27d2ab7 100644 --- a/docs/tekton-bundle-contracts.md +++ b/docs/tekton-bundle-contracts.md @@ -32,6 +32,7 @@ annotations on a given layer must be unique among all layers of that image. In p Each layer must be compressed and stored with a supported OCI MIME type *except* for `+zstd` types. For list of the supported types see + [the official spec](https://github.com/opencontainers/image-spec/blob/master/layer.md#zstd-media-types). Furthermore, each layer must contain a YAML or JSON representation of the underlying resource. If the resource is diff --git a/docs/tekton-controller-performance-configuration.md b/docs/tekton-controller-performance-configuration.md index 5c69553790a..a0c7f3f4c99 100644 --- a/docs/tekton-controller-performance-configuration.md +++ b/docs/tekton-controller-performance-configuration.md @@ -18,7 +18,7 @@ Configure ThreadsPerController, QPS and Burst This document will show us how to configure [tekton-pipeline-controller](./../config/controller.yaml)'s performance. In general, there are mainly have three parameters will impact the performance of tekton controller, they are `ThreadsPerController`, `QPS` and `Burst`. - `ThreadsPerController`: Threads (goroutines) to create per controller. It's the number of threads to use when processing the controller's work queue. - + - `QPS`: Queries per Second. Maximum QPS to the master from this client. - `Burst`: Maximum burst for throttle. @@ -50,4 +50,5 @@ spec: Now, the ThreadsPerController, QPS and Burst have been changed to be `32`, `50` and `50`. **Note**: + Although in above example, you set QPS and Burst to be `50` and `50`. However, the actual values of them are [multiplied by `2`](https://github.com/pierretasci/pipeline/blob/master/cmd/controller/main.go#L83-L84), so the actual QPS and Burst is `100` and `100`. diff --git a/docs/trusted-resources.md b/docs/trusted-resources.md index 62aa1d55c10..b13a964310b 100644 --- a/docs/trusted-resources.md +++ b/docs/trusted-resources.md @@ -74,6 +74,7 @@ kubectl patch configmap feature-flags -n tekton-pipelines -p='{"data":{"trusted- ``` #### TaskRun and PipelineRun status update + Trusted resources will update the taskrun's [condition](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties) to indicate if it passes verification or not. The following tables illustrate how the conditions are impacted by feature flag and verification result. Note that if not `true` or `false` means this case doesn't update the corresponding condition. diff --git a/docs/workspaces.md b/docs/workspaces.md index 8cf7c578e3a..9728bf1be6a 100644 --- a/docs/workspaces.md +++ b/docs/workspaces.md @@ -532,7 +532,7 @@ workspaces: The `csi` field references a [`csi` volume](https://kubernetes.io/docs/concepts/storage/volumes/#csi). `csi` workspaces are a [beta feature](./additional-configs.md#beta-features). Using a `csi` volume has the following limitations: - + - `csi` volume sources require a volume driver to use, which must correspond to the value by the CSI driver as defined in the [CSI spec](https://github.com/container-storage-interface/spec/blob/master/spec.md#getplugininfo). ```yaml diff --git a/pkg/apis/pipeline/v1/when_types.go b/pkg/apis/pipeline/v1/when_types.go index 66e7164a779..451011634b3 100644 --- a/pkg/apis/pipeline/v1/when_types.go +++ b/pkg/apis/pipeline/v1/when_types.go @@ -37,6 +37,8 @@ type WhenExpression struct { // +listType=atomic Values []string `json:"values,omitempty"` + // wokeignore:rule=master + // CEL is a string of Common Language Expression, which can be used to conditionally execute // the task based on the result of the expression evaluation // More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md diff --git a/pkg/resolution/resolver/git/resolver_test.go b/pkg/resolution/resolver/git/resolver_test.go index a35ec7646a2..02f56c52c8a 100644 --- a/pkg/resolution/resolver/git/resolver_test.go +++ b/pkg/resolution/resolver/git/resolver_test.go @@ -589,6 +589,7 @@ func TestResolve(t *testing.T) { cfg = make(map[string]string) } cfg[defaultTimeoutKey] = "1m" + // wokeignore:rule=master if cfg[defaultRevisionKey] == "" { cfg[defaultRevisionKey] = plumbing.Master.Short() } @@ -711,7 +712,6 @@ func createTestRepo(t *testing.T, commits []commitForRepo) (string, []string) { coOpts := &git.CheckoutOptions{ Branch: plumbing.NewBranchReferenceName(branch), } - if _, ok := hashesByBranch[branch]; !ok && branch != plumbing.Master.Short() { coOpts.Hash = plumbing.NewHash(startingHash.String()) coOpts.Create = true From c792a109c66ca3cdfffdd95b81676ee73f354d74 Mon Sep 17 00:00:00 2001 From: Jackline Mutua Date: Thu, 11 Jan 2024 14:01:23 -0500 Subject: [PATCH 2/3] remove annotations added as changes to ignore list already cover these files The .wokeignore file has been modified to ignore these paths the annotations on the source file have been ommitted --- pkg/apis/pipeline/v1/when_types.go | 2 -- pkg/resolution/resolver/git/resolver_test.go | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/apis/pipeline/v1/when_types.go b/pkg/apis/pipeline/v1/when_types.go index 451011634b3..66e7164a779 100644 --- a/pkg/apis/pipeline/v1/when_types.go +++ b/pkg/apis/pipeline/v1/when_types.go @@ -37,8 +37,6 @@ type WhenExpression struct { // +listType=atomic Values []string `json:"values,omitempty"` - // wokeignore:rule=master - // CEL is a string of Common Language Expression, which can be used to conditionally execute // the task based on the result of the expression evaluation // More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md diff --git a/pkg/resolution/resolver/git/resolver_test.go b/pkg/resolution/resolver/git/resolver_test.go index 02f56c52c8a..a35ec7646a2 100644 --- a/pkg/resolution/resolver/git/resolver_test.go +++ b/pkg/resolution/resolver/git/resolver_test.go @@ -589,7 +589,6 @@ func TestResolve(t *testing.T) { cfg = make(map[string]string) } cfg[defaultTimeoutKey] = "1m" - // wokeignore:rule=master if cfg[defaultRevisionKey] == "" { cfg[defaultRevisionKey] = plumbing.Master.Short() } @@ -712,6 +711,7 @@ func createTestRepo(t *testing.T, commits []commitForRepo) (string, []string) { coOpts := &git.CheckoutOptions{ Branch: plumbing.NewBranchReferenceName(branch), } + if _, ok := hashesByBranch[branch]; !ok && branch != plumbing.Master.Short() { coOpts.Hash = plumbing.NewHash(startingHash.String()) coOpts.Create = true From 92429cb984d0cce6bc9a98919288ecc4b98cfbeb Mon Sep 17 00:00:00 2001 From: Jackline Mutua Date: Thu, 11 Jan 2024 15:45:37 -0500 Subject: [PATCH 3/3] add docs/pipeline-api.md to ignore list This file is a generated file so adding it to the .wokeignore list. --- .wokeignore | 1 + docs/pipeline-api.md | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.wokeignore b/.wokeignore index e0b99e3b845..b2c19a8fd56 100644 --- a/.wokeignore +++ b/.wokeignore @@ -1,6 +1,7 @@ go.mod go.sum config/dummy.go +docs/pipeline-api.md examples/**/**/*.yaml pkg/apis/pipeline/**/*.go pkg/apis/pipeline/**/openapi_generated.go diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index 38e948b47cb..f7e0439660c 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -6026,7 +6026,6 @@ string (Optional)

CEL is a string of Common Language Expression, which can be used to conditionally execute the task based on the result of the expression evaluation - More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md

@@ -15336,7 +15335,6 @@ string (Optional)

CEL is a string of Common Language Expression, which can be used to conditionally execute the task based on the result of the expression evaluation - More info about CEL syntax: https://github.com/google/cel-spec/blob/master/doc/langdef.md