Skip to content

Commit

Permalink
Fix SiteInfo publishing (#1323) (#1336)
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: 1gtm <[email protected]>
Signed-off-by: Tamal Saha <[email protected]>

Co-authored-by: lgtm <[email protected]>
  • Loading branch information
tamalsaha and 1gtm authored Nov 24, 2021
1 parent f65fdb4 commit 16ca1fa
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.15
require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.3
go.bytebuilders.dev/license-verifier/kubernetes v0.9.5
go.bytebuilders.dev/license-verifier/kubernetes v0.9.7
gomodules.xyz/flags v0.1.3
gomodules.xyz/go-sh v0.1.0
gomodules.xyz/logs v0.0.6
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPS
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
go.bytebuilders.dev/audit v0.0.10/go.mod h1:jhNyXHoeVHijC4tM7EYpcB9RqkwnI27IoRN3k0ivick=
go.bytebuilders.dev/license-verifier v0.9.3/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8=
go.bytebuilders.dev/license-verifier v0.9.5 h1:XUbFH3LzHSpQFtVS/MiT5RN0gr/KNNBvnOm78KYoAEQ=
go.bytebuilders.dev/license-verifier v0.9.5/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8=
go.bytebuilders.dev/license-verifier/kubernetes v0.9.5 h1:KWzmh4qZ+3cR8LpBuUfufb2goK5NuULyE0uKYgt3D50=
go.bytebuilders.dev/license-verifier/kubernetes v0.9.5/go.mod h1:mg5pZDweHlpTTw57kOdLj4bU107hHVP/1xTKKZ1eUNc=
go.bytebuilders.dev/license-verifier v0.9.7 h1:m7Z3cuVJYUUctCfTK6qT0IKtPVZurxq1b1bKzWjqwsE=
go.bytebuilders.dev/license-verifier v0.9.7/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8=
go.bytebuilders.dev/license-verifier/kubernetes v0.9.7 h1:TN9N9FmmxrPTQoAPJsQnHRgY00liNZgiTUyZ2QNtqyg=
go.bytebuilders.dev/license-verifier/kubernetes v0.9.7/go.mod h1:hsNtdOrSnm5v8dwTgbKLVADNTgD+b6eaZHXiJZXoPcE=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
Expand Down
4 changes: 2 additions & 2 deletions vendor/go.bytebuilders.dev/license-verifier/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ BIN_PLATFORMS := $(DOCKER_PLATFORMS) windows/amd64 darwin/amd64
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))

BASEIMAGE_PROD ?= gcr.io/distroless/static-debian10
BASEIMAGE_DBG ?= debian:buster
BASEIMAGE_PROD ?= gcr.io/distroless/static-debian11
BASEIMAGE_DBG ?= debian:bullseye

GO_VERSION ?= 1.17
BUILD_IMAGE ?= appscode/golang-dev:$(GO_VERSION)
Expand Down
12 changes: 12 additions & 0 deletions vendor/go.bytebuilders.dev/license-verifier/info/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"net/url"
"path"
"strconv"
"strings"
"unicode"
)

var (
Expand All @@ -37,6 +39,16 @@ var (
registrationAPIPath = "api/v1/register"
)

func Features() []string {
return ParseFeatures(ProductName)
}

func ParseFeatures(features string) []string {
return strings.FieldsFunc(features, func(r rune) bool {
return unicode.IsSpace(r) || r == ',' || r == ';'
})
}

func SkipLicenseVerification() bool {
v, _ := strconv.ParseBool(EnforceLicense)
return !v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/gogo/protobuf v1.3.2
go.bytebuilders.dev/license-verifier v0.9.5
go.bytebuilders.dev/license-verifier v0.9.7
k8s.io/api v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/apiserver v0.21.1
Expand Down
7 changes: 2 additions & 5 deletions vendor/go.bytebuilders.dev/license-verifier/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"encoding/pem"
"fmt"
"strings"
"unicode"

"go.bytebuilders.dev/license-verifier/apis/licenses/v1alpha1"
"go.bytebuilders.dev/license-verifier/info"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -165,10 +165,7 @@ func VerifyLicense(opts *Options) (v1alpha1.License, error) {
license.Reason = e2.Error()
return license, e2
}
features := strings.FieldsFunc(opts.Features, func(r rune) bool {
return unicode.IsSpace(r) || r == ',' || r == ';'
})
if !sets.NewString(cert.Subject.Organization...).HasAny(features...) {
if !sets.NewString(cert.Subject.Organization...).HasAny(info.ParseFeatures(opts.Features)...) {
e2 := fmt.Errorf("license was not issued for %s", opts.Features)
license.Status = v1alpha1.LicenseExpired
license.Reason = e2.Error()
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ github.com/yudai/gojsondiff
github.com/yudai/gojsondiff/formatter
# github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82
github.com/yudai/golcs
# go.bytebuilders.dev/license-verifier v0.9.5
# go.bytebuilders.dev/license-verifier v0.9.7
go.bytebuilders.dev/license-verifier
go.bytebuilders.dev/license-verifier/apis/licenses
go.bytebuilders.dev/license-verifier/apis/licenses/v1alpha1
go.bytebuilders.dev/license-verifier/info
# go.bytebuilders.dev/license-verifier/kubernetes v0.9.5
# go.bytebuilders.dev/license-verifier/kubernetes v0.9.7
## explicit
go.bytebuilders.dev/license-verifier/kubernetes
# golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b
Expand Down

0 comments on commit 16ca1fa

Please sign in to comment.