Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes-sigs/cli-utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.25.0
Choose a base ref
...
head repository: kubernetes-sigs/cli-utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing 341 changed files with 41,516 additions and 11,039 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -14,19 +14,19 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.14
go-version-file: 'go.mod'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist -f release/goreleaser.yml
args: release --clean -f release/goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 8 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -2,26 +2,25 @@
# SPDX-License-Identifier: Apache-2.0

run:
deadline: 5m
timeout: 30m

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
# - depguard
- dogsled
- dupl
- errcheck
- copyloopvar
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
@@ -30,15 +29,13 @@ linters:
- lll
- misspell
- nakedret
- scopelint
- staticcheck
- structcheck
- stylecheck
- revive
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace


@@ -49,13 +46,14 @@ linters-settings:
line-length: 170
gocyclo:
min-complexity: 30
golint:
min-confidence: 0.85
copyloopvar:
check-alias: true

issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
- Using the variable on range scope `tc` in function literal
- "Using the variable on range scope `tc` in function literal"
- "unused-parameter: parameter"
2 changes: 2 additions & 0 deletions LICENSE_TEMPLATE_GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Copyright YEAR The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
114 changes: 81 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

.PHONY: generate license fix vet fmt test lint tidy openapi

GOPATH := $(shell go env GOPATH)
MYGOBIN := $(shell go env GOPATH)/bin
SHELL := /bin/bash
export PATH := $(MYGOBIN):$(PATH)

.PHONY: all
all: generate license fix vet fmt test lint tidy

"$(MYGOBIN)/stringer":
go install golang.org/x/tools/cmd/stringer@v0.29.0

"$(MYGOBIN)/addlicense":
go install github.com/google/addlicense@v1.0.0

"$(MYGOBIN)/golangci-lint":
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2

"$(MYGOBIN)/deepcopy-gen":
go install k8s.io/code-generator/cmd/deepcopy-gen@v0.25.2

"$(MYGOBIN)/ginkgo":
go install github.com/onsi/ginkgo/v2/ginkgo@v2.2.0

"$(MYGOBIN)/mdrip":
go install github.com/monopole/mdrip@v1.0.2

"$(MYGOBIN)/kind":
go install sigs.k8s.io/kind@v0.16.0

# The following target intended for reference by a file in
# https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/cli-utils
.PHONY: prow-presubmit-check
@@ -18,74 +38,102 @@ prow-presubmit-check: \

.PHONY: prow-presubmit-check-e2e
prow-presubmit-check-e2e: \
test-e2e verify-kapply-e2e
install-column-apt test-e2e verify-kapply-e2e

.PHONY: prow-presubmit-check-stress
prow-presubmit-check-stress: \
test-stress

.PHONY: fix
fix:
go fix ./...

.PHONY: fmt
fmt:
go fmt ./...

generate:
(which $(GOPATH)/bin/stringer || go get golang.org/x/tools/cmd/stringer)
# Install column (required by verify-kapply-e2e)
# Update is included because the kubekins-e2e container build strips out the package cache.
# In newer versions of debian, column is in the bsdextrautils package,
# but in buster (used by kubekins-e2e) it's in bsdmainutils.
.PHONY: install-column-apt
install-column-apt:
apt-get update
apt-get install -y bsdmainutils

.PHONY: generate-deepcopy
generate-deepcopy: "$(MYGOBIN)/deepcopy-gen"
hack/run-in-gopath.sh deepcopy-gen --input-dirs ./pkg/apis/... -O zz_generated.deepcopy --go-header-file ./LICENSE_TEMPLATE_GO

.PHONY: generate
generate: "$(MYGOBIN)/stringer" generate-deepcopy
go generate ./...

license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
$(GOPATH)/bin/addlicense -y 2020 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
.PHONY: license
license: "$(MYGOBIN)/addlicense"
"$(MYGOBIN)/addlicense" -v -y 2021 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .

verify-license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
$(GOPATH)/bin/addlicense -check .
.PHONY: verify-license
verify-license: "$(MYGOBIN)/addlicense"
"$(MYGOBIN)/addlicense" -check .

.PHONY: tidy
tidy:
go mod tidy

lint:
(which $(GOPATH)/bin/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0)
$(GOPATH)/bin/golangci-lint run ./...
.PHONY: lint
lint: "$(MYGOBIN)/golangci-lint"
"$(MYGOBIN)/golangci-lint" run ./...

.PHONY: test
test:
go test -race -cover ./cmd/... ./pkg/...

test-e2e: $(MYGOBIN)/ginkgo $(MYGOBIN)/kind
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e
$(GOPATH)/bin/ginkgo ./test/e2e/...
.PHONY: test-e2e
test-e2e: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
"$(MYGOBIN)/ginkgo" -v ./test/e2e/... -- -v 3

.PHONY: test-e2e-focus
test-e2e-focus: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
"$(MYGOBIN)"/ginkgo -v -focus ".*$(FOCUS).*" ./test/e2e/... -- -v 5

.PHONY: test-stress
test-stress: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m \
--config=./test/stress/kind-cluster.yaml
kubectl wait nodes --for=condition=ready --all --timeout=5m
"$(MYGOBIN)/ginkgo" -v ./test/stress/... -- -v 3

.PHONY: vet
vet:
go vet ./...

.PHONY: build
build:
go build -o bin/kapply sigs.k8s.io/cli-utils/cmd;
mv bin/kapply $(MYGOBIN)
mv bin/kapply "$(MYGOBIN)"

.PHONY: build-with-race-detector
build-with-race-detector:
go build -race -o bin/kapply sigs.k8s.io/cli-utils/cmd;
mv bin/kapply $(MYGOBIN)
mv bin/kapply "$(MYGOBIN)"

.PHONY: verify-kapply-e2e
verify-kapply-e2e: test-examples-e2e-kapply

$(MYGOBIN)/ginkgo:
go get github.com/onsi/ginkgo/ginkgo@v1.14.2

$(MYGOBIN)/mdrip:
go install github.com/monopole/mdrip@v1.0.2

.PHONY:
test-examples-e2e-kapply: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
.PHONY: test-examples-e2e-kapply
test-examples-e2e-kapply: "$(MYGOBIN)/mdrip" "$(MYGOBIN)/kind"
( \
set -e; \
/bin/rm -f bin/kapply; \
/bin/rm -f $(MYGOBIN)/kapply; \
/bin/rm -f "$(MYGOBIN)/kapply"; \
echo "Installing kapply from ."; \
make build-with-race-detector; \
./hack/testExamplesE2EAgainstKapply.sh .; \
)

$(MYGOBIN)/kind:
go get sigs.k8s.io/kind@v0.9.0

.PHONY: nuke
nuke: clean
sudo rm -rf $(shell go env GOPATH)/pkg/mod/sigs.k8s.io
nuke:
sudo rm -rf "$(GOPATH)/pkg/mod/sigs.k8s.io"
12 changes: 9 additions & 3 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# See the OWNERS docs at https://go.k8s.io/owners

approvers:
- pwittrock
- seans3
- soltysh
- liujingfang1
- barney-s
- mortent
- karlkfi

reviewers:
- seans3
- liujingfang1
- mortent
- ash2k
- karlkfi
- haiyanmeng
Loading