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 @mikedanese
pull/8/head
Kubernetes Submit Queue 2018-04-17 17:31:13 -07:00 committed by GitHub
commit af91dfc9e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 23 deletions

2
Godeps/Godeps.json generated
View File

@ -2066,7 +2066,7 @@
},
{
"ImportPath": "github.com/kubernetes/repo-infra/kazel",
"Rev": "2a736b4fba317cf3038e3cbd06899b544b875fae"
"Rev": "d9bb9fdc907665c61c228baa64fed9b91c7dc1b0"
},
{
"ImportPath": "github.com/libopenstorage/openstorage/api",

View File

@ -17,7 +17,6 @@ openapi_library(
"pkg/kubelet/apis/kubeletconfig/v1beta1",
"pkg/proxy/apis/kubeproxyconfig/v1alpha1",
"pkg/version",
"vendor/github.com/kubernetes/repo-infra/kazel",
],
tags = ["automanaged"],
vendor_prefix = openapi_vendor_prefix,

View File

@ -1,18 +1,4 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "kazel",
embed = [":go_default_library"],
tags = ["automanaged"],
)
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
@ -24,13 +10,19 @@ go_library(
"sourcerer.go",
],
importpath = "github.com/kubernetes/repo-infra/kazel",
tags = ["automanaged"],
visibility = ["//visibility:private"],
deps = [
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
],
)
go_binary(
name = "kazel",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),

View File

@ -17,19 +17,23 @@ limitations under the License.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
)
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.
@ -75,8 +79,12 @@ func (v *Vendorer) findOpenAPI(root string) ([]string, error) {
if err != nil {
return nil, err
}
if bytes.Contains(b, []byte(openAPIGenTag)) {
includeMe = true
matches := genTagRe.FindAllSubmatch(b, -1)
for _, m := range matches {
if len(m) >= 2 && string(m[1]) == openAPITagName {
includeMe = true
break
}
}
}
}