mirror of https://github.com/k3s-io/k3s
Merge pull request #62499 from ixdy/update-kazel
Automatic merge from submit-queue (batch tested with PRs 62436, 62499, 62664, 62685, 62660). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Update kazel to include openapi tag detection fix **What this PR does / why we need it**: includes the fix from https://github.com/kubernetes/repo-infra/issues/67 for https://github.com/kubernetes/repo-infra/issues/66, which was discovered in @thockin's PR https://github.com/kubernetes/kubernetes/pull/57600/files#r178665554. **Special notes for your reviewer**: I'm not sure what's up with the large list of comment diffs in `Godeps.json`; it looks like the `git describe` strings were (unintentionally?) truncated in @brendanburns's PR https://github.com/kubernetes/kubernetes/pull/61955. **Release note**: ```release-note NONE ``` /assign @brendanburns @thockin @mikedanesepull/8/head
commit
af91dfc9e6
|
@ -2066,7 +2066,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/kubernetes/repo-infra/kazel",
|
"ImportPath": "github.com/kubernetes/repo-infra/kazel",
|
||||||
"Rev": "2a736b4fba317cf3038e3cbd06899b544b875fae"
|
"Rev": "d9bb9fdc907665c61c228baa64fed9b91c7dc1b0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/libopenstorage/openstorage/api",
|
"ImportPath": "github.com/libopenstorage/openstorage/api",
|
||||||
|
|
|
@ -17,7 +17,6 @@ openapi_library(
|
||||||
"pkg/kubelet/apis/kubeletconfig/v1beta1",
|
"pkg/kubelet/apis/kubeletconfig/v1beta1",
|
||||||
"pkg/proxy/apis/kubeproxyconfig/v1alpha1",
|
"pkg/proxy/apis/kubeproxyconfig/v1alpha1",
|
||||||
"pkg/version",
|
"pkg/version",
|
||||||
"vendor/github.com/kubernetes/repo-infra/kazel",
|
|
||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
vendor_prefix = openapi_vendor_prefix,
|
vendor_prefix = openapi_vendor_prefix,
|
||||||
|
|
|
@ -1,18 +1,4 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||||
|
|
||||||
licenses(["notice"])
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
|
||||||
"go_binary",
|
|
||||||
"go_library",
|
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "kazel",
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
tags = ["automanaged"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
|
@ -24,13 +10,19 @@ go_library(
|
||||||
"sourcerer.go",
|
"sourcerer.go",
|
||||||
],
|
],
|
||||||
importpath = "github.com/kubernetes/repo-infra/kazel",
|
importpath = "github.com/kubernetes/repo-infra/kazel",
|
||||||
tags = ["automanaged"],
|
visibility = ["//visibility:private"],
|
||||||
deps = [
|
deps = [
|
||||||
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
|
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go_binary(
|
||||||
|
name = "kazel",
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "package-srcs",
|
name = "package-srcs",
|
||||||
srcs = glob(["**"]),
|
srcs = glob(["**"]),
|
||||||
|
|
|
@ -17,19 +17,23 @@ limitations under the License.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
openAPIGenTag = "// +k8s:openapi-gen"
|
openAPITagName = "openapi-gen"
|
||||||
|
staging = "staging/src/"
|
||||||
|
)
|
||||||
|
|
||||||
staging = "staging/src/"
|
var (
|
||||||
|
// Generator tags are specified using the format "// +k8s:name=value"
|
||||||
|
genTagRe = regexp.MustCompile(`//\s*\+k8s:([^\s=]+)(?:=(\S+))\s*\n`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// walkGenerated updates the rule for kubernetes' OpenAPI generated file.
|
// walkGenerated updates the rule for kubernetes' OpenAPI generated file.
|
||||||
|
@ -75,8 +79,12 @@ func (v *Vendorer) findOpenAPI(root string) ([]string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if bytes.Contains(b, []byte(openAPIGenTag)) {
|
matches := genTagRe.FindAllSubmatch(b, -1)
|
||||||
includeMe = true
|
for _, m := range matches {
|
||||||
|
if len(m) >= 2 && string(m[1]) == openAPITagName {
|
||||||
|
includeMe = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue