-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0bd08fb
Showing
17 changed files
with
1,323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright Contributors to the Open Cluster Management project | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.21 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.sum') }} | ||
- name: Install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | ||
golangci-lint --version | ||
- name: Build project | ||
run: | | ||
make buildtar | ||
- name: Release | ||
uses: softprops/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body_path: CHANGELOG.md | ||
files: | | ||
bin/kubectr_darwin_amd64.tar.gz | ||
bin/kubectr_darwin_arm64.tar.gz | ||
bin/kubectr_linux_amd64.tar.gz | ||
bin/kubectr_linux_arm64.tar.gz | ||
bin/kubectr_windows_amd64.zip | ||
draft: false | ||
prerelease: false | ||
# - name: Update new version in krew-index | ||
# uses: rajatjindal/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
run: | ||
deadline: 20m | ||
|
||
linters-settings: | ||
dupl: | ||
threshold: 100 | ||
funlen: | ||
lines: 100 | ||
statements: 50 | ||
gci: | ||
local-prefixes: github.com/cfanbo | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
- wrapperFunc | ||
gocyclo: | ||
min-complexity: 15 | ||
goimports: | ||
local-prefixes: github.com/cfanbo | ||
govet: | ||
check-shadowing: false | ||
lll: | ||
line-length: 160 | ||
maligned: | ||
suggest-new: true | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- bodyclose | ||
# - depguard | ||
- dogsled | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- gci | ||
- gofmt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- loggercheck | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
# - revive | ||
- staticcheck | ||
# - stylecheck | ||
- tenv | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- usestdlibvars | ||
|
||
issues: | ||
exclude-use-default: false | ||
exclude: | ||
## Defaults we want from golangci-lint | ||
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok | ||
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked | ||
# golint: False positive when tests are defined in package 'test' | ||
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this | ||
# govet: Common false positives | ||
- (possible misuse of unsafe.Pointer|should have signature) | ||
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore | ||
- ineffective break statement. Did you mean to break out of the outer loop | ||
# gosec: Too many false-positives on 'unsafe' usage | ||
- Use of unsafe calls should be audited | ||
# gosec: Too many false-positives for parametrized shell calls | ||
- Subprocess launch(ed with variable|ing should be audited) | ||
# gosec: Duplicated errcheck checks | ||
- G104 | ||
# gosec: unsafe close on file errors | ||
- G307 | ||
# gosec: Too many issues in popular repos | ||
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less) | ||
# gosec: False positive is triggered by 'src, err := os.ReadFile(filename)' | ||
- Potential file inclusion via variable | ||
- empty-block | ||
|
||
## | ||
## Custom | ||
## | ||
# Mostly harmless buffer writes where we skip error checking | ||
# https://golang.org/pkg/bytes/#Buffer.Write | ||
- "Error return value of `w.Write` is not checked" | ||
- "Error return value of `io.WriteString` is not checked" | ||
- "Error return value of `viper.BindEnv` is not checked" | ||
- "Error return value of `h.Write` is not checked" | ||
- "ExecuteTemplate` is not checked" | ||
|
||
# go sec : we want to allow skipping tls auth | ||
- "TLS InsecureSkipVerify set true." | ||
- "goroutine calls T.Fatalf, which must be called in the same goroutine as the test" | ||
# good job Protobuffs! | ||
- "method XXX" | ||
- "SA1019" | ||
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok | ||
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked | ||
|
||
exclude-rules: | ||
# https://github.com/go-critic/go-critic/issues/926 | ||
- linters: | ||
- gocritic | ||
text: "unnecessaryDefer:" | ||
# Exclude some linters from running on test files. | ||
- path: _test\.go$|^tests/|^integration/|^samples/|templates\.go$ | ||
linters: | ||
- bodyclose | ||
- errcheck | ||
- gomnd | ||
- gosec | ||
- lll | ||
- maligned | ||
- staticcheck | ||
- unparam | ||
- unused | ||
- scopelint | ||
- gosec | ||
- gosimple | ||
# Exclude lll issues for long lines with go:generate | ||
- linters: | ||
- lll | ||
source: "^//go:generate " | ||
# - linters: [golint] | ||
# text: "should have a package comment" | ||
- text: "G112:" | ||
linters: | ||
- gosec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: krew.googlecontainertools.github.com/v1alpha2 | ||
kind: Plugin | ||
metadata: | ||
name: ctr | ||
spec: | ||
version: {{ .TagName }} | ||
homepage: https://github.com/cfanbo/kubectr | ||
shortDescription: list all containers in a pod | ||
description: | | ||
kubectr is a utility that displays all containers in a pod, supporting | ||
both initContainers and ephemeralContainers. | ||
platforms: | ||
- selector: | ||
matchLabels: | ||
os: darwin | ||
arch: amd64 | ||
{{addURIAndSha "https://github.com/cfanbo/kubectr/releases/download/{{ .TagName }}/kubectr_darwin_amd64.tar.gz" .TagName }} | ||
bin: kubectr | ||
- selector: | ||
matchLabels: | ||
os: darwin | ||
arch: arm64 | ||
{{addURIAndSha "https://github.com/cfanbo/kubectr/releases/download/{{ .TagName }}/kubectr_darwin_arm64.tar.gz" .TagName }} | ||
bin: kubectr | ||
- selector: | ||
matchLabels: | ||
os: linux | ||
arch: amd64 | ||
{{addURIAndSha "https://github.com/cfanbo/kubectr/releases/download/{{ .TagName }}/kubectr_linux_amd64.tar.gz" .TagName }} | ||
bin: kubectr | ||
- selector: | ||
matchLabels: | ||
os: linux | ||
arch: arm64 | ||
{{addURIAndSha "https://github.com/cfanbo/kubectr/releases/download/{{ .TagName }}/kubectr_linux_arm64.tar.gz" .TagName }} | ||
bin: kubectr | ||
- selector: | ||
matchLabels: | ||
os: windows | ||
arch: amd64 | ||
{{addURIAndSha "https://github.com/cfanbo/kubectr/releases/download/{{ .TagName }}/kubectr_windows_amd64.zip" .TagName }} | ||
bin: kubectr.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
- Initial release |
Oops, something went wrong.