Update kazel to include openapi tag detection fix

This commit is contained in:
Jeff Grafton 2018-04-12 16:07:08 -07:00
parent 89b56c25f8
commit 81159d2cac
4 changed files with 23 additions and 24 deletions

4
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{ {
"ImportPath": "k8s.io/kubernetes", "ImportPath": "k8s.io/kubernetes",
"GoVersion": "go1.9", "GoVersion": "go1.10",
"GodepVersion": "v80", "GodepVersion": "v80",
"Packages": [ "Packages": [
"github.com/onsi/ginkgo/ginkgo", "github.com/onsi/ginkgo/ginkgo",
@ -2080,7 +2080,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",

View File

@ -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,

View File

@ -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(["**"]),

View File

@ -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
}
} }
} }
} }