mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-02-21 22:57:15 +00:00
Revert "Implement validation-gen lint for CI"
This reverts commit 252d584cb7.
Lint logic is implemented through golanci-lint&kube-api-linter
This commit is contained in:
@@ -130,7 +130,7 @@ function codegen::protobuf() {
|
||||
| sed 's|^|k8s.io/kubernetes/|;s|k8s.io/kubernetes/staging/src/||' \
|
||||
| sort -u)
|
||||
|
||||
kube::log::status "protobufs: ${#apis[@]} targets"
|
||||
kube::log::status "Generating protobufs for ${#apis[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: generating protobufs for:"
|
||||
for dir in "${apis[@]}"; do
|
||||
@@ -163,13 +163,6 @@ function codegen::protobuf() {
|
||||
# register: generate deep-copy functions and register them with a
|
||||
# scheme
|
||||
function codegen::deepcopy() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for deepcopy codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/deepcopy-gen
|
||||
@@ -195,7 +188,7 @@ function codegen::deepcopy() {
|
||||
tag_pkgs+=("./$dir")
|
||||
done
|
||||
|
||||
kube::log::status "deepcopy: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating deepcopy code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running deepcopy-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -271,13 +264,6 @@ EOF
|
||||
# Some of the later codegens depend on the results of this, so it needs to come
|
||||
# first in the case of regenerating everything.
|
||||
function codegen::swagger() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for swagger codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool
|
||||
GOPROXY=off go install \
|
||||
./cmd/genswaggertypedocs
|
||||
@@ -285,7 +271,7 @@ function codegen::swagger() {
|
||||
local group_versions=()
|
||||
IFS=" " read -r -a group_versions <<< "meta/v1 meta/v1beta1 ${KUBE_AVAILABLE_GROUP_VERSIONS}"
|
||||
|
||||
kube::log::status "swagger: ${#group_versions[@]} targets"
|
||||
kube::log::status "Generating swagger for ${#group_versions[@]} targets"
|
||||
|
||||
git_find -z ':(glob)**/types_swagger_doc_generated.go' | xargs -0 rm -f
|
||||
|
||||
@@ -301,13 +287,6 @@ function codegen::swagger() {
|
||||
# comment-tag in column 0 of one file of the form:
|
||||
# // +k8s:prerelease-lifecycle-gen=true
|
||||
function codegen::prerelease() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for prerelease codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/prerelease-lifecycle-gen
|
||||
@@ -333,7 +312,7 @@ function codegen::prerelease() {
|
||||
tag_pkgs+=("./$dir")
|
||||
done
|
||||
|
||||
kube::log::status "prerelease-lifecycle: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating prerelease-lifecycle code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running prerelease-lifecycle-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -372,13 +351,6 @@ function codegen::prerelease() {
|
||||
# FIELDNAME: any object with a field of this name is a candidate
|
||||
# for having a defaulter generated
|
||||
function codegen::defaults() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for defaults codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/defaulter-gen
|
||||
@@ -404,7 +376,7 @@ function codegen::defaults() {
|
||||
tag_pkgs+=("./$dir")
|
||||
done
|
||||
|
||||
kube::log::status "defaults: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating defaulter code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running defaulter-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -480,7 +452,7 @@ function codegen::validation() {
|
||||
time
|
||||
)
|
||||
|
||||
kube::log::status "validation: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating validation code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running validation-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -488,19 +460,13 @@ function codegen::validation() {
|
||||
done
|
||||
fi
|
||||
|
||||
local lint_flag=() # empty arrays expand to no-value (as opposed to "")
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
lint_flag+=("--lint")
|
||||
else
|
||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||
fi
|
||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||
|
||||
validation-gen \
|
||||
-v "${KUBE_VERBOSE}" \
|
||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||
--output-file "${output_file}" \
|
||||
$(printf -- " --readonly-pkg %s" "${readonly_pkgs[@]}") \
|
||||
"${lint_flag[@]}" `# may expand to nothing` \
|
||||
"${tag_pkgs[@]}" \
|
||||
"$@"
|
||||
|
||||
@@ -531,13 +497,6 @@ function codegen::validation() {
|
||||
# TODO: it might be better in the long term to make peer-types explicit in the
|
||||
# IDL.
|
||||
function codegen::conversions() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for conversions codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/conversion-gen
|
||||
@@ -569,7 +528,7 @@ function codegen::conversions() {
|
||||
k8s.io/api/core/v1
|
||||
)
|
||||
|
||||
kube::log::status "conversion: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating conversion code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running conversion-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -599,13 +558,6 @@ function codegen::conversions() {
|
||||
# // +k8s:register-gen=package
|
||||
#
|
||||
function codegen::register() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for register codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/register-gen
|
||||
@@ -631,7 +583,7 @@ function codegen::register() {
|
||||
tag_pkgs+=("./$dir")
|
||||
done
|
||||
|
||||
kube::log::status "register: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating register code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running register-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -677,13 +629,6 @@ function k8s_tag_files_except() {
|
||||
# comment-tag in column 0 of one file of the form:
|
||||
# // +k8s:openapi-gen=true
|
||||
function codegen::openapi() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for openapi codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the tool.
|
||||
GOPROXY=off go install \
|
||||
k8s.io/kube-openapi/cmd/openapi-gen
|
||||
@@ -730,7 +675,7 @@ function codegen::openapi() {
|
||||
tag_pkgs+=("./$dir")
|
||||
done
|
||||
|
||||
kube::log::status "openapi: ${#tag_pkgs[@]} targets"
|
||||
kube::log::status "Generating openapi code"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running openapi-gen for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
@@ -766,13 +711,6 @@ function codegen::openapi() {
|
||||
}
|
||||
|
||||
function codegen::applyconfigs() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for applyconfigs codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
GOPROXY=off go install \
|
||||
k8s.io/kubernetes/pkg/generated/openapi/cmd/models-schema \
|
||||
k8s.io/code-generator/cmd/applyconfiguration-gen
|
||||
@@ -785,7 +723,7 @@ function codegen::applyconfigs() {
|
||||
| sort -u)
|
||||
ext_apis+=("k8s.io/apimachinery/pkg/apis/meta/v1")
|
||||
|
||||
kube::log::status "apply-config: ${#ext_apis[@]} targets"
|
||||
kube::log::status "Generating apply-config code for ${#ext_apis[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running applyconfiguration-gen for:"
|
||||
for api in "${ext_apis[@]}"; do
|
||||
@@ -815,13 +753,6 @@ function codegen::applyconfigs() {
|
||||
}
|
||||
|
||||
function codegen::clients() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for clients codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/client-gen
|
||||
|
||||
@@ -843,7 +774,7 @@ function codegen::clients() {
|
||||
gv_dirs+=("${pkg_dir}")
|
||||
done
|
||||
|
||||
kube::log::status "clients: ${#gv_dirs[@]} targets"
|
||||
kube::log::status "Generating client code for ${#gv_dirs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running client-gen for:"
|
||||
for dir in "${gv_dirs[@]}"; do
|
||||
@@ -877,13 +808,6 @@ function codegen::clients() {
|
||||
}
|
||||
|
||||
function codegen::listers() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for listers codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/lister-gen
|
||||
|
||||
@@ -894,7 +818,7 @@ function codegen::listers() {
|
||||
| while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| sort -u)
|
||||
|
||||
kube::log::status "listers: ${#ext_apis[@]} targets"
|
||||
kube::log::status "Generating lister code for ${#ext_apis[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running lister-gen for:"
|
||||
for api in "${ext_apis[@]}"; do
|
||||
@@ -924,13 +848,6 @@ function codegen::listers() {
|
||||
}
|
||||
|
||||
function codegen::informers() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for informers codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/informer-gen
|
||||
|
||||
@@ -941,7 +858,7 @@ function codegen::informers() {
|
||||
| while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| sort -u)
|
||||
|
||||
kube::log::status "informers: code for ${#ext_apis[@]} targets"
|
||||
kube::log::status "Generating informer code for ${#ext_apis[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running informer-gen for:"
|
||||
for api in "${ext_apis[@]}"; do
|
||||
@@ -980,13 +897,6 @@ function indent() {
|
||||
}
|
||||
|
||||
function codegen::subprojects() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for subprojects codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Call generation on sub-projects.
|
||||
local subs=(
|
||||
staging/src/k8s.io/code-generator/examples
|
||||
@@ -1001,7 +911,7 @@ function codegen::subprojects() {
|
||||
local codegen
|
||||
codegen="${KUBE_ROOT}/staging/src/k8s.io/code-generator"
|
||||
for sub in "${subs[@]}"; do
|
||||
kube::log::status "subproject ${sub}:"
|
||||
kube::log::status "Generating code for subproject ${sub}"
|
||||
pushd "${sub}" >/dev/null
|
||||
CODEGEN_PKG="${codegen}" \
|
||||
UPDATE_API_KNOWN_VIOLATIONS="${UPDATE_API_KNOWN_VIOLATIONS}" \
|
||||
@@ -1012,13 +922,6 @@ function codegen::subprojects() {
|
||||
}
|
||||
|
||||
function codegen::protobindings() {
|
||||
if [[ -n "${LINT:-}" ]]; then
|
||||
if [[ "${KUBE_VERBOSE}" -gt 2 ]]; then
|
||||
kube::log::status "No linter for protobindings codegen"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Each element of this array is a directory containing subdirectories which
|
||||
# eventually contain a file named "api.proto".
|
||||
local apis=(
|
||||
@@ -1034,7 +937,7 @@ function codegen::protobindings() {
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/dra-health"
|
||||
)
|
||||
|
||||
kube::log::status "protobuf bindings: ${#apis[@]} targets"
|
||||
kube::log::status "Generating protobuf bindings for ${#apis[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: generating protobuf bindings for:"
|
||||
for dir in "${apis[@]}"; do
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2024 The Kubernetes 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 script runs API lint tools.
|
||||
#
|
||||
# Usage: `hack/verify-api-lint.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
LINT=true hack/update-codegen.sh
|
||||
Reference in New Issue
Block a user