From ff5a5a405cbcb53362260e03a62c70d8e2142226 Mon Sep 17 00:00:00 2001 From: Joe Julian Date: Wed, 5 Oct 2022 16:03:44 -0700 Subject: [PATCH 1/4] Allow CGO_ENABLED to be overridden for build On Mac OS they have some custom dns c library that uses some configuration files other than resolv.conf to configure dns lookups. The standard go library does not handle these custom configuration files which causes dns lookups to fail for some mac users. This allows the downstream pacakgers to override CGO_ENABLED to build binaries that use the custom dns library. Signed-off-by: Joe Julian Signed-off-by: Kyle L Frisbie --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d42234a29..d61ac1507 100644 --- a/Makefile +++ b/Makefile @@ -18,12 +18,13 @@ ACCEPTANCE_DIR:=../acceptance-testing ACCEPTANCE_RUN_TESTS=. # go option -PKG := ./... -TAGS := -TESTS := . -TESTFLAGS := -LDFLAGS := -w -s -GOFLAGS := +PKG := ./... +TAGS := +TESTS := . +TESTFLAGS := +LDFLAGS := -w -s +GOFLAGS := +CGO_ENABLED ?= 0 # Rebuild the binary if any of these files change SRC := $(shell find . -type f -name '*.go' -print) go.mod go.sum @@ -77,7 +78,7 @@ all: build build: $(BINDIR)/$(BINNAME) $(BINDIR)/$(BINNAME): $(SRC) - GO111MODULE=on CGO_ENABLED=0 go build $(GOFLAGS) -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)'/$(BINNAME) ./cmd/helm + GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) go build $(GOFLAGS) -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)'/$(BINNAME) ./cmd/helm # ------------------------------------------------------------------------------ # install From 9cf86c4c4fad6ba7e629596dd6037324a5e135b4 Mon Sep 17 00:00:00 2001 From: Kyle L Frisbie Date: Thu, 6 Oct 2022 21:34:30 -0600 Subject: [PATCH 2/4] close #11261 - Inject document separators when rendering CRDs Signed-off-by: Kyle L Frisbie --- pkg/action/show.go | 6 +++--- pkg/action/show_test.go | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/action/show.go b/pkg/action/show.go index 9ba85234d..78fbbdc76 100644 --- a/pkg/action/show.go +++ b/pkg/action/show.go @@ -133,10 +133,10 @@ func (s *Show) Run(chartpath string) (string, error) { if s.OutputFormat == ShowCRDs || s.OutputFormat == ShowAll { crds := s.chart.CRDObjects() if len(crds) > 0 { - if s.OutputFormat == ShowAll && !bytes.HasPrefix(crds[0].File.Data, []byte("---")) { - fmt.Fprintln(&out, "---") - } for _, crd := range crds { + if !bytes.HasPrefix(crd.File.Data, []byte("---")) { + fmt.Fprintln(&out, "---") + } fmt.Fprintf(&out, "%s\n", string(crd.File.Data)) } } diff --git a/pkg/action/show_test.go b/pkg/action/show_test.go index 8b617ea85..5a92bb976 100644 --- a/pkg/action/show_test.go +++ b/pkg/action/show_test.go @@ -102,6 +102,7 @@ func TestShowCRDs(t *testing.T) { {Name: "crds/ignoreme.txt", Data: []byte("error")}, {Name: "crds/foo.yaml", Data: []byte("---\nfoo\n")}, {Name: "crds/bar.json", Data: []byte("---\nbar\n")}, + {Name: "crds/baz.yaml", Data: []byte("\nbaz\n")}, }, } @@ -116,6 +117,10 @@ foo --- bar +--- + +baz + ` if output != expect { t.Errorf("Expected\n%q\nGot\n%q\n", expect, output) From 20f089a315970922f28c6e4f3f9023db60fac9c3 Mon Sep 17 00:00:00 2001 From: Kyle L Frisbie Date: Tue, 9 May 2023 08:22:55 -0600 Subject: [PATCH 3/4] Update pkg/action/show_test.go Co-authored-by: George Jenkins Signed-off-by: Kyle L Frisbie --- pkg/action/show_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/action/show_test.go b/pkg/action/show_test.go index 5a92bb976..68aad824c 100644 --- a/pkg/action/show_test.go +++ b/pkg/action/show_test.go @@ -102,7 +102,7 @@ func TestShowCRDs(t *testing.T) { {Name: "crds/ignoreme.txt", Data: []byte("error")}, {Name: "crds/foo.yaml", Data: []byte("---\nfoo\n")}, {Name: "crds/bar.json", Data: []byte("---\nbar\n")}, - {Name: "crds/baz.yaml", Data: []byte("\nbaz\n")}, + {Name: "crds/baz.yaml", Data: []byte("baz\n")}, }, } From b9f71f50abd4fda2da5ba7e3b507b9bcccde136f Mon Sep 17 00:00:00 2001 From: Kyle L Frisbie Date: Tue, 9 May 2023 11:08:28 -0600 Subject: [PATCH 4/4] fix test expectation --- pkg/action/show_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/action/show_test.go b/pkg/action/show_test.go index 68aad824c..b8b4bf621 100644 --- a/pkg/action/show_test.go +++ b/pkg/action/show_test.go @@ -118,7 +118,6 @@ foo bar --- - baz `