Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
Set up some baseline stuff for this repo. (#13)
Browse files Browse the repository at this point in the history
- Enable CircleCI

- Enable linting (and fix a lint error)

- Enable Mergify

- Enable codecov.io

- Add a Makefile and CONTRIBUTING.md
  • Loading branch information
geeknoid authored May 13, 2019
1 parent 488ca20 commit 1c6bdab
Show file tree
Hide file tree
Showing 17 changed files with 376 additions and 19 deletions.
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: 2

jobs:
build:
docker:
- image: gcr.io/istio-testing/circleci:2019-04-22
working_directory: /go/src/istio.io/operator
steps:
- checkout
- run:
name: Building
command: go build ./...

lint:
docker:
- image: gcr.io/istio-testing/circleci:2019-04-22
working_directory: /go/src/istio.io/operator
steps:
- checkout
- run:
name: Linting
command: make lint

test:
docker:
- image: gcr.io/istio-testing/circleci:2019-04-22
working_directory: /go/src/istio.io/operator
steps:
- checkout
- run:
name: Running unit tests
command: go test -race ./...

workflows:
version: 2
all:
jobs:
- build
- test
- lint
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage:
ignore:
183 changes: 183 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
service:
# When updating this, also update bin/linters.sh accordingly
golangci-lint-version: 1.16.x # use the fixed version to not introduce new linters unexpectedly
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 20m

# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs:
- genfiles$
- vendor$

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files:
- ".*\\.pb\\.go"
- ".*\\.gen\\.go"

linters:
enable-all: true
disable:
- depguard
- dupl
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- gosec
- nakedret
- prealloc
- scopelint
fast: false

linters-settings:
errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false

# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
govet:
# report about shadowed variables
check-shadowing: false
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.0
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: istio.io/
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 160
# tab width in spaces. Default to 1.
tab-width: 1
unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unparam:
# call graph construction algorithm (cha, rta). In general, use cha for libraries,
# and rta for programs with main packages. Default is cha.
algo: cha

# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
gocritic:
enabled-checks:
- appendCombine
- argOrder
- assignOp
- badCond
- boolExprSimplify
- builtinShadow
- captLocal
- caseOrder
- codegenComment
- commentedOutCode
- commentedOutImport
- defaultCaseOrder
- deprecatedComment
- docStub
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- emptyFallthrough
- equalFold
- flagDeref
- flagName
- hexLiteral
- indexAlloc
- initClause
- methodExprCall
- nilValReturn
- octalLiteral
- offBy1
- rangeExprCopy
- regexpMust
- sloppyLen
- stringXbytes
- switchTrue
- typeAssertChain
- typeSwitchVar
- typeUnparen
- underef
- unlambda
- unnecessaryBlock
- unslice
- valSwap
- weakCond
- yodaStyleExpr

# Unused
# - appendAssign
# - commentFormatting
# - emptyStringTest
# - exitAfterDefer
# - ifElseChain
# - hugeParam
# - importShadow
# - nestingReduce
# - paramTypeCombine
# - ptrToRefParam
# - rangeValCopy
# - singleCaseSwitch
# - sloppyReassign
# - unlabelStmt
# - unnamedResult
# - wrapperFunc

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:
- composite literal uses unkeyed fields

exclude-rules:
# Exclude some linters from running on test files.
- path: _test\.go$|^tests/|^samples/
linters:
- errcheck
- maligned

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: true

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
15 changes: 15 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pull_request_rules:
- name: Automatic merge on CI success and review
conditions:
- "status-success=ci/circleci: build"
- "status-success=ci/circleci: test"
- "status-success=ci/circleci: lint"
- status-success=cla/google
- "#approved-reviews-by>=1"
- label!=do-not-merge
- label!=do-not-merge/work-in-progress
- label!=do-not-merge/hold
actions:
merge:
method: squash
strict: false
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @mostrowski @rcernich @martonsereg @waynz
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contribution guidelines

So you want to hack on Istio? Yay! Please refer to Istio's overall
[contribution guidelines](https://github.com/istio/community/blob/master/CONTRIBUTING.md)
to find out how you can help.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lint:
@scripts/linters.sh

format:
@scripts/fmt.sh
5 changes: 0 additions & 5 deletions OWNERS

This file was deleted.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[![CircleCI](https://circleci.com/gh/istio/operator.svg?style=svg)](https://circleci.com/gh/istio/operator)
[![Mergify Status](https://gh.mergify.io/badges/istio/operator.png?style=cut)](https://mergify.io)
[![Go Report Card](https://goreportcard.com/badge/github.com/istio/operator)](https://goreportcard.com/report/github.com/istio/operator)
[![GolangCI](https://golangci.com/badges/github.com/istio/operator.svg)](https://golangci.com/r/github.com/istio/operator)

# Istio Operator

Update 4/22/19

This repo is for the initial, alpha version of the official Istio install operator. It's currently only open to the core
Expand Down
4 changes: 2 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/istio-ecosystem/istio-operator/istio-operator/pkg/apis"
"github.com/istio-ecosystem/istio-operator/istio-operator/pkg/controller"
"istio.io/operator/pkg/apis"
"istio.io/operator/pkg/controller"

"github.com/operator-framework/operator-sdk/pkg/k8sutil"
"github.com/operator-framework/operator-sdk/pkg/leader"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/addtoscheme_istio_v1alpha1.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package apis

import (
"github.com/istio-ecosystem/istio-operator/pkg/apis/istio/v1alpha1"
"istio.io/operator/pkg/apis/istio/v1alpha1"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/istio/v1alpha1/istiocontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ type IstioControlPlaneStatus struct {
// IstioControlPlane is the Schema for the istiocontrolplanes API
// +k8s:openapi-gen=true
type IstioControlPlane struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec IstioControlPlaneSpec `json:"spec,omitempty"`
Status IstioControlPlaneStatus `json:"status,omitempty"`

metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/istio/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controller/add_istiocontrolplane.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package controller

import (
"github.com/istio-ecosystem/istio-operator/pkg/controller/istiocontrolplane"
"istio.io/operator/pkg/controller/istiocontrolplane"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package istiocontrolplane
import (
"context"

istiov1alpha1 "github.com/istio-ecosystem/istio-operator/pkg/apis/istio/v1alpha1"
istiov1alpha1 "istio.io/operator/pkg/apis/istio/v1alpha1"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down
Loading

0 comments on commit 1c6bdab

Please sign in to comment.