Skip to content

Commit

Permalink
Merge pull request #89 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
release v1.10.3
  • Loading branch information
wklken committed Mar 15, 2022
2 parents 1516738 + 3d60a9b commit 620e5fc
Show file tree
Hide file tree
Showing 876 changed files with 55,655 additions and 39,067 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- name: Build
run: make build
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ config.yaml
config_dev.yaml
tmp
init_test.sh
build.yml
.Archive/
.md_configs.data
.me_configs.data
.codecc
7 changes: 0 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ linters:
- bodyclose
- gocritic
- gocyclo
- misspell
- prealloc
- unparam
- wastedassign
- whitespace

# - nlreturn
# - ifshort
# - nestif
# - gofumpt
# - godox
Expand Down
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
description: Fast linters runner for Go.
entry: make lint
types: [go]
language: golang
pass_filenames: false
- id: golang-unittest
name: golang-unittest
description: Golang unittest.
entry: make test
types: [go]
language: golang
pass_filenames: false
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ init:
# go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.43.0
# for make doc
go get -u github.com/swaggo/swag/cmd/swag@v1.6.7
go install github.com/swaggo/swag/cmd/swag@v1.7.6
# for make mock
go install github.com/golang/mock/mockgen@v1.4.4
# for ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@latest

dep:
go mod tidy
Expand All @@ -37,7 +39,12 @@ lint-dupl:
golangci-lint run --no-config --disable-all --enable=dupl

test:
# Apple Silicon
ifeq ("$(shell go env GOOS)-$(shell go env GOARCH)","darwin-arm64")
GOARCH=amd64 go test -mod=vendor -gcflags=all=-l $(shell go list ./... | grep -v mock | grep -v docs) -covermode=count -coverprofile .coverage.cov
else
go test -mod=vendor -gcflags=all=-l $(shell go list ./... | grep -v mock | grep -v docs) -covermode=count -coverprofile .coverage.cov
endif

cov:
go tool cover -html=.coverage.cov
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.5
1.10.3
1 change: 1 addition & 0 deletions build/support-files/sql/0017_iam_20211116-1713_mysql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `bkiam`.`saas_action` ADD COLUMN `related_environments` text NOT NULL;
1 change: 1 addition & 0 deletions build/support-files/sql/0018_iam_20220111-1708_mysql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `bkiam`.`expression` MODIFY COLUMN `type` SMALLINT(5) signed NOT NULL DEFAULT 0;
4 changes: 4 additions & 0 deletions cmd/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import (
// init debug entry pool
_ "iam/pkg/logging/debug"

// init the pdp
_ "iam/pkg/abac/pdp/evalctx"

"iam/pkg/server"
)

Expand Down Expand Up @@ -90,6 +93,7 @@ func Start() {
// NOTE: should be after initRedis
initCaches()
initPolicyCacheSettings()
initVerifyAppCodeAppSecret()
initSuperAppCode()
initSuperUser()
initSupportShieldFeatures()
Expand Down
4 changes: 4 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ func initPolicyCacheSettings() {
cacheimpls.InitPolicyCacheSettings(globalConfig.PolicyCache.Disabled, globalConfig.PolicyCache.ExpirationDays)
}

func initVerifyAppCodeAppSecret() {
cacheimpls.InitVerifyAppCodeAppSecret(globalConfig.EnableBkAuth)
}

func initSuperAppCode() {
config.InitSuperAppCode(globalConfig.SuperAppCode)
}
Expand Down
6 changes: 3 additions & 3 deletions docs/quick_start/develop.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 本地开发环境搭建


## 1. 安装 go1.16 或更高的版本
## 1. 安装 go1.17 或更高的版本

[Go: Download and install](https://golang.org/doc/install)

```shell
$ go version
go version go1.16.3 darwin/amd64
go version go1.17.5 darwin/amd64
```

## 2. 初始化表结构
Expand Down Expand Up @@ -88,4 +88,4 @@ $ make test # 执行单元测试
$ make build # 编译
$ make build-linux # 交叉编译GOOS=linux GOARCH=amd64
$ make serve # 编译并启动
```
```
113 changes: 82 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,62 +1,113 @@
module iam

go 1.16
go 1.17

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/TencentBlueKing/gopkg v1.0.7
github.com/TencentBlueKing/iam-go-sdk v0.0.5
github.com/agiledragon/gomonkey v2.0.2+incompatible
github.com/TencentBlueKing/iam-go-sdk v0.0.8
github.com/agiledragon/gomonkey/v2 v2.3.1
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/alicebob/miniredis v2.5.0+incompatible
github.com/alicebob/miniredis/v2 v2.17.0
github.com/dlmiddlecote/sqlstats v1.0.2
github.com/fatih/structs v1.1.0
github.com/getsentry/sentry-go v0.11.0
github.com/gin-contrib/gzip v0.0.2 // indirect
github.com/gin-gonic/gin v1.7.2
github.com/go-errors/errors v1.1.1 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/validator/v10 v10.6.1
github.com/gin-gonic/gin v1.7.7
github.com/go-playground/validator/v10 v10.9.0
github.com/go-redis/cache/v8 v8.4.1
github.com/go-redis/redis/v8 v8.10.0
github.com/go-sql-driver/mysql v1.6.0
github.com/gofrs/uuid v4.0.0+incompatible
github.com/golang-jwt/jwt/v4 v4.0.0
github.com/gofrs/uuid v4.2.0+incompatible
github.com/golang-jwt/jwt/v4 v4.2.0
github.com/golang/mock v1.6.0
github.com/gomodule/redigo v1.8.2 // indirect
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/jmoiron/sqlx v1.2.0
github.com/json-iterator/go v1.1.11
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.8.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/onsi/ginkgo v1.16.5
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.0.0
github.com/onsi/gomega v1.17.0
github.com/parnurzeal/gorequest v0.2.16
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/prometheus/client_golang v1.11.0
github.com/sirupsen/logrus v1.8.1
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.8.0
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
github.com/steinfletcher/apitest v1.5.11
github.com/stretchr/testify v1.7.0
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
github.com/swaggo/gin-swagger v1.3.0
github.com/swaggo/swag v1.6.7
github.com/ugorji/go v1.2.6 // indirect
github.com/swaggo/gin-swagger v1.3.3
github.com/swaggo/swag v1.7.6
github.com/vmihailenco/msgpack/v5 v5.3.4
github.com/yuin/gopher-lua v0.0.0-20200603152657-dc2b0ca8b37e // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.4.0
go.uber.org/multierr v1.7.0
go.uber.org/zap v1.18.1
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
go.uber.org/zap v1.19.1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
gopkg.in/natefinch/lumberjack.v2 v2.0.0
moul.io/http2curl v1.0.0
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-errors/errors v1.1.1 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.12.2 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.8.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/vmihailenco/bufpool v0.1.11 // indirect
github.com/vmihailenco/go-tinylfu v0.2.0 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
go.opentelemetry.io/otel/metric v0.20.0 // indirect
go.opentelemetry.io/otel/trace v0.20.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/exp v0.0.0-20201221025956-e89b829e73ea // indirect
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.8 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 620e5fc

Please sign in to comment.