Skip to content

Commit bfa64b9

Browse files
authored
add api kind and travis setup (#1)
* travis setup * check travis * add main branch * add cluster-curator api * update travis file * add sonar properties * update token in travis.yaml * fix copyright * update api * update api * update crd and api * update copyright * change crd * add build/bin
1 parent 93b5b4c commit bfa64b9

36 files changed

Lines changed: 1932 additions & 508 deletions

.copyrightignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#file extensions to ignore
2+
.copyrightignore
3+
.yml
4+
.yaml
5+
.properties
6+
# directories to ingore
7+
operator-sdk/*
8+
build-harness/*
9+
build-harness-extensions/*

.gitignore

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11

22
# Binaries for programs and plugins
3+
# Files
34
*.exe
45
*.exe~
56
*.dll
67
*.so
78
*.dylib
89
bin
9-
10-
# Test binary, build with `go test -c`
10+
.build-harness
11+
.build-harness-bootstrap
12+
OPENSOURCE.check
13+
.vscode
14+
cover.html
15+
cover-functional.html
16+
cover-functional-filtered.html
17+
*.tap
1118
*.test
19+
.DS_Store
20+
1221

13-
# Output of the go coverage tool, specifically when used with LiteIDE
14-
*.out
22+
# Folders
23+
.build-docker
24+
build/_output
25+
build-harness
26+
build-harness-extensions
27+
vendor
1528

16-
# Kubernetes Generated files - skip generated files, except for vendored files
29+
test/e2e/resources/clusters
30+
test/e2e/resources/hubs
1731

18-
!vendor/**/zz_generated.*
32+
!vbh/.build-harness-vendorized
33+
!vbh/build-harness
34+
!vbh/build-harness-extensions
1935

20-
# editor and IDE paraphernalia
21-
.idea
22-
*.swp
23-
*.swo
24-
*~
36+
go-bindata.diff

.golangci.yml

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
service:
2+
# When updating this, also update the version stored in docker/build-tools/Dockerfile in the multicloudlab/tools repo.
3+
golangci-lint-version: 1.18.x # use the fixed version to not introduce new linters unexpectedly
4+
run:
5+
# timeout for analysis, e.g. 30s, 5m, default is 1m
6+
deadline: 20m
7+
8+
# which dirs to skip: they won't be analyzed;
9+
# can use regexp here: generated.*, regexp is applied on full path;
10+
# default value is empty list, but next dirs are always skipped independently
11+
# from this option's value:
12+
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
13+
skip-dirs:
14+
- genfiles$
15+
- vendor$
16+
- bindata$
17+
18+
# which files to skip: they will be analyzed, but issues from them
19+
# won't be reported. Default value is empty list, but there is
20+
# no need to include all autogenerated files, we confidently recognize
21+
# autogenerated files. If it's not please let us know.
22+
skip-files:
23+
- ".*\\.pb\\.go"
24+
- ".*\\.gen\\.go"
25+
26+
linters:
27+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
28+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
29+
disable-all: true
30+
enable:
31+
- deadcode
32+
- errcheck
33+
- goconst
34+
- gocritic
35+
- gocyclo
36+
- gofmt
37+
- goimports
38+
- golint
39+
- gosec
40+
- gosimple
41+
- govet
42+
- ineffassign
43+
- interfacer
44+
- lll
45+
- misspell
46+
- staticcheck
47+
- structcheck
48+
- stylecheck
49+
- typecheck
50+
- unconvert
51+
- unparam
52+
- unused
53+
- varcheck
54+
# don't enable:
55+
# - bodyclose
56+
# - depguard
57+
# - dogsled
58+
# - dupl
59+
# - funlen
60+
# - gochecknoglobals
61+
# - gochecknoinits
62+
# - gocognit
63+
# - godox
64+
# - maligned
65+
# - nakedret
66+
# - prealloc
67+
# - scopelint
68+
# - whitespace
69+
70+
linters-settings:
71+
errcheck:
72+
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
73+
# default is false: such cases aren't reported by default.
74+
check-type-assertions: false
75+
76+
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
77+
# default is false: such cases aren't reported by default.
78+
check-blank: false
79+
govet:
80+
# report about shadowed variables
81+
check-shadowing: false
82+
golint:
83+
# minimal confidence for issues, default is 0.8
84+
min-confidence: 0.0
85+
gofmt:
86+
# simplify code: gofmt with `-s` option, true by default
87+
simplify: true
88+
goimports:
89+
# put imports beginning with prefix after 3rd-party packages;
90+
# it's a comma-separated list of prefixes
91+
local-prefixes: github.com/IBM/
92+
maligned:
93+
# print struct with more effective memory layout or not, false by default
94+
suggest-new: true
95+
misspell:
96+
# Correct spellings using locale preferences for US or UK.
97+
# Default is to use a neutral variety of English.
98+
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
99+
locale: US
100+
ignore-words:
101+
- cancelled
102+
lll:
103+
# max line length, lines longer will be reported. Default is 120.
104+
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
105+
line-length: 160
106+
# tab width in spaces. Default to 1.
107+
tab-width: 1
108+
unused:
109+
# treat code as a program (not a library) and report unused exported identifiers; default is false.
110+
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
111+
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
112+
# with golangci-lint call it on a directory with the changed file.
113+
check-exported: false
114+
unparam:
115+
# call graph construction algorithm (cha, rta). In general, use cha for libraries,
116+
# and rta for programs with main packages. Default is cha.
117+
algo: cha
118+
119+
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
120+
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
121+
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
122+
# with golangci-lint call it on a directory with the changed file.
123+
check-exported: false
124+
gocritic:
125+
enabled-checks:
126+
- appendCombine
127+
- argOrder
128+
- assignOp
129+
- badCond
130+
- boolExprSimplify
131+
- builtinShadow
132+
- captLocal
133+
- caseOrder
134+
- codegenComment
135+
- commentedOutCode
136+
- commentedOutImport
137+
- defaultCaseOrder
138+
- deprecatedComment
139+
- docStub
140+
- dupArg
141+
- dupBranchBody
142+
- dupCase
143+
- dupSubExpr
144+
- elseif
145+
- emptyFallthrough
146+
- equalFold
147+
- flagDeref
148+
- flagName
149+
- hexLiteral
150+
- indexAlloc
151+
- initClause
152+
- methodExprCall
153+
- nilValReturn
154+
- octalLiteral
155+
- offBy1
156+
- rangeExprCopy
157+
- regexpMust
158+
- sloppyLen
159+
- stringXbytes
160+
- switchTrue
161+
- typeAssertChain
162+
- typeSwitchVar
163+
- typeUnparen
164+
- underef
165+
- unlambda
166+
- unnecessaryBlock
167+
- unslice
168+
- valSwap
169+
- weakCond
170+
171+
# Unused
172+
# - yodaStyleExpr
173+
# - appendAssign
174+
# - commentFormatting
175+
# - emptyStringTest
176+
# - exitAfterDefer
177+
# - ifElseChain
178+
# - hugeParam
179+
# - importShadow
180+
# - nestingReduce
181+
# - paramTypeCombine
182+
# - ptrToRefParam
183+
# - rangeValCopy
184+
# - singleCaseSwitch
185+
# - sloppyReassign
186+
# - unlabelStmt
187+
# - unnamedResult
188+
# - wrapperFunc
189+
190+
issues:
191+
# List of regexps of issue texts to exclude, empty list by default.
192+
# But independently from this option we use default exclude patterns,
193+
# it can be disabled by `exclude-use-default: false`. To list all
194+
# excluded by default patterns execute `golangci-lint run --help`
195+
exclude:
196+
- composite literal uses unkeyed fields
197+
198+
exclude-rules:
199+
# Exclude some linters from running on test files.
200+
- path: _test\.go$|^tests/|^samples/
201+
linters:
202+
- errcheck
203+
- maligned
204+
205+
# Independently from option `exclude` we use default exclude patterns,
206+
# it can be disabled by this option. To list all
207+
# excluded by default patterns execute `golangci-lint run --help`.
208+
# Default value for this option is true.
209+
exclude-use-default: true
210+
211+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
212+
max-per-linter: 0
213+
214+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
215+
max-same-issues: 0

.travis.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
language: go
2+
3+
go:
4+
- "1.14.x"
5+
6+
services:
7+
- docker
8+
9+
branches:
10+
only:
11+
- master
12+
- main
13+
- /^release-[0-9]+\..*$/
14+
15+
addons:
16+
sonarcloud:
17+
organization: "open-cluster-management"
18+
token:
19+
secure: "UnWF6FutDrJrJIdWlcZw5ALSIN8RPlYkBpQXf+Hu2XDNBpYw1iI/e8QrcnBHsgaVAps2yzO1hDS6y92NBZiBIT0Xl0VZrgQEKAjJPgMA+CmZIdjKuAMnDBPi/ukItkw1CbZA4FRc8M1DNtIE3jMN/ba1tUlTHCjEf2di/+NzkjIi6h7AVp43cK0lU6OZ80qimNvzYOX72C6JJAOj0alYPjsIRwUPv3YZmm13n+ncGMeFvdTFnw6geniwTb7v/zJgb5WDp6vLHk4x2OoGF8hwejOj/l/uzKh+lHltgi9wOnitoRjUQj7U+qhYSFlVjdH9/I3oKGev4/491+fIEvWNuIS5jZlurWReo8bb9lcBnu5jV/l7OK76QL2R9rnS4jrfO+tRv11OjygTzuZPA/NM8aXn00LQJnQUV3oPcGpe0jZrqFMNQ+lqT/ciblpH+dMeOTcUisHP80tdg+V+vXTS3HzVaWb0iBCeQcxsKopolAhwXYCOJI4oFfpP6ycduFSUiWl2NzBK8uovCUiYUbCMBmTmjmpSDnCDOdTsa145ST1NlYSO2uYllamzPHEK3FkrEk+uVwLjdn3OklF4+lSzhlCCT4qBwhMrjvoV88OdyT2iLzbHYD4LX7hK8D2zaLIWDOI7AUQFsGwRPyj/tnwJkr5zHa8/ebbcsNAQhVfQFrk="
20+
21+
stages:
22+
- unit-test
23+
- build
24+
- functional-test
25+
- release-ff
26+
- publish
27+
28+
before_script:
29+
#- git config --global url.git@github.com:open-cluster-management/.insteadOf https://github.com/open-cluster-management/
30+
- make init
31+
32+
jobs:
33+
include:
34+
- stage: unit-test
35+
name: "Run unit tests"
36+
script:
37+
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
38+
- make sonar/go
39+
40+
- stage: build
41+
name: "build image"
42+
script:
43+
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
44+
- make component/init
45+
- make check
46+
- make component/build # to remove overhead and keep output clean
47+
- make component/push
48+
- make security/scans
49+
50+
# - stage: build
51+
# name: "build and push coverage image"
52+
# script:
53+
# - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
54+
# - make component/build-coverage
55+
# - make component/push-coverage
56+
57+
# - stage: build
58+
# name: "build and push e2e image"
59+
# if: type = pull_request
60+
# script:
61+
# - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
62+
# - make component/build-e2e
63+
# - make component/push-e2e
64+
65+
# - stage: functional-test
66+
# name: "Run functional-test"
67+
# script:
68+
# - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
69+
# - make component/pull
70+
# - make component/test/functional
71+
72+
# - stage: release-ff
73+
# name: "Push commits to current release branch"
74+
# if: type = push AND branch =~ /^master$/
75+
# script:
76+
# - make
77+
# - make release-ff
78+
79+
# - stage: publish
80+
# name: "Publish Image"
81+
# if: type = push AND branch =~ /^release-[0-9]+\..*$/
82+
# script:
83+
# - make jq/install
84+
# - make pipeline-manifest/update PIPELINE_MANIFEST_COMPONENT_SHA256=${TRAVIS_COMMIT} PIPELINE_MANIFEST_COMPONENT_REPO=${TRAVIS_REPO_SLUG} PIPELINE_MANIFEST_BRANCH=${TRAVIS_BRANCH}
85+
# after_script:
86+
# - test "$TRAVIS_PULL_REQUEST" = "false" && test "$TRAVIS_TEST_RESULT" = "1" && ./build/slack-notification.sh || echo "Slack notification not sent"

.yamllint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
rules:
2+
braces: disable
3+
brackets: disable
4+
colons: enable
5+
commas: disable
6+
comments: disable
7+
comments-indentation: disable
8+
document-end: disable
9+
document-start: disable
10+
empty-lines: disable
11+
empty-values: enable
12+
hyphens: enable
13+
indentation: disable
14+
key-duplicates: enable
15+
key-ordering: disable
16+
line-length: disable
17+
new-line-at-end-of-file: disable
18+
new-lines: enable
19+
octal-values: enable
20+
quoted-strings: disable
21+
trailing-spaces: disable
22+
truthy: disable

COMPONENT_NAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cluster-curator-controller

COMPONENT_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.2.0

0 commit comments

Comments
 (0)