diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml
new file mode 100644
index 00000000..22581d5e
--- /dev/null
+++ b/.github/workflows/codecov.yml
@@ -0,0 +1,20 @@
+name: Test and coverage
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 2
+ - uses: actions/setup-go@v2
+ with:
+ go-version: '1.17'
+ - name: Go Module Downloads
+ run: go mod tidy
+ - name: Run coverage
+ run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
+ - name: Upload coverage to Codecov
+ run: bash <(curl -s https://codecov.io/bash)
diff --git a/.github/workflows/sync-to-gitee.yml b/.github/workflows/sync-to-gitee.yml
index 5fabcabc..20482055 100644
--- a/.github/workflows/sync-to-gitee.yml
+++ b/.github/workflows/sync-to-gitee.yml
@@ -4,6 +4,7 @@ on:
push:
branches:
- master
+ - v1.5.0-feat-app-refactor
jobs:
sync:
runs-on: ubuntu-latest
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 04953f51..1f718f9a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,10 +32,40 @@
# use the pull.rebase config option to change the behavior for every git pull (instead of only newly-created branches)
git config pull.rebase true
```
+3. 如果您提交的代码涉及到数据迁移,请在`internal/migrations`目录下添加迁移脚本,并在`migration.go`中注册该脚本
+ ```go
+ type MigrationXXXXX struct {
+ }
+
+ func (m MigrationXXXXX) GetCreateAt() time.Time{
+ //时间请设定为提交代码的当前时间,以便于系统自动记录迁移历史
+ return time.Date(2022, 1, 1, 0, 0, 0, 0, time.Local)
+ }
+ func (m Migration20220101) Upgrade(ormer orm.Ormer) error{
+ //样例代码如下,err不为nil时,会自动回滚所有操作
+ /*
+ err := ormer.Raw(xxxx).Exec()
+ return err
+ */
+
+ }
-3. Create a pull request to the main repository on GitHub.
-4. When the reviewer makes some comments, address any feedback that comes and update the pull request.
-5. When your contribution is accepted, your pull request will be approved and merged to the main branch.
+ ```
+
+ ```go
+ //在migrations.go中
+ func InitMigration() {
+ migrationTypes := MigrationTypes{
+ //注册
+ new(MigrationXXXXX),
+ //...
+ }
+
+ }
+ ```
+4. Create a pull request to the main repository on GitHub.
+5. When the reviewer makes some comments, address any feedback that comes and update the pull request.
+6. When your contribution is accepted, your pull request will be approved and merged to the main branch.
### 2. 文档贡献
diff --git a/README.md b/README.md
index fde0e8e4..e86f3916 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
# atomci
+
+[![codecov](https://codecov.io/gh/go-atomci/atomci/branch/master/graph/badge.svg?token=VPJGT3405P)](https://codecov.io/gh/go-atomci/atomci)
+[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/go-atomci/atomci/blob/master/LICENSE)
+
AtomCI 致力于让中小企业快速落地Kubernetes,代码均已开源, __您的star__ 是我们开源的动力,非常感谢(:
* github: https://github.com/go-atomci/atomci
@@ -180,7 +184,5 @@ __AtomCI__ 因你而变。
|`ldap::baseDN`| OU=Xxx,DC=xx,DC=com | |
| JWT 配置
|
|`jwt::secret`| changemeforsecurity | jwt的加密使用的字段,建议修改 |
-| K8s配置
|
-|`k8s::configPath`| ./conf/k8sconfig | k8s 配置文件存放路径,不建议修改|
|
|
|`atomci::url`| http://localhost:8080 | AtomCI 回调地址 |
diff --git a/cmd/atomci/main.go b/cmd/atomci/main.go
index f954def7..1b185bfc 100644
--- a/cmd/atomci/main.go
+++ b/cmd/atomci/main.go
@@ -22,18 +22,20 @@ import (
"github.com/astaxie/beego"
_ "github.com/go-sql-driver/mysql" // import your used driver
+ "github.com/go-atomci/atomci/internal/initialize"
+ "github.com/go-atomci/atomci/internal/migrations"
+ "github.com/go-atomci/atomci/internal/models"
+
"github.com/go-atomci/atomci/internal/cronjob"
- _ "github.com/go-atomci/atomci/internal/initialize"
- _ "github.com/go-atomci/atomci/internal/models"
"github.com/go-atomci/atomci/internal/routers"
- "github.com/go-atomci/atomci/pkg/kube"
)
-func init() {
- kube.Init()
-}
-
func main() {
+ models.InitDB()
+ migrations.Migrate()
+ // TODO: resource items migrate later
+ initialize.Init()
+
cronjob.RunPublishJobServer()
beego.Info("Beego version:", beego.VERSION)
diff --git a/conf/app.conf b/conf/app.conf
index 1d47ae1f..3bab7e3e 100644
--- a/conf/app.conf
+++ b/conf/app.conf
@@ -36,9 +36,6 @@ baseDN = OU=Xxx,DC=xx,DC=com
[jwt]
secret = changemeforsecurity
-[k8s]
-configPath = ./conf/k8sconfig
-
# build/deploy callback
[atomci]
url = http://localhost:8080
diff --git a/conf/app.conf.template b/conf/app.conf.template
new file mode 100644
index 00000000..52b2dbaf
--- /dev/null
+++ b/conf/app.conf.template
@@ -0,0 +1,57 @@
+## 模板配置,承载完整最新的配置内容
+[default]
+appname = atomci
+# 默认监听端口
+httpport = 8080
+runmode = dev
+copyrequestbody = true
+
+[log]
+logfile = "log/atomci.log"
+## log level
+# 0: LevelEmergency = iota
+# 1: LevelAlert
+# 2: LevelCritical
+# 3: LevelError
+# 4: LevelWarning
+# 5: LevelNotice
+# 6: LevelInformational
+# 7: LevelDebug
+level = 7
+separate = ["error"]
+
+[DB]
+# 数据库相关配置,目前仅支持mysql5.7+
+url = root:root@tcp(127.0.0.1:3306)/atomci?charset=utf8mb4&loc=Local
+debug = false
+rowsLimit = 5000
+maxIdelConns = 100
+maxOpenConns = 200
+
+[ldap]
+# 支持配置LDAP
+host = ldap.xxx.com
+port = 389
+bindDN = ldap@xx.com
+bindPassword = Xxx..,
+userFilter = (samaccountname=%s)
+baseDN = OU=Xxx,DC=xx,DC=com
+
+[jwt]
+secret = changemeforsecurity
+
+[atomci]
+# atomci后端服务地址,用于k8s/jenkins进行回调,因此请确保地址是可以被k8s集群(jenkins agent)访问到
+url = http://localhost:8080
+
+# 通知配置
+[notification]
+# 钉钉通知
+dingEnable = 1
+ding = "https://oapi.dingtalk.com/robot/send?access_token=faketoken"
+# 邮件通知
+mailEnable = 1
+smtpHost = "smtp.host"
+smtpPort = 465
+smtpAccount = "fake@mail.com"
+smtpPassword = "pwd"
\ No newline at end of file
diff --git a/constant/const.go b/constant/const.go
index 7ecd791f..ea5cb11f 100644
--- a/constant/const.go
+++ b/constant/const.go
@@ -54,3 +54,18 @@ const (
// HelmDeployType helm 部署
HelmDeployType = "helm"
)
+
+// integrate type
+const (
+ SCMGitlab = "gitlab"
+ SCMGithub = "github"
+ SCMGitea = "gitea"
+ SCMGitee = "gitee"
+ SCMGogs = "gogs"
+ IntegrateKubernetes = "kubernetes"
+ IntegrateJenkins = "jenkins"
+ IntegrateRegistry = "registry"
+)
+
+var Integratetypes = []string{IntegrateKubernetes, IntegrateJenkins, IntegrateRegistry}
+var ScmIntegratetypes = []string{SCMGitlab, SCMGithub, SCMGitea, SCMGitee, SCMGogs}
diff --git a/deploy/docker-compose/conf/app.conf b/deploy/docker-compose/conf/app.conf
index 48747b24..ce8426cb 100644
--- a/deploy/docker-compose/conf/app.conf
+++ b/deploy/docker-compose/conf/app.conf
@@ -36,9 +36,6 @@ baseDN = OU=Xxx,DC=xx,DC=com
[jwt]
secret = changemeforsecurity
-[k8s]
-configPath = ./conf/k8sconfig
-
# build/deploy callback
[atomci]
url = http://localhost:8080
\ No newline at end of file
diff --git a/deploy/docker-compose/init.sh b/deploy/docker-compose/init.sh
index 8a0ca21d..db8d3a77 100644
--- a/deploy/docker-compose/init.sh
+++ b/deploy/docker-compose/init.sh
@@ -30,16 +30,5 @@ then
echo "$NOT_UP restart failed, please check docker log use 'docker-compose logs [docker-name]'"
fi
-MYSQL_DB=$(grep "MYSQL_DATABASE" docker-compose.yml | awk -F':' '{print $2}')
-MYSQL_DB_STRIP=`echo ${MYSQL_DB} | sed 's/ //g'`
-
-MYSQL_PASSWORD=$(grep "MYSQL_ROOT_PASSWORD" docker-compose.yml | awk -F':' '{print $2}')
-MYSQL_PASSWORD_STRIP=$(echo $MYSQL_PASSWORD | sed 's/ //g')
-
-echo "mysql database: $MYSQL_DB"
-echo "root password: $MYSQL_PASSWORD_STRIP"
-
-docker exec mysql mysql -uroot -p$MYSQL_PASSWORD_STRIP $MYSQL_DB_STRIP < mysql/sql/v1.3.2_00.sql
-
# init result verify
[ $? -eq 0 ] && echo -e "AtomCI 初始化成功(:\n\n访问atomci: http://localhost:8090 \n" || echo -e "AtomCI 初始化失败, 请确认atomci 容器日志,\n或是 https://github.com/go-atomci/atomci-press/issues/new 反馈你的问题(:"
diff --git a/deploy/release/sql/v1.3.2_00.sql b/deploy/release/sql/v1.3.2_00.sql
deleted file mode 100644
index 91b73f0e..00000000
--- a/deploy/release/sql/v1.3.2_00.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-# support normal docker registry
-UPDATE `sys_integrate_setting` SET `type`='registry' WHERE `type`='harbor';
-
-
-# modify table project_env column harbor to registry
-DROP PROCEDURE IF EXISTS `ModifyHarborToRegistry`;
-delimiter $$
-CREATE PROCEDURE `ModifyHarborToRegistry`()
-BEGIN
- DECLARE HARBOREXISTS int DEFAULT 0;
- DECLARE REGISTRYEXISTS int DEFAULT 0;
- SELECT count(1) INTO @HARBOREXISTS FROM information_schema.COLUMNS WHERE TABLE_NAME='project_env' AND COLUMN_NAME='harbor';
- SELECT count(1) INTO @REGISTRYEXISTS FROM information_schema.COLUMNS WHERE TABLE_NAME='project_env' AND COLUMN_NAME='registry';
- IF @HARBOREXISTS>0 AND @REGISTRYEXISTS=0 #存在harbor列 不存在registry列时 直接修改列名
- THEN
- ALTER TABLE `project_env` CHANGE COLUMN `harbor` `registry` bigint(20) NOT NULL DEFAULT 0;
- ELSEIF @HARBOREXISTS>0 AND @REGISTRYEXISTS>0 #harbor列和registry都存在时迁移数据并删除harbor列
- THEN
- UPDATE `project_env` SET `registry`=`harbor`;
- ALTER TABLE `project_env` DROP COLUMN `harbor`;
- END IF;
-END;
-$$
-delimiter ;
-CALL `ModifyHarborToRegistry`;
-DROP PROCEDURE IF EXISTS `ModifyHarborToRegistry`;
\ No newline at end of file
diff --git a/go.mod b/go.mod
index ecf5ed70..089785a3 100644
--- a/go.mod
+++ b/go.mod
@@ -32,29 +32,31 @@ replace (
require (
github.com/astaxie/beego v1.12.1
- github.com/casbin/beego-orm-adapter/v2 v2.0.2 // indirect
- github.com/casbin/beego-orm-adapter/v3 v3.0.2
github.com/casbin/casbin/v2 v2.37.4
github.com/colynn/go-ldap-client/v3 v3.0.0-20201016034829-4c1455a490de
github.com/dgrijalva/jwt-go v3.2.0+incompatible
- github.com/drone/go-scm v1.19.0
+ github.com/drone/go-scm v1.20.0
github.com/ghodss/yaml v1.0.0
github.com/go-atomci/workflow v0.0.0-20211126090842-208f180b47ab
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
github.com/go-sql-driver/mysql v1.6.0
github.com/golang/protobuf v1.4.3 // indirect
- github.com/google/go-cmp v0.5.5 // indirect
+ github.com/google/go-cmp v0.5.7 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/gorilla/websocket v1.4.2
github.com/isbrick/tools v0.0.0-20211027093338-a3a0ded37175
+ github.com/jarcoal/httpmock v1.1.0
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pborman/uuid v1.2.0
- github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
+ github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
+ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013 // indirect
+ golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect
+ golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
diff --git a/go.sum b/go.sum
index 38550122..25eee82b 100644
--- a/go.sum
+++ b/go.sum
@@ -53,8 +53,6 @@ github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8L
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
-github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
-github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
@@ -70,19 +68,13 @@ github.com/Rican7/retry v0.1.0/go.mod h1:FgOROf8P5bebcC1DS0PdOQiqGUridaZvikzUmkF
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
-github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
-github.com/astaxie/beego v1.12.0 h1:MRhVoeeye5N+Flul5PoVfD9CslfdoH+xqC/xvSQ5u2Y=
-github.com/astaxie/beego v1.12.0/go.mod h1:fysx+LZNZKnvh4GED/xND7jWtjCR6HzydR2Hh2Im57o=
github.com/astaxie/beego v1.12.1 h1:dfpuoxpzLVgclveAXe4PyNKqkzgm5zF4tgF2B3kkM2I=
github.com/astaxie/beego v1.12.1/go.mod h1:kPBWpSANNbSdIqOc8SUL9h+1oyBMZhROeYsXQDbidWQ=
github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM=
@@ -92,13 +84,10 @@ github.com/bazelbuild/bazel-gazelle v0.19.1-0.20191105222053-70208cbdc798/go.mod
github.com/bazelbuild/buildtools v0.0.0-20190731111112-f720930ceb60/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
github.com/bazelbuild/rules_go v0.0.0-20190719190356-6dae44dc5cab/go.mod h1:MC23Dc/wkXEyk3Wpq6lCqz0ZAYOZDw2DR5y3N1q2i7M=
-github.com/beego/beego/v2 v2.0.1 h1:07a7Z0Ok5vbqyqh+q53sDPl9LdhKh0ZDy3gbyGrhFnE=
-github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI=
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU=
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
@@ -106,22 +95,13 @@ github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx2
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
-github.com/casbin/beego-orm-adapter/v2 v2.0.2 h1:iT62wNuLtpK40aCc/PkDIg1iw6HSCKscQl8gmnJVbvQ=
-github.com/casbin/beego-orm-adapter/v2 v2.0.2/go.mod h1:Y2f4WxBpDsVxbx+4zpgGbNj7K6JTLkr4LdtTNdZpQrA=
-github.com/casbin/beego-orm-adapter/v3 v3.0.2 h1:wR2ejqwdvrJiLH6hasgmmYmXHS1vZ0sBJGJIIBSfRqY=
-github.com/casbin/beego-orm-adapter/v3 v3.0.2/go.mod h1:IhECH+kzHcELJO7e8Yr3W3ifpxmWieFi6gUTRIdw5pA=
github.com/casbin/casbin v1.7.0 h1:PuzlE8w0JBg/DhIqnkF1Dewf3z+qmUZMVN07PonvVUQ=
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
-github.com/casbin/casbin/v2 v2.2.1/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
-github.com/casbin/casbin/v2 v2.23.0/go.mod h1:wUgota0cQbTXE6Vd+KWpg41726jFRi7upxio0sR+Xd0=
github.com/casbin/casbin/v2 v2.37.4 h1:RWSKPjaZ8JlOBlcW1bI/FTII8OPxvQ9jVy9JwyNL6DQ=
github.com/casbin/casbin/v2 v2.37.4/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
-github.com/casbin/gorm-adapter/v3 v3.4.6 h1:JuLN3/CBTPPlvNyQqY3uXt4Zqnt+hs2sM353aCtLTP4=
-github.com/casbin/gorm-adapter/v3 v3.4.6/go.mod h1:6mIYgpByH/uSkfCv4G/vr/12cVZc3rXBQ9KrqS9oTUU=
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY=
-github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho=
github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
@@ -132,8 +112,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313/go.mod h1:P1wt9Z3DP8O6W3rvwCt0REIlshg1InHImaLW0t3ObY0=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
-github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
-github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0=
github.com/colynn/go-ldap-client/v3 v3.0.0-20201016034829-4c1455a490de h1:pivCxahVB+SGDWh/UuQb5aiFcC7oONr1Q8TRPwiTyoU=
@@ -145,7 +123,6 @@ github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kw
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
-github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -153,15 +130,10 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
-github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
-github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
-github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
@@ -173,8 +145,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE=
-github.com/denisenkom/go-mssqldb v0.11.0 h1:9rHa233rhdOyrz2GcP9NM+gi2psgJZ4GWDpL/7ND8HI=
-github.com/denisenkom/go-mssqldb v0.11.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
@@ -186,14 +156,11 @@ github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
github.com/docker/libnetwork v0.8.0-dev.2.0.20190624125649-f0e46a78ea34/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
-github.com/drone/go-scm v1.18.0 h1:VU6C6r2Hxf5FZUjTazCH2xlXBe21JDg7gBcJvsL7twk=
-github.com/drone/go-scm v1.18.0/go.mod h1:DFIJJjhMj0TSXPz+0ni4nyZ9gtTtC40Vh/TGRugtyWw=
-github.com/drone/go-scm v1.19.0 h1:JB/Rln0fBH1y2ENYj4Rr8T+CLfaFOa32KCb7brx/sHY=
-github.com/drone/go-scm v1.19.0/go.mod h1:DFIJJjhMj0TSXPz+0ni4nyZ9gtTtC40Vh/TGRugtyWw=
+github.com/drone/go-scm v1.20.0 h1:SGB8TnE/85rklK+Gb3ZRTHQRt2atSCFHgtDKNqPwBQU=
+github.com/drone/go-scm v1.20.0/go.mod h1:DFIJJjhMj0TSXPz+0ni4nyZ9gtTtC40Vh/TGRugtyWw=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
-github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e h1:p1yVGRW3nmb85p1Sh1ZJSDm4A4iKLS5QNbvUHMgGu/M=
@@ -215,7 +182,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
-github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
@@ -232,14 +198,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df h1:Bao6dhmbTA1KFVxmJ6nBoMuOJit2yjEgLJpIMYpop0E=
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df/go.mod h1:GJr+FCSXshIwgHBtLglIg9M2l2kQSi6QjVAngtzI08Y=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-ldap/ldap/v3 v3.2.1 h1:mbP3BPfsULz5DuI3ejHuAypAbcg38Xv5T7eEHp3+XAE=
github.com/go-ldap/ldap/v3 v3.2.1/go.mod h1:phWI+JSJ/eGvABjJxU7bT7CBv03KfS0e16+bQxLtjMw=
github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
-github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
-github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
@@ -287,9 +249,7 @@ github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2K
github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4=
github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU=
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
-github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
-github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@@ -308,18 +268,12 @@ github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslW
github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
-github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
-github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
-github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
-github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gojektech/valkyrie v0.0.0-20190210220504-8f62c1e7ba45 h1:MO2DsGCZz8phRhLnpFvHEQgTH521sVN/6F2GZTbNO3Q=
github.com/gojektech/valkyrie v0.0.0-20190210220504-8f62c1e7ba45/go.mod h1:tDYRk1s5Pms6XJjj5m2PxAzmQvaDU8GqDf1u6x7yxKw=
-github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
-github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -350,7 +304,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk=
@@ -383,8 +336,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
-github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
+github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
@@ -428,8 +381,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
-github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
-github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/heketi/heketi v9.0.1-0.20190917153846-c2e2a4ab7ab9+incompatible/go.mod h1:bB9ly3RchcQqsQ9CpyaQwvva7RS5ytVoSoholZQON6o=
@@ -443,60 +394,10 @@ github.com/isbrick/http-client v0.0.0-20210321135403-0a5df00fdb84 h1:f+X6/PyYYWQ
github.com/isbrick/http-client v0.0.0-20210321135403-0a5df00fdb84/go.mod h1:ILI7SGUToE8ebBaVw9+tdlWlj2naGFmnMU+FrQj+6ro=
github.com/isbrick/tools v0.0.0-20211027093338-a3a0ded37175 h1:HnZgYkC7M0z/0Ll+qXQS2jizZgWjSkC90j6HDmr/SuM=
github.com/isbrick/tools v0.0.0-20211027093338-a3a0ded37175/go.mod h1:3jxvSrtFqeDL15wHztv4lLjQqB1YiPU3jAewh3LwUW0=
-github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
-github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
-github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
-github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
-github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
-github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
-github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
-github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
-github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
-github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
-github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
-github.com/jackc/pgconn v1.10.0 h1:4EYhlDVEMsJ30nNj0mmgwIUXoq7e9sMJrVC2ED6QlCU=
-github.com/jackc/pgconn v1.10.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
-github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
-github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
-github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
-github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c=
-github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc=
-github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
-github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
-github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
-github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
-github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
-github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
-github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
-github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
-github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
-github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
-github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI=
-github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
-github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
-github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
-github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
-github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
-github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
-github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM=
-github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs=
-github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
-github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
-github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
-github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
-github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
-github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570=
-github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0=
-github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
-github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
-github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jarcoal/httpmock v1.1.0 h1:F47ChZj1Y2zFsCXxNkBPwNNKnAyOATcdQibk0qEdVCE=
+github.com/jarcoal/httpmock v1.1.0/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8=
-github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
-github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
-github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
-github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
-github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -504,8 +405,6 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
-github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
@@ -520,13 +419,11 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
-github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
@@ -555,14 +452,8 @@ github.com/kubernetes/legacy-cloud-providers v0.17.0/go.mod h1:DdzaepJ3RtRy+e5Yh
github.com/kubernetes/metrics v0.17.0/go.mod h1:EH1D3YAwN6d7bMelrElnLhLg72l/ERStyv2SIQVt6Do=
github.com/kubernetes/sample-apiserver v0.17.0/go.mod h1:SAkguNIe/gJik7VlkFu62oGlWltW3c0mAP9WQYUMEJo=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
-github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
+github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
-github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
@@ -583,19 +474,13 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
-github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
-github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
-github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
-github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
-github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
-github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mesos/mesos-go v0.0.9/go.mod h1:kPYCMQ9gsOXVAle1OsoY4I1+9kPu8GHkf88aV59fDr4=
@@ -610,7 +495,6 @@ github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzO
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -640,27 +524,21 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs=
-github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
-github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
-github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
-github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -672,16 +550,12 @@ github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prY
github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
-github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
-github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
-github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI=
github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
@@ -689,9 +563,6 @@ github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfm
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
-github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
-github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
-github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
@@ -699,24 +570,18 @@ github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WS
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
-github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
-github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
+github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
+github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
-github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
-github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
-github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
-github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
-github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
-github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
@@ -749,19 +614,16 @@ github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRci
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
-github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/thecodeteam/goscaleio v0.1.0/go.mod h1:68sdkZAsK8bvEwBlbQnlLS+xU+hvLYM/iQ8KXej1AwM=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
-github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
@@ -782,12 +644,8 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
-github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
-go.etcd.io/etcd v3.3.25+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
@@ -797,22 +655,12 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
-go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
-go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
-go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
-go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
-go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
-go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
-go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
-go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
-go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190927031335-2835ba2e683f/go.mod h1:fYw7AShPAhGMdXqA9gRadk/CcMsvLlClpE5oBwnS3dM=
golang.org/x/crypto v0.0.0-20180426230345-b49d69b5da94/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -820,8 +668,6 @@ golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -831,9 +677,6 @@ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
-golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -860,7 +703,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
-golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
@@ -896,7 +738,6 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -912,9 +753,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
+golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -932,7 +773,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -945,11 +785,9 @@ golang.org/x/sys v0.0.0-20190122071731-054c452bb702/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -962,14 +800,9 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -981,13 +814,12 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
+golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
+golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -997,9 +829,7 @@ golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fq
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
-golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
@@ -1029,7 +859,6 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
@@ -1039,13 +868,10 @@ golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190909030654-5b82db07426d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@@ -1053,7 +879,6 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117065230-39095c1d176c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
@@ -1073,9 +898,6 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
-golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
-golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -1168,8 +990,6 @@ gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gG
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
@@ -1179,11 +999,9 @@ gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
-gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U=
-gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
@@ -1193,8 +1011,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -1212,7 +1028,6 @@ honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
-honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM=
diff --git a/internal/api/app.go b/internal/api/app.go
index 19799d21..0b525817 100644
--- a/internal/api/app.go
+++ b/internal/api/app.go
@@ -28,6 +28,91 @@ type AppController struct {
BaseController
}
+// CreateSCMApp for project
+func (a *AppController) CreateSCMApp() {
+ req := &apps.ScmAppReq{}
+ a.DecodeJSONReq(&req)
+ mgr := apps.NewAppManager()
+ _, result := mgr.CreateSCMApp(req, a.User)
+ if result != nil {
+ a.HandleInternalServerError(result.Error())
+ log.Log.Error("add project app error: %s", result.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, result, "")
+ a.ServeJSON()
+}
+
+func (a *AppController) GetAllApps() {
+ mgr := apps.NewAppManager()
+ // TODO: add app tag filter base on permisson
+ result, err := mgr.GetScmApps()
+ if err != nil {
+ a.HandleInternalServerError(err.Error())
+ log.Log.Error("get scm apps error: %s", err.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, result, "")
+ a.ServeJSON()
+}
+
+// GetAppsByPagination ..
+func (a *AppController) GetAppsByPagination() {
+ filterQuery := a.GetFilterQuery()
+ mgr := apps.NewAppManager()
+ result, err := mgr.GetScmAppsByPagination(filterQuery)
+ if err != nil {
+ a.HandleInternalServerError(err.Error())
+ log.Log.Error("get scm app list error: %s", err.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, result, "")
+ a.ServeJSON()
+}
+
+// ScmAppInfo ..
+func (a *AppController) ScmAppInfo() {
+ scmAppID, _ := a.GetInt64FromPath(":app_id")
+ mgr := apps.NewAppManager()
+ result, err := mgr.GetScmApp(scmAppID)
+ if err != nil {
+ a.HandleInternalServerError(err.Error())
+ log.Log.Error("get scm app error: %s", err.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, result, "")
+ a.ServeJSON()
+}
+
+// UpdateScmApp ..
+func (a *AppController) UpdateScmApp() {
+ scmAppID, _ := a.GetInt64FromPath(":app_id")
+ req := &apps.ScmAppUpdateReq{}
+ a.DecodeJSONReq(req)
+ am := apps.NewAppManager()
+ if err := am.UpdateProjectApp(scmAppID, req); err != nil {
+ a.HandleInternalServerError(err.Error())
+ log.Log.Error("update scm app error: %s", err.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, nil, "")
+ a.ServeJSON()
+}
+
+// DeleteScmApp ...
+func (a *AppController) DeleteScmApp() {
+ scmAppID, _ := a.GetInt64FromPath(":app_id")
+ am := apps.NewAppManager()
+ result := am.DeleteSCMApp(scmAppID)
+ if result != nil {
+ a.HandleInternalServerError(result.Error())
+ log.Log.Error("delete scm app error: %s", result.Error())
+ return
+ }
+ a.Data["json"] = NewResult(true, result, "")
+ a.ServeJSON()
+}
+
// GetArrange ...
func (a *AppController) GetArrange() {
appID, err := a.GetInt64FromPath(":app_id")
@@ -96,43 +181,11 @@ func (a *AppController) ParseArrangeYaml() {
a.ServeResult(NewResult(true, rsp, ""))
}
-/* -- repo server start -- */
-
-// GetRepos ..
-func (a *AppController) GetRepos() {
- projectID, err := a.GetInt64FromQuery("project_id")
- if err != nil {
- a.HandleInternalServerError(err.Error())
- log.Log.Error("parse project id error: %s", err.Error())
- return
- }
- if projectID == 0 {
- projectID = 1
- }
- log.Log.Debug("args projectID: %v", projectID)
- mgr := apps.NewAppManager()
- rsp, err := mgr.GetRepos(projectID)
- if err != nil {
- a.HandleInternalServerError(err.Error())
- log.Log.Error("get repos error: %s", err.Error())
- return
- }
- a.ServeResult(NewResult(true, rsp, ""))
-}
-
// GetGitProjectsByRepoID ..
func (a *AppController) GetGitProjectsByRepoID() {
- // TODO: change url query
- projectID, _ := a.GetInt64FromQuery("project_id")
- if projectID == 0 {
- projectID = 1
- }
- log.Log.Debug("args projectID: %v", projectID)
repoID, _ := a.GetInt64FromPath(":repo_id")
- request := apps.SetupRepo{}
- a.DecodeJSONReq(&request)
mgr := apps.NewAppManager()
- rsp, err := mgr.SetRepoAndGetProjects(projectID, repoID, &request)
+ rsp, err := mgr.GetScmProjectsByRepoID(repoID)
if err != nil {
a.HandleInternalServerError(err.Error())
log.Log.Error("get repo's projects error: %s", err.Error())
@@ -141,8 +194,6 @@ func (a *AppController) GetGitProjectsByRepoID() {
a.ServeResult(NewResult(true, rsp, ""))
}
-/* -- repo server end -- */
-
// GetAppBranches ..
func (a *AppController) GetAppBranches() {
AppID, err := a.GetInt64FromPath(":app_id")
diff --git a/internal/api/auth.go b/internal/api/auth.go
index 2abe2533..bf4931d7 100644
--- a/internal/api/auth.go
+++ b/internal/api/auth.go
@@ -93,7 +93,6 @@ func (a *AuthController) Authenticate() {
http.Error(a.Ctx.ResponseWriter, err.Error(), http.StatusInternalServerError)
return
}
-
e, err := mycasbin.NewCasbin()
if err != nil {
log.Log.Error("add user role, new casbin instance error: %s", err.Error())
diff --git a/internal/api/integrate.go b/internal/api/integrate.go
index 036c60be..fc6acbb9 100644
--- a/internal/api/integrate.go
+++ b/internal/api/integrate.go
@@ -17,6 +17,8 @@ limitations under the License.
package api
import (
+ "github.com/go-atomci/atomci/constant"
+
"github.com/go-atomci/atomci/internal/core/settings"
"github.com/go-atomci/atomci/internal/middleware/log"
)
@@ -28,7 +30,7 @@ type IntegrateController struct {
func (p *IntegrateController) GetClusterIntegrateSettings() {
pm := settings.NewSettingManager()
- rsp, err := pm.GetIntegrateSettings("kubernetes")
+ rsp, err := pm.GetIntegrateSettings([]string{constant.IntegrateKubernetes})
if err != nil {
p.HandleInternalServerError(err.Error())
log.Log.Error("Get integrate settings occur error: %s", err.Error())
@@ -41,7 +43,7 @@ func (p *IntegrateController) GetClusterIntegrateSettings() {
// GetIntegrateSettings ..
func (p *IntegrateController) GetIntegrateSettings() {
pm := settings.NewSettingManager()
- rsp, err := pm.GetIntegrateSettings("")
+ rsp, err := pm.GetIntegrateSettings(constant.Integratetypes)
if err != nil {
p.HandleInternalServerError(err.Error())
log.Log.Error("Get integrate settings occur error: %s", err.Error())
@@ -55,7 +57,37 @@ func (p *IntegrateController) GetIntegrateSettings() {
func (p *IntegrateController) GetIntegrateSettingsByPagination() {
filterQuery := p.GetFilterQuery()
pm := settings.NewSettingManager()
- rsp, err := pm.GetIntegrateSettingsByPagination(filterQuery)
+ rsp, err := pm.GetIntegrateSettingsByPagination(filterQuery, constant.Integratetypes)
+ if err != nil {
+ p.HandleInternalServerError(err.Error())
+ log.Log.Error("Get integrate settings occur error: %s", err.Error())
+ return
+ }
+ p.Data["json"] = NewResult(true, rsp, "")
+ p.ServeJSON()
+}
+
+func (p *IntegrateController) GetSCMIntegrateSettings() {
+ pm := settings.NewSettingManager()
+ rsp, err := pm.GetIntegrateSettings(constant.ScmIntegratetypes)
+ if err != nil {
+ p.HandleInternalServerError(err.Error())
+ log.Log.Error("Get integrate settings occur error: %s", err.Error())
+ return
+ }
+ // for security hidden config content
+ for _, item := range rsp {
+ item.IntegrateSettingReq.Config = nil
+ }
+ p.Data["json"] = NewResult(true, rsp, "")
+ p.ServeJSON()
+}
+
+// GetSCMIntegrateSettingsByPagination ..
+func (p *IntegrateController) GetSCMIntegrateSettingsByPagination() {
+ filterQuery := p.GetFilterQuery()
+ pm := settings.NewSettingManager()
+ rsp, err := pm.GetIntegrateSettingsByPagination(filterQuery, constant.ScmIntegratetypes)
if err != nil {
p.HandleInternalServerError(err.Error())
log.Log.Error("Get integrate settings occur error: %s", err.Error())
diff --git a/internal/api/project.go b/internal/api/project.go
index e53c3dfc..c77ead44 100644
--- a/internal/api/project.go
+++ b/internal/api/project.go
@@ -287,7 +287,6 @@ func (p *ProjectController) Delete() {
if groupAdminFlag == 1 {
flag = true
}
- // flag, err := pm.CheckProjectUser(projectID, user, groupsAdminList)
if !flag {
log.Log.Error("when check project user flag is %v", flag)
p.HandleInternalServerError("仅允许项目owner及管理员更新基础信息")
@@ -539,11 +538,7 @@ func (p *ProjectController) CreateApp() {
req := &project.ProjectAppReq{}
p.DecodeJSONReq(&req)
pm := project.NewProjectManager()
- groupName := p.UserGroup()
- if groupName == "" {
- groupName = "system"
- }
- result := pm.CreateProjectApp(projectID, req, p.User, groupName)
+ result := pm.CreateProjectApp(projectID, req, p.User)
if result != nil {
p.HandleInternalServerError(result.Error())
log.Log.Error("add project app error: %s", result.Error())
@@ -567,20 +562,6 @@ func (p *ProjectController) GetApps() {
p.ServeJSON()
}
-// ProjectAppInfo ..
-func (p *ProjectController) ProjectAppInfo() {
- projectAppID, _ := p.GetInt64FromPath(":project_app_id")
- pm := project.NewProjectManager()
- result, err := pm.GetProjectApp(projectAppID)
- if err != nil {
- p.HandleInternalServerError(err.Error())
- log.Log.Error("get project app error: %s", err.Error())
- return
- }
- p.Data["json"] = NewResult(true, result, "")
- p.ServeJSON()
-}
-
// GetAppsByPagination ..
func (p *ProjectController) GetAppsByPagination() {
projectID, _ := p.GetInt64FromPath(":project_id")
@@ -600,12 +581,8 @@ func (p *ProjectController) GetAppsByPagination() {
// DeleteProjectApp for project
func (p *ProjectController) DeleteProjectApp() {
projectAppID, _ := p.GetInt64FromPath(":project_app_id")
- defaultGroupName := p.UserGroup()
- if defaultGroupName == "" {
- defaultGroupName = "system"
- }
pm := project.NewProjectManager()
- result := pm.DeleteProjectApp(projectAppID, defaultGroupName)
+ result := pm.DeleteProjectApp(projectAppID)
if result != nil {
p.HandleInternalServerError(result.Error())
log.Log.Error("delete project app error: %s", result.Error())
@@ -630,19 +607,3 @@ func (p *ProjectController) UpdateProjectApp() {
p.Data["json"] = NewResult(true, nil, "")
p.ServeJSON()
}
-
-// SwitchProjectBranch ..
-func (p *ProjectController) SwitchProjectBranch() {
- projectID, _ := p.GetInt64FromPath(":project_id")
- projectAppID, _ := p.GetInt64FromPath(":project_app_id")
- req := &project.ProjectAppBranchUpdateReq{}
- p.DecodeJSONReq(req)
- pm := project.NewProjectManager()
- if err := pm.SwitchAppBranch(projectID, projectAppID, req); err != nil {
- p.HandleInternalServerError(err.Error())
- log.Log.Error("switch project app branch error: %s", err.Error())
- return
- }
- p.Data["json"] = NewResult(true, nil, "")
- p.ServeJSON()
-}
diff --git a/internal/api/terminal.go b/internal/api/terminal.go
index a7600bc3..2bb0e875 100644
--- a/internal/api/terminal.go
+++ b/internal/api/terminal.go
@@ -18,14 +18,9 @@ package api
import (
"fmt"
- "path"
-
"github.com/go-atomci/atomci/internal/core/podexec"
"github.com/go-atomci/atomci/internal/middleware/log"
"github.com/go-atomci/atomci/pkg/kube"
-
- "github.com/astaxie/beego"
- "k8s.io/client-go/tools/clientcmd"
)
type TerminalController struct {
@@ -57,7 +52,7 @@ func (t *TerminalController) PodTerminal() {
_ = pty.Close()
}()
- kubeCli, err := kube.GetClientset(cluster)
+ kubeCli, cfg, err := kube.GetClientset(cluster)
if err != nil {
msg := fmt.Sprintf("get kubecli err :%v", err)
log.Log.Error(msg)
@@ -79,14 +74,6 @@ func (t *TerminalController) PodTerminal() {
return
}
- configFile := path.Join(beego.AppConfig.String("k8s::configPath"), cluster)
- cfg, err := clientcmd.BuildConfigFromFlags("", configFile)
- if err != nil {
- msg := fmt.Sprintf("build config occur error: %s", err.Error())
- log.Log.Error(msg)
- t.HandleInternalServerError(msg)
- return
- }
err = podexec.ExecPod(kubeCli, cfg, []string{"/bin/sh"}, pty, namespace, podName, containerName)
if err != nil {
msg := fmt.Sprintf("Exec to pod error! err: %v", err)
diff --git a/internal/api/user.go b/internal/api/user.go
index 995efb31..2cabe6ee 100644
--- a/internal/api/user.go
+++ b/internal/api/user.go
@@ -180,6 +180,19 @@ func (u *UserController) GetUserResourceConstraintValues() {
u.ServeJSON()
}
+// GetProjectMemberByConstraint ..
+func (u *UserController) GetProjectMemberByConstraint() {
+ projectId, _ := u.GetInt64FromPath(":project_id")
+ rsp, err := dao.GetProjectMemberByConstraint(projectId)
+ if err != nil {
+ u.HandleInternalServerError(err.Error())
+ log.Log.Error("Get project member error: %s", err.Error())
+ return
+ }
+ u.Data["json"] = NewResult(true, rsp, "")
+ u.ServeJSON()
+}
+
func generatePassword(password string) ([]byte, error) {
return bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
}
diff --git a/internal/core/apps/gitapp.go b/internal/core/apps/gitapp.go
index c7a4bed4..b01e9c54 100644
--- a/internal/core/apps/gitapp.go
+++ b/internal/core/apps/gitapp.go
@@ -19,12 +19,15 @@ package apps
import (
"context"
"fmt"
- "github.com/drone/go-scm/scm/driver/gitea"
+ "github.com/drone/go-scm/scm/driver/gogs"
"net/http"
"strings"
+ "github.com/drone/go-scm/scm/driver/gitea"
+
"github.com/go-atomci/atomci/internal/middleware/log"
"github.com/go-atomci/atomci/internal/models"
+ "github.com/go-atomci/atomci/utils/query"
"github.com/go-atomci/atomci/utils"
@@ -40,7 +43,7 @@ func NewScmProvider(vcsType, vcsPath, token string) (*scm.Client, error) {
var err error
var client *scm.Client
switch strings.ToLower(vcsType) {
- case "gitea", "gitlab":
+ case "gitea", "gitlab", "gogs":
if strings.HasSuffix(vcsPath, ".git") {
vcsPath = strings.TrimSuffix(vcsPath, ".git")
}
@@ -61,9 +64,16 @@ func NewScmProvider(vcsType, vcsPath, token string) (*scm.Client, error) {
Token: token,
},
}
- } else {
+ } else if "gitlab" == gitRepo {
client, err = gitlab.New(schema + "://" + projectPathSplit[0])
+ client.Client = &http.Client{
+ Transport: &transport.PrivateToken{
+ Token: token,
+ },
+ }
+ } else {
+ client, err = gogs.New(schema + "://" + projectPathSplit[0])
client.Client = &http.Client{
Transport: &transport.PrivateToken{
Token: token,
@@ -96,19 +106,22 @@ func NewScmProvider(vcsType, vcsPath, token string) (*scm.Client, error) {
// SyncAppBranches ...
func (manager *AppManager) SyncAppBranches(appID int64) error {
- projectApp, _ := manager.projectModel.GetProjectApp(appID)
- repoModel, err := manager.gitAppModel.GetRepoByID(projectApp.RepoID)
+ scmApp, _ := manager.scmAppModel.GetScmAppByID(appID)
+ scmIntegrateResp, err := manager.settingsHandler.GetSCMIntegrateSettinByID(scmApp.RepoID)
+ if err != nil {
+ return err
+ }
if err != nil {
- log.Log.Error("GetRepoByID occur error: %v", err.Error())
+ log.Log.Error("getCompileEnvByID occur error: %v", err.Error())
return fmt.Errorf("网络错误,请重试")
}
- client, err := NewScmProvider(repoModel.Type, projectApp.Path, repoModel.Token)
+ client, err := NewScmProvider(scmIntegrateResp.Type, scmApp.Path, scmIntegrateResp.Token)
branchList := []*scm.Reference{}
listOptions := scm.ListOptions{
Page: 1,
Size: 100,
}
- got, res, err := client.Git.ListBranches(context.Background(), projectApp.FullName, listOptions)
+ got, res, err := client.Git.ListBranches(context.Background(), scmApp.FullName, listOptions)
if err != nil {
return fmt.Errorf("when get branches list from gitlab occur error: %s", err.Error())
}
@@ -116,7 +129,7 @@ func (manager *AppManager) SyncAppBranches(appID int64) error {
for i := 1; i < res.Page.Last; {
listOptions.Page++
- got, _, err := client.Git.ListBranches(context.Background(), projectApp.FullName, listOptions)
+ got, _, err := client.Git.ListBranches(context.Background(), scmApp.FullName, listOptions)
if err != nil {
return fmt.Errorf("when get branches list from gitlab occur error: %s", err.Error())
}
@@ -127,7 +140,7 @@ func (manager *AppManager) SyncAppBranches(appID int64) error {
if strings.HasPrefix(branch.Name, "release_") {
continue
}
- originBranch, err := manager.gitAppModel.GetAppBranchByName(appID, branch.Name)
+ originBranch, err := manager.scmAppModel.GetAppBranchByName(appID, branch.Name)
if err != nil {
if strings.Contains(err.Error(), "no row found") {
err = nil
@@ -138,21 +151,21 @@ func (manager *AppManager) SyncAppBranches(appID int64) error {
if originBranch.BranchName == "" {
appBranch := &models.AppBranch{
BranchName: branch.Name,
- Path: projectApp.Path,
+ Path: scmApp.Path,
AppID: appID,
}
- if _, err := manager.gitAppModel.CreateAppBranchIfNotExist(appBranch); err != nil {
+ if _, err := manager.scmAppModel.CreateAppBranchIfNotExist(appBranch); err != nil {
return err
}
} else {
- originBranch.Path = projectApp.Path
- if err := manager.gitAppModel.UpdateAppBranch(originBranch); err != nil {
+ originBranch.Path = scmApp.Path
+ if err := manager.scmAppModel.UpdateAppBranch(originBranch); err != nil {
return err
}
}
}
- branchListInDB, err := manager.gitAppModel.GetAppBranches(appID)
+ branchListInDB, err := manager.scmAppModel.GetAppBranches(appID)
if err != nil {
return err
}
@@ -162,8 +175,132 @@ func (manager *AppManager) SyncAppBranches(appID int64) error {
}
for _, branchDBItem := range branchListInDB {
if !utils.Contains(branchNameList, branchDBItem.BranchName) {
- manager.gitAppModel.SoftDeleteAppBranch(branchDBItem)
+ manager.scmAppModel.SoftDeleteAppBranch(branchDBItem)
}
}
return nil
}
+
+// CreateSCMApp ...
+func (manager *AppManager) CreateSCMApp(item *ScmAppReq, creator string) (int64, error) {
+ log.Log.Debug("request params: %+v", item)
+
+ if item.BranchName == "" {
+ // reset default value is master
+ item.BranchName = "master"
+ }
+
+ if item.Dockerfile == "" {
+ item.Dockerfile = "Dockerfile"
+ }
+ scmAppModel := models.ScmApp{
+ Addons: models.NewAddons(),
+ Creator: creator,
+ CompileEnvID: item.CompileEnvID,
+ Name: item.Name,
+ FullName: item.FullName,
+ Language: item.Language,
+ BranchName: item.BranchName,
+ Path: item.Path,
+ RepoID: item.RepoID,
+ BuildPath: item.BuildPath,
+ Dockerfile: item.Dockerfile,
+ }
+
+ id, err := manager.scmAppModel.CreateScmAppIfNotExist(&scmAppModel)
+ if err != nil {
+ log.Log.Error("create scm app error: %s", err)
+ return 0, err
+ }
+
+ return id, nil
+}
+
+// GetProjectAppsByPagination ..
+func (manager *AppManager) GetScmApps() ([]*models.ScmApp, error) {
+ return manager.scmAppModel.GetScmApps()
+}
+
+// GetProjectAppsByPagination ..
+func (manager *AppManager) GetScmAppsByPagination(filter *query.FilterQuery) (*query.QueryResult, error) {
+ return manager.scmAppModel.GetScmAppsByPagination(filter)
+}
+
+func (manager *AppManager) GetScmApp(appID int64) (*SCMAppRsp, error) {
+ app, err := manager.scmAppModel.GetScmAppByID(appID)
+ if err != nil {
+ return nil, err
+ }
+ return manager.formatscmAppResp(app)
+}
+
+// UpdateProjectApp ..
+func (manager *AppManager) UpdateProjectApp(scmAppID int64, req *ScmAppUpdateReq) error {
+ log.Log.Debug("update app projectAppID: %v, params: %+v", scmAppID, req)
+ if req.Name == "" {
+ return fmt.Errorf("请输入有效的『仓库名』")
+ }
+
+ if req.Path == "" {
+ return fmt.Errorf("请输入有效的『路径』")
+ }
+ scmApp, err := manager.scmAppModel.GetScmAppByID(scmAppID)
+ if err != nil {
+ return err
+ }
+
+ if req.BuildPath == "" {
+ scmApp.BuildPath = "/"
+ } else {
+ scmApp.BuildPath = req.BuildPath
+ }
+
+ if req.Dockerfile == "" {
+ scmApp.Dockerfile = "Dockerfile"
+ } else {
+ scmApp.Dockerfile = req.Dockerfile
+ }
+
+ scmApp.BranchName = req.BranchName
+ scmApp.CompileEnvID = req.CompileEnvID
+ scmApp.Language = req.Language
+ scmApp.Name = req.Name
+ scmApp.Path = req.Path
+ return manager.scmAppModel.UpdateSCMApp(scmApp)
+}
+
+func (manager *AppManager) DeleteSCMApp(scmAppID int64) error {
+ log.Log.Debug("delete project app, scmAppID: %v", scmAppID)
+
+ _, err := manager.scmAppModel.GetScmAppByID(scmAppID)
+ if err != nil {
+ log.Log.Error("when delete scm app, get scm app occur error: %s", err.Error())
+ return fmt.Errorf("当前代码库可能已经删除,请你刷新页面后重试")
+ }
+
+ // TODO: add publish order verify
+ err = manager.scmAppModel.DeleteSCMApp(scmAppID)
+ if err != nil {
+ return err
+ }
+ // TODO: delete app service constraint
+ return nil
+}
+
+func (manager *AppManager) formatscmAppResp(modelApp *models.ScmApp) (*SCMAppRsp, error) {
+ compileEnvName := ""
+ if modelApp.CompileEnvID != 0 {
+ compileEnv, err := manager.settingsHandler.GetCompileEnvByID(modelApp.CompileEnvID)
+ if err != nil {
+ log.Log.Error("get compile env by id: %v error: %s", modelApp.CompileEnvID, err.Error())
+ } else {
+ compileEnvName = compileEnv.Name
+ }
+ }
+
+ return &SCMAppRsp{
+ ScmApp: modelApp,
+ CompileEnv: compileEnvName,
+ }, nil
+
+}
diff --git a/internal/core/apps/repo.go b/internal/core/apps/repo.go
index ccf4f6d5..d352a015 100644
--- a/internal/core/apps/repo.go
+++ b/internal/core/apps/repo.go
@@ -19,99 +19,45 @@ package apps
import (
"context"
"fmt"
+
+ "github.com/go-atomci/atomci/internal/core/settings"
"github.com/go-atomci/atomci/internal/dao"
"github.com/go-atomci/atomci/internal/middleware/log"
- "github.com/go-atomci/atomci/internal/models"
"github.com/go-atomci/atomci/utils/query"
- "github.com/astaxie/beego/orm"
"github.com/drone/go-scm/scm"
)
// AppManager ...
type AppManager struct {
- model *dao.AppArrangeModel
- gitAppModel *dao.GitAppModel
- projectModel *dao.ProjectModel
+ model *dao.AppArrangeModel
+ scmAppModel *dao.ScmAppModel
+ projectModel *dao.ProjectModel
+ settingsHandler *settings.SettingManager
}
// NewAppManager ...
func NewAppManager() *AppManager {
return &AppManager{
- model: dao.NewAppArrangeModel(),
- gitAppModel: dao.NewGitAppModel(),
- projectModel: dao.NewProjectModel(),
+ model: dao.NewAppArrangeModel(),
+ scmAppModel: dao.NewScmAppModel(),
+ projectModel: dao.NewProjectModel(),
+ settingsHandler: settings.NewSettingManager(),
}
}
// AppBranches ...
func (manager *AppManager) AppBranches(appID int64, filter *query.FilterQuery) (*query.QueryResult, error) {
- return manager.gitAppModel.GetAppBranchesByPagination(appID, filter)
-}
-
-// GetRepos ..
-func (manager *AppManager) GetRepos(projectID int64) ([]*RepoServerRsp, error) {
- repos := []*models.RepoServer{}
- // TODO: support code repository defined,
- defaultRepos := []string{"gitlab", "github", "gitee", "gitea"}
- // defaultRepos := []string{"gitlab"}
- for _, item := range defaultRepos {
- _, err := manager.gitAppModel.GetRepoBycIDAndType(projectID, item)
- if err != nil {
- if err == orm.ErrNoRows {
- if err := manager.gitAppModel.CreateDefaultRepo(projectID, item); err != nil {
- log.Log.Error("create default repos failed: %v", err.Error())
- return nil, fmt.Errorf("网络异常,请重试")
- }
- _, err = manager.gitAppModel.GetRepoBycIDAndType(projectID, item)
- if err != nil {
- log.Log.Error("after create, get repos occur error: %v", err.Error())
- return nil, fmt.Errorf("网络异常,请重试")
- }
- } else {
- return nil, err
- }
- }
- }
- repos, err := manager.gitAppModel.GetReposByprojectID(projectID)
- if err != nil {
- return nil, fmt.Errorf("网络异常,请重试")
- }
- rsp := []*RepoServerRsp{}
- for _, repoItem := range repos {
- itemRsp := &RepoServerRsp{
- SetupRepo: SetupRepo{
- User: repoItem.User,
- BaseURL: repoItem.BaseURL,
- },
- Type: repoItem.Type,
- RepoID: repoItem.ID,
- }
- rsp = append(rsp, itemRsp)
- }
- return rsp, nil
+ return manager.scmAppModel.GetAppBranchesByPagination(appID, filter)
}
-// SetRepoAndGetProjects ..
-func (manager *AppManager) SetRepoAndGetProjects(cID, repoID int64, request *SetupRepo) (interface{}, error) {
- repoModel, err := manager.gitAppModel.GetRepoByID(repoID)
+// GetScmProjectsByRepoID ..
+func (manager *AppManager) GetScmProjectsByRepoID(repoID int64) (interface{}, error) {
+ scmIntegrateResp, err := manager.settingsHandler.GetSCMIntegrateSettinByID(repoID)
if err != nil {
return nil, err
}
- if len(request.Token) > 0 {
- repoModel.Token = request.Token
- repoModel.User = request.User
- repoModel.BaseURL = request.BaseURL
- if err := manager.gitAppModel.UpdateRepo(repoModel); err != nil {
- log.Log.Error("when setRepoGetprojects, update repomodel failed: %v", err.Error())
- }
- } else {
- if len(repoModel.Token) == 0 && len(repoModel.BaseURL) == 0 {
- return nil, fmt.Errorf("首次同步,麻烦输入相关验证信息")
- }
- }
-
- scmClient, err := NewScmProvider(repoModel.Type, repoModel.BaseURL, repoModel.Token)
+ scmClient, err := NewScmProvider(scmIntegrateResp.Type, scmIntegrateResp.ScmAuthConf.URL, scmIntegrateResp.ScmAuthConf.Token)
if err != nil {
log.Log.Error("init scm Client occur error: %v", err.Error())
return nil, fmt.Errorf("网络错误,请重试")
diff --git a/internal/core/apps/types.go b/internal/core/apps/types.go
index 1a6d7c02..d8b02c31 100644
--- a/internal/core/apps/types.go
+++ b/internal/core/apps/types.go
@@ -16,18 +16,36 @@ limitations under the License.
package apps
-// SetupRepo ..
-type SetupRepo struct {
- BaseURL string `json:"base_url"`
- User string `json:"user"`
- Token string `json:"token"`
+import "github.com/go-atomci/atomci/internal/models"
+
+type ScmAppReq struct {
+ // ProjectAppReq add app into project request body.
+ Name string `json:"name"`
+ CompileEnvID int64 `json:"compile_env_id"`
+ Language string `json:"language"`
+ Path string `json:"path"`
+ RepoID int64 `json:"repo_id"`
+ FullName string `json:"full_name"`
+ BranchName string `json:"branch_name"`
+ BuildPath string `json:"build_path"`
+ Dockerfile string `json:"dockerfile"`
+}
+
+type ScmAppUpdateReq struct {
+ BranchName string `json:"branch_name"`
+ Language string `json:"language"`
+ Name string `json:"name"`
+ Path string `json:"path"`
+ CompileEnvID int64 `json:"compile_env_id"`
+ BuildPath string `json:"build_path"`
+ Dockerfile string `json:"dockerfile"`
}
-// RepoServerRsp ..
-type RepoServerRsp struct {
- RepoID int64 `json:"repo_id"`
- Type string `json:"type"`
- SetupRepo
+// SCMAppRsp ..
+type SCMAppRsp struct {
+ *models.ScmApp
+ BranchHistoryList []string `json:"branch_history_list,omitempty"`
+ CompileEnv string `json:"compile_env"`
}
// RepoProjectRsp ..
diff --git a/internal/core/auth/local/local.go b/internal/core/auth/local/local.go
index 983da797..00467083 100644
--- a/internal/core/auth/local/local.go
+++ b/internal/core/auth/local/local.go
@@ -39,7 +39,7 @@ func NewProvider() auth.Provider {
func (p *Provider) Authenticate(loginUser, password string) (*auth.ExternalAccount, error) {
userModel, err := dao.GetUser(loginUser)
if err != nil {
- log.Log.Error("get user error: %v")
+ log.Log.Error("get user error: %v", err.Error())
return nil, fmt.Errorf("用户不存在或密码错误")
}
diff --git a/internal/core/kuberes/application.go b/internal/core/kuberes/application.go
index f731a910..eefa5b9e 100644
--- a/internal/core/kuberes/application.go
+++ b/internal/core/kuberes/application.go
@@ -144,7 +144,7 @@ func NewAppRes(cluster string, envID, projectID int64) (*AppRes, error) {
ProjectID: projectID,
}, nil
}
- client, err := kube.GetClientset(cluster)
+ client, _, err := kube.GetClientset(cluster)
if err != nil {
if cluster != "" {
return nil, errors.NewInternalServerError().SetCause(err)
@@ -486,7 +486,7 @@ func (ar *AppRes) SetLabels(namespace, name string, labels map[string]string) er
}
func CreateK8sNamespace(cluster, namespace string) error {
- client, err := kube.GetClientset(cluster)
+ client, _, err := kube.GetClientset(cluster)
if err != nil {
return err
}
@@ -505,7 +505,7 @@ func CreateK8sNamespace(cluster, namespace string) error {
}
func CreateRegistrySecret(cluster, namespace string, envID int64) error {
- client, err := kube.GetClientset(cluster)
+ client, _, err := kube.GetClientset(cluster)
if err != nil {
log.Log.Warning(fmt.Sprintf("create registry secret failed: %v", err.Error()))
return err
diff --git a/internal/core/notification/app.unittest.conf b/internal/core/notification/app.unittest.conf
new file mode 100644
index 00000000..f28626bf
--- /dev/null
+++ b/internal/core/notification/app.unittest.conf
@@ -0,0 +1,10 @@
+# notification config
+[notification]
+dingEnable = 1
+ding = "https://dingtalk.unittest.com"
+
+mailEnable = 1
+smtpHost = "smtp.host"
+smtpPort = 465
+smtpAccount = "fake@mail.com"
+smtpPassword = "pwd"
\ No newline at end of file
diff --git a/internal/core/notification/notification_test.go b/internal/core/notification/notification_test.go
new file mode 100644
index 00000000..ceb3f2d3
--- /dev/null
+++ b/internal/core/notification/notification_test.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+ "github.com/astaxie/beego"
+ notification "github.com/go-atomci/atomci/internal/core/notification/impl"
+ messages "github.com/go-atomci/atomci/internal/core/notification/types"
+ "github.com/jarcoal/httpmock"
+ "github.com/stretchr/testify/assert"
+ "net/http"
+ "testing"
+)
+
+func init() {
+ beego.LoadAppConfig("ini", "./app.unittest.conf")
+}
+
+func Test_SEND_SHOULD_NO_ERROR(t *testing.T) {
+ httpmock.Activate()
+ defer httpmock.DeactivateAndReset()
+
+ httpmock.RegisterResponder("POST", "https://dingtalk.unittest.com",
+ func(req *http.Request) (*http.Response, error) {
+ resp, err := httpmock.NewJsonResponse(200, "")
+ if err != nil {
+ return httpmock.NewStringResponse(500, ""), nil
+ }
+ return resp, nil
+ },
+ )
+ var temp notification.INotify
+
+ mockResult := new(messages.StepCallbackResult)
+
+ temp = new(notification.Email)
+
+ assert.NoError(t, temp.Send(*mockResult))
+
+ temp = new(notification.DingRobot)
+ assert.NoError(t, temp.Send(*mockResult))
+
+ hit := httpmock.GetTotalCallCount()
+ assert.Equal(t, 1, hit)
+}
diff --git a/internal/core/notification/notify_test.go b/internal/core/notification/notify_test.go
deleted file mode 100644
index fe645031..00000000
--- a/internal/core/notification/notify_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package notification
-
-import (
- notification "github.com/go-atomci/atomci/internal/core/notification/impl"
- messages "github.com/go-atomci/atomci/internal/core/notification/types"
- "testing"
-)
-
-func TestNotifyEmail(t *testing.T) {
- notification.EmailHandler().Send(messages.StepCallbackResult{
- StageName: "",
- PublishName: "",
- StepName: "",
- Status: 1,
- })
-}
-
-func TestNotifyDingRobot(t *testing.T) {
- notification.DingRobotHandler().Send(messages.StepCallbackResult{
- StageName: "aa",
- PublishName: "bb",
- StepName: "cc",
- Status: 0,
- })
-}
diff --git a/internal/core/pipelinemgr/pipelinemgr.go b/internal/core/pipelinemgr/pipelinemgr.go
index 3a2bd77a..c9d7783a 100644
--- a/internal/core/pipelinemgr/pipelinemgr.go
+++ b/internal/core/pipelinemgr/pipelinemgr.go
@@ -36,7 +36,8 @@ type PipelineManager struct {
modelPublishJob *dao.PublishJobModel
modelK8s *dao.K8sClusterModel
appHandler *appmgr.AppManager
- modelApp *dao.GitAppModel
+ // TODO: modelApp, modelAppArrnage change to appHandler
+ modelApp *dao.ScmAppModel
modelAppArrange *dao.AppArrangeModel
settingsHandler *settings.SettingManager
}
@@ -50,7 +51,7 @@ func NewPipelineManager() *PipelineManager {
modelArrange: dao.NewAppArrangeModel(),
modelPublishJob: dao.NewPublishJobModel(),
modelK8s: dao.NewK8sClusterModel(),
- modelApp: dao.NewGitAppModel(),
+ modelApp: dao.NewScmAppModel(),
modelAppArrange: dao.NewAppArrangeModel(),
appHandler: appmgr.NewAppManager(),
settingsHandler: settings.NewSettingManager(),
diff --git a/internal/core/pipelinemgr/types.go b/internal/core/pipelinemgr/types.go
index 6d2757d5..b5f3e6bb 100644
--- a/internal/core/pipelinemgr/types.go
+++ b/internal/core/pipelinemgr/types.go
@@ -290,17 +290,19 @@ type MergeBranchStepResp struct {
// RunBuildAllParms there are all apps parms for jenkins pipeline job
type RunBuildAllParms struct {
- *models.ProjectApp
*RunBuildAppReq
+ *models.ScmApp
Release string `json:"release"`
MergeBranch bool `json:"merge-branch"`
+ ProjectID int64
}
// RunDeployAllParms there are all apps parms for jenkins pipeline job
type RunDeployAllParms struct {
- *models.ProjectApp
+ *models.ScmApp
*RunDeployAppReq
ImageAddr string `json:"image_addr"`
+ ProjectID int64
}
// AppParamsForCreatePublishJob ..
diff --git a/internal/core/pipelinemgr/uitls.go b/internal/core/pipelinemgr/uitls.go
index fbf96333..4aec6be2 100644
--- a/internal/core/pipelinemgr/uitls.go
+++ b/internal/core/pipelinemgr/uitls.go
@@ -115,21 +115,26 @@ func (pm *PipelineManager) generateCompileEnvParams(apps []*RunBuildAppReq) []co
logs.Warn("project app error: %s", err.Error())
continue
}
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ logs.Warn("get scm app error: %s", err.Error())
+ continue
+ }
- if projectApp.CompileEnvID == 0 {
- log.Log.Debug("app: %v didnot setup complie env, use default docker runtime", projectApp.Name)
+ if scmApp.CompileEnvID == 0 {
+ log.Log.Debug("app: %v didnot setup complie env, use default docker runtime", scmApp.Name)
continue
}
- compileItem, err := pm.settingsHandler.GetCompileEnvByID(projectApp.CompileEnvID)
+ compileItem, err := pm.settingsHandler.GetCompileEnvByID(scmApp.CompileEnvID)
if err != nil {
- logs.Warn("get compile env by id:%v error: %s", projectApp.CompileEnvID, err.Error())
+ logs.Warn("get compile env by id:%v error: %s", scmApp.CompileEnvID, err.Error())
}
compileEnvItem := compileEnv{
Image: compileItem.Image,
Args: compileItem.Args,
Command: compileItem.Command,
WorkingDir: "/home/jenkins/agent",
- Name: strings.ToLower(projectApp.Name),
+ Name: strings.ToLower(scmApp.Name),
}
compileParams = append(compileParams, compileEnvItem)
}
@@ -344,18 +349,24 @@ func (pm *PipelineManager) CreateBuildJob(creator string, projectID, publishID i
log.Log.Error("when crate build job, get project app error: %s", err.Error())
return 0, "", err
}
- repoModel, err := pm.modelApp.GetGitRepoByID(projectApp.RepoID)
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
if err != nil {
- log.Log.Error("get GetGitRepoByID occur error: %v", err.Error())
- return 0, "", fmt.Errorf("网络错误,请重试")
+ log.Log.Error("when crate build job, get scm app error: %s", err.Error())
+ return 0, "", err
+ }
+
+ scmIntegrateResp, err := pm.settingsHandler.GetSCMIntegrateSettinByID(scmApp.RepoID)
+ if err != nil {
+ log.Log.Error("when crate build job, get scm integrate setting error: %s", err.Error())
+ return 0, "", err
}
- baseURL := strings.Replace(repoModel.BaseURL, "http://", "", -1)
+ baseURL := strings.Replace(scmIntegrateResp.URL, "http://", "", -1)
baseURL = strings.Replace(baseURL, "https://", "", -1)
if strings.HasSuffix(baseURL, "/") {
baseURL = strings.Replace(baseURL, "/", "", -1)
}
- repoConfStr := fmt.Sprintf("{\"%s\":[\"%s\",\"%s\"]}", baseURL, repoModel.User, repoModel.Token)
+ repoConfStr := fmt.Sprintf("{\"%s\":[\"%s\",\"%s\"]}", baseURL, scmIntegrateResp.User, scmIntegrateResp.Token)
adminToken, err := pm.getUserToken("admin")
if err != nil {
@@ -627,12 +638,17 @@ func (pm *PipelineManager) getAppCodeCommitByBranch(appID int64, branchName stri
return "", err
}
- repoModel, err := pm.modelApp.GetRepoByID(projectApp.RepoID)
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
if err != nil {
+ log.Log.Error("when get app code commit, get scm ap by id: %v error:%s", appID, err.Error())
return "", err
}
- client, err := apps.NewScmProvider(repoModel.Type, repoModel.BaseURL, repoModel.Token)
+ scmIntegrateResp, err := pm.settingsHandler.GetSCMIntegrateSettinByID(scmApp.RepoID)
+ if err != nil {
+ return "", err
+ }
+ client, err := apps.NewScmProvider(scmIntegrateResp.Type, scmIntegrateResp.URL, scmIntegrateResp.Token)
if err != nil {
return "", err
}
@@ -642,7 +658,7 @@ func (pm *PipelineManager) getAppCodeCommitByBranch(appID int64, branchName stri
Size: 10,
}
- got, _, err := client.Git.ListCommits(context.Background(), projectApp.FullName, opt)
+ got, _, err := client.Git.ListCommits(context.Background(), scmApp.FullName, opt)
if err != nil {
return "", err
}
@@ -663,6 +679,11 @@ func (pm *PipelineManager) getPublishStepPreBranchList(projectID, publishID, sta
publishStepResp := []*PublishStepResp{}
for _, app := range publishApps {
projectApp, _ := pm.modelProject.GetProjectApp(app.ProjectAppID)
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ log.Log.Error("get scm app by id %v error: %s", projectApp.ScmID, err.Error())
+ continue
+ }
branchHistoryList, _ := pm.modelApp.GetAppBranches(app.ProjectAppID)
branchItems := []string{}
for _, branch := range branchHistoryList {
@@ -673,10 +694,10 @@ func (pm *PipelineManager) getPublishStepPreBranchList(projectID, publishID, sta
}
appInfo := &PublishStepResp{
BranchName: app.BranchName,
- AppName: projectApp.Name,
- Language: projectApp.Language,
+ AppName: scmApp.Name,
+ Language: scmApp.Language,
ProjectAppID: app.ProjectAppID,
- BuildPath: projectApp.BuildPath,
+ BuildPath: scmApp.BuildPath,
Type: "app",
TargetBranch: targetBranch,
CompileCommand: app.CompileCommand,
@@ -754,9 +775,14 @@ func (pm *PipelineManager) getDeployStepAppImages(publishID int64) ([]*DeploySte
logs.Warn("project app id: %v not exist, err: %s", app.ProjectAppID, err.Error())
continue
}
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ logs.Warn("scm app id: %v not exist, err: %s", projectApp.ScmID, err.Error())
+ continue
+ }
item := &DeployStepAppRsp{
ProjectAppID: projectApp.ID,
- Name: projectApp.Name,
+ Name: scmApp.Name,
Type: "app",
}
rsp = append(rsp, item)
@@ -845,7 +871,12 @@ func (pm *PipelineManager) checkApparrange(projectID int64, apps []int64, stage
_, err := pm.appHandler.GetRealArrange(modelApp.ID, arrangeEnvID)
if err != nil {
log.Log.Error("get project app id: %v arrnage occur error: %s", modelApp.ID, err)
- nilArranged = append(nilArranged, modelApp.Name)
+ scmApp, err := pm.modelApp.GetScmAppByID(modelApp.ScmID)
+ if err != nil {
+ log.Log.Warn("get scm app error: %s", err.Error())
+ continue
+ }
+ nilArranged = append(nilArranged, scmApp.Name)
}
}
if len(nilArranged) > 0 {
@@ -874,10 +905,15 @@ func (pm *PipelineManager) aggregateAppsParamsForBuild(apps []*RunBuildAppReq, s
if err != nil {
log.Log.Error("get proejct modelapp occur error: %s", err)
}
-
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ logs.Warn("get scm app error: %s", err.Error())
+ continue
+ }
releaseBranch := "None"
allParm := &RunBuildAllParms{
- ProjectApp: projectApp,
+ ProjectID: projectApp.ProjectID,
+ ScmApp: scmApp,
RunBuildAppReq: app,
Release: releaseBranch,
}
@@ -896,6 +932,11 @@ func (pm *PipelineManager) aggregateAppsParamsForDeploy(publishID, stageID int64
log.Log.Error("get gitmodelapp occur error: %s", err)
}
+ scmApp, err := pm.modelApp.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ log.Log.Error("get scmapp error: %s", err.Error())
+ }
+
arrange, err := pm.appHandler.GetRealArrange(app.ProjectAppID, stageID)
if err != nil {
log.Log.Error("get app id: %v env id: %v real arrange, occur error: %s", app.ProjectAppID, stageID, err.Error())
@@ -941,7 +982,8 @@ func (pm *PipelineManager) aggregateAppsParamsForDeploy(publishID, stageID int64
log.Log.Debug("imageAddr: %s", newImageAddr)
allParm := &RunDeployAllParms{
- ProjectApp: projectApp,
+ ProjectID: projectApp.ProjectID,
+ ScmApp: scmApp,
RunDeployAppReq: app,
ImageAddr: newImageAddr,
}
diff --git a/internal/core/pipelinemgr/utils_test.go b/internal/core/pipelinemgr/utils_test.go
index 3dcd07d8..f0f69500 100644
--- a/internal/core/pipelinemgr/utils_test.go
+++ b/internal/core/pipelinemgr/utils_test.go
@@ -26,4 +26,4 @@ func TestGetStatus(t *testing.T) {
t.Run("jenkins", func(t *testing.T) {
assert.Nil(t, nil)
})
-}
+}
\ No newline at end of file
diff --git a/internal/core/project/app.go b/internal/core/project/app.go
index 5a5dc4d7..809538a4 100644
--- a/internal/core/project/app.go
+++ b/internal/core/project/app.go
@@ -25,30 +25,14 @@ import (
)
// CreateProjectApp ...
-func (pm *ProjectManager) CreateProjectApp(projectID int64, item *ProjectAppReq, creator, cName string) error {
+func (pm *ProjectManager) CreateProjectApp(projectID int64, item *ProjectAppReq, creator string) error {
log.Log.Debug("request params: %+v", item)
- if item.BranchName == "" {
- // reset default value is master
- item.BranchName = "master"
- }
-
- if item.Dockerfile == "" {
- item.Dockerfile = "Dockerfile"
- }
projectAppModel := models.ProjectApp{
- Addons: models.NewAddons(),
- Creator: creator,
- ProjectID: projectID,
- CompileEnvID: item.CompileEnvID,
- Name: item.Name,
- FullName: item.FullName,
- Language: item.Language,
- BranchName: item.BranchName,
- Path: item.Path,
- RepoID: item.RepoID,
- BuildPath: item.BuildPath,
- Dockerfile: item.Dockerfile,
+ Addons: models.NewAddons(),
+ Creator: creator,
+ ProjectID: projectID,
+ ScmID: item.SCMID,
}
_, err := pm.model.CreateProjectAppIfNotExist(&projectAppModel)
@@ -69,15 +53,6 @@ func (pm *ProjectManager) GetProjectApps(projectID int64) ([]*ProjectAppRsp, err
return pm.formatProjectAppsResp(modelProjectApps)
}
-// GetProjectApp ..
-func (pm *ProjectManager) GetProjectApp(projectAppID int64) (*ProjectAppRsp, error) {
- app, err := pm.model.GetProjectApp(projectAppID)
- if err != nil {
- return nil, err
- }
- return pm.formatProjectAppResp(app)
-}
-
// GetProjectAppsByPagination ..
func (pm *ProjectManager) GetProjectAppsByPagination(projectID int64, filter *models.ProejctAppFilterQuery) (*query.QueryResult, error) {
apps, modelDatas, err := pm.model.GetProjectAppsList(projectID, filter)
@@ -95,7 +70,7 @@ func (pm *ProjectManager) GetProjectAppsByPagination(projectID int64, filter *mo
}
// DeleteProjectApp ...
-func (pm *ProjectManager) DeleteProjectApp(projectAppID int64, cName string) error {
+func (pm *ProjectManager) DeleteProjectApp(projectAppID int64) error {
log.Log.Debug("delete project app, projectAppID: %v", projectAppID)
_, err := pm.model.GetProjectApp(projectAppID)
@@ -115,51 +90,14 @@ func (pm *ProjectManager) DeleteProjectApp(projectAppID int64, cName string) err
// UpdateProjectApp ..
func (pm *ProjectManager) UpdateProjectApp(projectID, projectAppID int64, req *ProjectAppUpdateReq) error {
- log.Log.Debug("update app projectAppID: %v, params: %+v", projectAppID, req)
- if req.Name == "" {
- return fmt.Errorf("请输入有效的『仓库名』")
- }
-
- if req.Path == "" {
- return fmt.Errorf("请输入有效的『路径』")
- }
- projectApp, err := pm.model.GetProjectApp(projectAppID)
- if err != nil {
- return err
- }
-
- if req.BuildPath == "" {
- projectApp.BuildPath = "/"
- } else {
- projectApp.BuildPath = req.BuildPath
- }
-
- if req.Dockerfile == "" {
- projectApp.Dockerfile = "Dockerfile"
- } else {
- projectApp.Dockerfile = req.Dockerfile
- }
-
- projectApp.BranchName = req.BranchName
- projectApp.CompileEnvID = req.CompileEnvID
- projectApp.Language = req.Language
- projectApp.Name = req.Name
- projectApp.Path = req.Path
- return pm.model.UpdateProjectApp(projectApp)
-}
-
-// SwitchAppBranch ..
-func (pm *ProjectManager) SwitchAppBranch(projectID, projectAppID int64, req *ProjectAppBranchUpdateReq) error {
- log.Log.Debug("switch app branch projectAppID: %v, params: %+v", projectAppID, req)
- branch, err := pm.gitAppModel.GetAppBranchByName(req.AppID, req.BranchName)
- if err != nil {
- return fmt.Errorf("when get app branch, occur error: %s", err.Error())
+ _, err := pm.model.GetProjectAppByScmID(projectID, req.ScmID)
+ if err == nil {
+ return fmt.Errorf("already exist scmid: %v register", req.ScmID)
}
projectApp, err := pm.model.GetProjectApp(projectAppID)
if err != nil {
return err
}
- projectApp.BranchName = req.BranchName
- projectApp.Path = branch.Path
+ projectApp.ScmID = req.ScmID
return pm.model.UpdateProjectApp(projectApp)
}
diff --git a/internal/core/project/project.go b/internal/core/project/project.go
index 6391b334..326129c8 100644
--- a/internal/core/project/project.go
+++ b/internal/core/project/project.go
@@ -26,7 +26,6 @@ import (
"github.com/go-atomci/atomci/internal/dao"
"github.com/go-atomci/atomci/internal/middleware/log"
"github.com/go-atomci/atomci/internal/models"
- "github.com/go-atomci/atomci/utils"
"github.com/go-atomci/atomci/utils/errors"
"github.com/go-atomci/atomci/utils/query"
@@ -38,7 +37,7 @@ import (
type ProjectManager struct {
model *dao.ProjectModel
pipelineModel *dao.PipelineStageModel
- gitAppModel *dao.GitAppModel
+ scmAppModel *dao.ScmAppModel
k8sModel *dao.K8sClusterModel
userrolesModel *dao.UserRolesModel
publishModel *dao.PublishModel
@@ -51,7 +50,7 @@ func NewProjectManager() *ProjectManager {
model: dao.NewProjectModel(),
pipelineModel: dao.NewPipelineStageModel(),
settingModel: dao.NewSysSettingModel(),
- gitAppModel: dao.NewGitAppModel(),
+ scmAppModel: dao.NewScmAppModel(),
k8sModel: dao.NewK8sClusterModel(),
userrolesModel: dao.NewUserRolesModel(),
publishModel: dao.NewPublishModel(),
@@ -183,7 +182,7 @@ func (pm *ProjectManager) UpdateProject(user string, projectID int64, p *Project
modelProject.Description = p.Description
// if p.Owner changed, update project constraint
if UpdateConstraint {
- // TODO: add project constraint for owner, group use taimei
+ // TODO: add project constraint for owner
if err := dao.AddGroupUserConstraintValues("system", p.Owner, "projectID", []string{strconv.Itoa(int(projectID))}); err != nil {
return err
}
@@ -232,21 +231,6 @@ func (pm *ProjectManager) GetProjectInfo(projectID int64) (*models.ProjectDetail
return rsp, nil
}
-// CheckProjectUser ..
-func (pm *ProjectManager) CheckProjectUser(projectID int64, user string, groupsAdminList []string) (bool, error) {
- project, err := pm.model.GetProjectByID(projectID)
- if err != nil {
- err = fmt.Errorf("when check project user, get project occur error: %s", err)
- log.Log.Error("%v", err)
- return false, err
- }
- if project.Owner == user {
- return true, nil
- }
- // TODO: deprecated delete project Department
- return utils.Contains(groupsAdminList, "taimei"), nil
-}
-
// DeleteProject ...
func (pm *ProjectManager) DeleteProject(projectID int64) error {
project, err := pm.model.GetProjectByID(projectID)
diff --git a/internal/core/project/types.go b/internal/core/project/types.go
index b4757992..281983ba 100644
--- a/internal/core/project/types.go
+++ b/internal/core/project/types.go
@@ -35,13 +35,7 @@ type ProjectUpdateReq struct {
// ProjectAppUpdateReq ..
type ProjectAppUpdateReq struct {
- BranchName string `json:"branch_name"`
- Language string `json:"language"`
- Name string `json:"name"`
- Path string `json:"path"`
- CompileEnvID int64 `json:"compile_env_id"`
- BuildPath string `json:"build_path"`
- Dockerfile string `json:"dockerfile"`
+ ScmID int64 `json:"scm_id"`
}
// ProjectAppBranchUpdateReq ..
@@ -75,22 +69,20 @@ type ProjectNumberReq struct {
// ProjectAppReq add app into project request body.
type ProjectAppReq struct {
- Name string `json:"name"`
- CompileEnvID int64 `json:"compile_env_id"`
- Language string `json:"language"`
- Path string `json:"path"`
- RepoID int64 `json:"repo_id"`
- FullName string `json:"full_name"`
- BranchName string `json:"branch_name"`
- BuildPath string `json:"build_path"`
- Dockerfile string `json:"dockerfile"`
+ SCMID int64 `json:"scm_id"`
}
// ProjectAppRsp ..
type ProjectAppRsp struct {
*models.ProjectApp
BranchHistoryList []string `json:"branch_history_list,omitempty"`
- CompileEnv string `json:"compile_env"`
+ CompileEnv string `json:"compile_env,omitempty"`
+ Name string `json:"name,omitempty"`
+ FullName string `json:"full_name,omitempty"`
+ Language string `json:"language,omitempty"`
+ Path string `json:"path,omitempty"`
+ BuildPath string `json:"build_path,omitempty"`
+ Dockerfile string `json:"dockerfile,omitempty"`
}
// ProjectPipelineRsp ..
diff --git a/internal/core/project/utils.go b/internal/core/project/utils.go
index 9023df1e..ff67c9b0 100644
--- a/internal/core/project/utils.go
+++ b/internal/core/project/utils.go
@@ -121,43 +121,11 @@ func (pm *ProjectManager) deleteProjectUser(users []string, role string, project
return nil
}
-func (pm *ProjectManager) formatProjectAppResp(modelApp *models.ProjectApp) (*ProjectAppRsp, error) {
- // Get App Branches
- branches, err := pm.gitAppModel.GetAppBranches(modelApp.ID)
- if err != nil {
- return nil, err
- }
- // TODO: branchList get need commbined
- branchList := []string{}
- for _, branch := range branches {
- branchList = append(branchList, branch.BranchName)
- }
- if len(branchList) == 0 {
- branchList = []string{"master"}
- }
- compileEnvName := ""
- if modelApp.CompileEnvID != 0 {
- compileEnv, err := pm.settingModel.GetCompileEnvByID(modelApp.CompileEnvID)
- if err != nil {
- log.Log.Error("get compile env by id: %v error: %s", modelApp.CompileEnvID, err.Error())
- } else {
- compileEnvName = compileEnv.Name
- }
- }
-
- return &ProjectAppRsp{
- ProjectApp: modelApp,
- CompileEnv: compileEnvName,
- BranchHistoryList: branchList,
- }, nil
-
-}
-
func (pm *ProjectManager) formatProjectAppsResp(modelApps []*models.ProjectApp) ([]*ProjectAppRsp, error) {
projectAppsRsp := []*ProjectAppRsp{}
for _, app := range modelApps {
// Get App Branches
- branches, err := pm.gitAppModel.GetAppBranches(app.ID)
+ branches, err := pm.scmAppModel.GetAppBranches(app.ScmID)
if err != nil {
return nil, err
}
@@ -177,8 +145,20 @@ func (pm *ProjectManager) formatProjectAppsResp(modelApps []*models.ProjectApp)
// } else {
// compileEnvName = compileEnv.Name
// }
+
+ scmapp, err := pm.scmAppModel.GetScmAppByID(app.ScmID)
+ if err != nil {
+ return nil, err
+ }
+
projectAppRsp := &ProjectAppRsp{
ProjectApp: app,
+ Name: scmapp.Name,
+ FullName: scmapp.FullName,
+ Language: scmapp.Language,
+ Path: scmapp.Path,
+ Dockerfile: scmapp.Dockerfile,
+ BuildPath: scmapp.BuildPath,
// CompileEnv: compileEnvName,
BranchHistoryList: branchList,
}
diff --git a/internal/core/publish/app.go b/internal/core/publish/app.go
index dbca0418..00a4e430 100644
--- a/internal/core/publish/app.go
+++ b/internal/core/publish/app.go
@@ -51,7 +51,7 @@ func (pm *PublishManager) GetCanAddedApps(publishID int64) ([]*models.ProjectApp
for _, app := range projectApps {
if !utils.IntContains(appIDByAdded, app.ID) {
branchList := []string{}
- branches, err := pm.gitAppModel.GetAppBranches(app.ID)
+ branches, err := pm.gitAppModel.GetAppBranches(app.ScmID)
if err == nil {
for _, item := range branches {
branchList = append(branchList, item.BranchName)
diff --git a/internal/core/publish/publish.go b/internal/core/publish/publish.go
index 7ab5cce7..ce03b4e0 100644
--- a/internal/core/publish/publish.go
+++ b/internal/core/publish/publish.go
@@ -34,7 +34,7 @@ import (
type PublishManager struct {
model *dao.PublishModel
pipelineModel *dao.PipelineStageModel
- gitAppModel *dao.GitAppModel
+ gitAppModel *dao.ScmAppModel
projectModel *dao.ProjectModel
k8sModel *dao.K8sClusterModel
pipelineHandler *pipelinemgr.PipelineManager
@@ -47,7 +47,7 @@ func NewPublishManager() *PublishManager {
model: dao.NewPublishModel(),
pipelineModel: dao.NewPipelineStageModel(),
projectModel: dao.NewProjectModel(),
- gitAppModel: dao.NewGitAppModel(),
+ gitAppModel: dao.NewScmAppModel(),
k8sModel: dao.NewK8sClusterModel(),
pipelineHandler: pipelinemgr.NewPipelineManager(),
projectHandler: project.NewProjectManager(),
diff --git a/internal/core/publish/uitls.go b/internal/core/publish/uitls.go
index 10b79428..40301c27 100644
--- a/internal/core/publish/uitls.go
+++ b/internal/core/publish/uitls.go
@@ -175,11 +175,16 @@ func (pm *PublishManager) getPublishInfoApps(publishID int64) ([]*PublishInfoApp
logs.Warn("publish app is not found, by project app id: %v, error: %s", app.ProjectAppID, err.Error())
continue
}
+ scpApp, err := pm.gitAppModel.GetScmAppByID(projectApp.ScmID)
+ if err != nil {
+ logs.Warn("get scm by id %v error: %s", projectApp.ScmID, err.Error())
+ continue
+ }
infoApp := &PublishInfoApp{
PublishApp: app,
- Language: projectApp.Language,
- Name: projectApp.Name,
- // TODO: use hard code defined app type
+ Language: scpApp.Language,
+ Name: scpApp.Name,
+ // use hard code defined app type
Type: "app",
}
infoApps = append(infoApps, infoApp)
diff --git a/internal/core/settings/settings.go b/internal/core/settings/settings.go
index 436bf741..76ebd27e 100644
--- a/internal/core/settings/settings.go
+++ b/internal/core/settings/settings.go
@@ -19,18 +19,18 @@ package settings
import (
"encoding/json"
"fmt"
- "io"
- "os"
"strings"
"time"
+ "k8s.io/client-go/rest"
+
+ "github.com/go-atomci/atomci/constant"
"github.com/go-atomci/atomci/internal/dao"
"github.com/go-atomci/atomci/internal/middleware/log"
"github.com/go-atomci/atomci/internal/models"
"github.com/go-atomci/atomci/utils/query"
"github.com/go-atomci/atomci/utils/validate"
- "github.com/astaxie/beego"
"github.com/go-atomci/workflow/jenkins"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
@@ -50,6 +50,13 @@ type IntegrateSettingResponse struct {
ID int64 `json:"id,omitempty"`
}
+type ScmIntegrateSetting struct {
+ Name string `json:"name,omitempty"`
+ Description string `json:"description,omitempty"`
+ ScmAuthConf
+ Type string `json:"type,omitempty"`
+}
+
// VerifyResponse integrate verify
type VerifyResponse struct {
Msg string `json:"msg,omitempty"`
@@ -69,6 +76,9 @@ const (
KubernetesType = "kubernetes"
RegistryType = "registry"
JenkinsType = "jenkins"
+
+ KubernetesConfig = "kubernetesConfig"
+ KubernetesToken = "kubernetesToken"
)
type Config struct{}
@@ -81,6 +91,7 @@ type BaseConfig struct {
type KubeConfig struct {
URL string `json:"url,omitempty"`
Conf string `json:"conf,omitempty"`
+ Type string `json:"type,omitempty"`
}
type RegistryConfig struct {
BaseConfig
@@ -89,6 +100,16 @@ type RegistryConfig struct {
IsHttps bool `json:"isHttps,omitempty"`
}
+type ScmBaseConfig struct {
+ URL string `json:"url,omitempty"`
+ Token string `json:"token,omitempty"`
+}
+
+type ScmAuthConf struct {
+ ScmBaseConfig
+ User string `json:"user,omitempty"`
+}
+
type JenkinsConfig struct {
BaseConfig
Token string `json:"token,omitempty"`
@@ -116,6 +137,14 @@ func (config *Config) Struct(sc string, settingType string) (interface{}, error)
registry := &RegistryConfig{}
err := json.Unmarshal([]byte(sc), registry)
return registry, err
+ case "gitlab":
+ scmConf := &ScmAuthConf{}
+ err := json.Unmarshal([]byte(sc), scmConf)
+ return scmConf, err
+ case "gitea", "gitee", "github":
+ scmConf := &ScmBaseConfig{}
+ err := json.Unmarshal([]byte(sc), scmConf)
+ return scmConf, err
default:
log.Log.Warn("this settings type %s is not support, return origin string", settingType)
return sc, nil
@@ -130,8 +159,8 @@ func NewSettingManager() *SettingManager {
}
// GetIntegrateSettings ..
-func (pm *SettingManager) GetIntegrateSettings(integrateType string) ([]*IntegrateSettingResponse, error) {
- items, err := pm.model.GetIntegrateSettings(integrateType)
+func (pm *SettingManager) GetIntegrateSettings(integrateTypes []string) ([]*IntegrateSettingResponse, error) {
+ items, err := pm.model.GetIntegrateSettings(integrateTypes)
if err != nil {
log.Log.Error("get interate settings error: %s", err.Error())
return nil, err
@@ -151,9 +180,55 @@ func (pm *SettingManager) GetIntegrateSettingByID(id int64) (*IntegrateSettingRe
return formatSignalIntegrateSetting(integrateSetting, config), err
}
+func (pm *SettingManager) GetSCMIntegrateSettinByID(id int64) (*ScmIntegrateSetting, error) {
+ resp, err := pm.GetIntegrateSettingByID(id)
+ if err != nil {
+ return nil, err
+ }
+ scmResp := &ScmIntegrateSetting{
+ Name: resp.Name,
+ Type: resp.Type,
+ }
+ scmCONF := getScmConf(resp.Type, resp.Config)
+ scmResp.ScmAuthConf = scmCONF
+ return scmResp, nil
+}
+
+func getScmConf(scmType string, config interface{}) ScmAuthConf {
+ scmCONF := ScmAuthConf{}
+ switch strings.ToLower(scmType) {
+ case constant.SCMGitlab:
+ if conf, ok := config.(*ScmAuthConf); ok {
+ scmCONF.URL = conf.URL
+ scmCONF.User = conf.User
+ scmCONF.Token = conf.Token
+ } else {
+ log.Log.Error("parse type: %s conf error", constant.SCMGitlab)
+ }
+ case constant.SCMGitea, constant.SCMGitee, constant.SCMGithub:
+ if conf, ok := config.(*ScmBaseConfig); ok {
+ scmCONF.URL = conf.URL
+ scmCONF.Token = conf.Token
+ } else {
+ log.Log.Error("parse type: %s conf error", "scmbase conf")
+ }
+ }
+ return scmCONF
+}
+
+func (pm *SettingManager) GetIntegrateSettingByName(name, integrateType string) (*IntegrateSettingResponse, error) {
+ integrateSetting, err := pm.model.GetIntegrateSettingByName(name, integrateType)
+ if err != nil {
+ log.Log.Error("when GetIntegrateSettingByName, get GetIntegrateSettingByName occur error: %s", err.Error())
+ return nil, err
+ }
+ config := &Config{}
+ return formatSignalIntegrateSetting(integrateSetting, config), err
+}
+
// GetIntegrateSettingsByPagination ..
-func (pm *SettingManager) GetIntegrateSettingsByPagination(filter *query.FilterQuery) (*query.QueryResult, error) {
- queryResult, settingsList, err := pm.model.GetIntegrateSettingsByPagination(filter)
+func (pm *SettingManager) GetIntegrateSettingsByPagination(filter *query.FilterQuery, intergrateTypes []string) (*query.QueryResult, error) {
+ queryResult, settingsList, err := pm.model.GetIntegrateSettingsByPagination(filter, intergrateTypes)
if err != nil {
return nil, err
}
@@ -190,40 +265,10 @@ func (pm *SettingManager) UpdateIntegrateSetting(request *IntegrateSettingReq, s
log.Log.Error("json marshal error: %s", err.Error())
return err
}
- //stageModel.Config = config
- stageModel.CryptoConfig(config)
- if request.Type == KubernetesType {
- kube := &KubeConfig{}
- err := json.Unmarshal([]byte(config), kube)
- if err == nil {
- pm.createOrupateKubernetesConfig(request.Name, kube.Conf)
- } else {
- log.Log.Error("kuber conf format error: %v", err.Error())
- }
- }
- return pm.model.UpdateIntegrateSetting(stageModel)
-}
-func (pm *SettingManager) createOrupateKubernetesConfig(clusterName, config string) error {
- configPath := beego.AppConfig.String("k8s::configPath")
+ stageModel.CryptoConfig(config)
- log.Log.Debug("configPath: %v", configPath)
- err := os.MkdirAll(configPath, 0766)
- if err != nil {
- log.Log.Error(fmt.Sprintf("Failed to make the k8sconfig dir: %v", err.Error()))
- return err
- }
- fileObj, err := os.OpenFile(configPath+"/"+clusterName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
- if err != nil {
- log.Log.Error(fmt.Sprintf("Failed to open the file: %v", err.Error()))
- return err
- }
- if _, err := io.WriteString(fileObj, config); err != nil {
- log.Log.Error(fmt.Sprintf("init K8S cluster %v configure failed: %v", clusterName, err.Error()))
- return err
- }
- log.Log.Debug(fmt.Sprintf("update K8S cluster %v configure successfully", clusterName))
- return nil
+ return pm.model.UpdateIntegrateSetting(stageModel)
}
// VerifyIntegrateSetting ..
@@ -240,16 +285,30 @@ func (pm *SettingManager) VerifyIntegrateSetting(request *IntegrateSettingReq) V
case KubernetesType:
kube := &KubeConfig{}
err := json.Unmarshal([]byte(config), kube)
+ if kube.Type == "" {
+ kube.Type = KubernetesConfig
+ }
if err != nil {
log.Log.Error("kuber conf format error: %v", err.Error())
resp.Error = err
return resp
}
- k8sconf, err := clientcmd.RESTConfigFromKubeConfig([]byte(kube.Conf))
- if err != nil {
- resp.Error = err
- return resp
+ var k8sconf *rest.Config
+ switch kube.Type {
+ case KubernetesConfig:
+ k8sconf, err = clientcmd.RESTConfigFromKubeConfig([]byte(kube.Conf))
+ if err != nil {
+ resp.Error = err
+ return resp
+ }
+ case KubernetesToken:
+ k8sconf = &rest.Config{
+ BearerToken: kube.Conf,
+ TLSClientConfig: rest.TLSClientConfig{Insecure: true},
+ Host: kube.URL,
+ }
}
+
clientset, err := kubernetes.NewForConfig(k8sconf)
if err != nil {
resp.Error = err
@@ -334,21 +393,6 @@ func (pm *SettingManager) CreateIntegrateSetting(request *IntegrateSettingReq, c
newIntegrateSetting.CryptoConfig(config)
- if request.Type == KubernetesType {
- kube := &KubeConfig{}
- err := json.Unmarshal([]byte(config), kube)
- if err != nil {
- msg := fmt.Sprintf("kuber conf format error: %v", err.Error())
- log.Log.Error(msg)
- return fmt.Errorf(msg)
- }
-
- if err := pm.createOrupateKubernetesConfig(request.Name, kube.Conf); err != nil {
- log.Log.Error("create or update k8s config file error: %s", err.Error())
- } else {
- log.Log.Debug("create or update k8s config file success.")
- }
- }
return pm.model.CreateIntegrateSetting(newIntegrateSetting)
}
diff --git a/internal/dao/integrate_settings.go b/internal/dao/integrate_settings.go
index dcc99d42..ff9a5dc1 100644
--- a/internal/dao/integrate_settings.go
+++ b/internal/dao/integrate_settings.go
@@ -49,12 +49,21 @@ func (model *SysSettingModel) GetIntegrateSettingByID(integrateSettingID int64)
return &integrateSetting, nil
}
+func (model *SysSettingModel) GetIntegrateSettingByName(name, integrateType string) (*models.IntegrateSetting, error) {
+ integrateSetting := models.IntegrateSetting{}
+ qs := model.ormer.QueryTable(model.IntegrateSettingTableName).Filter("deleted", false)
+ if err := qs.Filter("name", name).Filter("type", integrateType).One(&integrateSetting); err != nil {
+ return nil, err
+ }
+ return &integrateSetting, nil
+}
+
// GetIntegrateSettings ...
-func (model *SysSettingModel) GetIntegrateSettings(integrateType string) ([]*models.IntegrateSetting, error) {
- integrateSettings := []*models.IntegrateSetting{}
+func (model *SysSettingModel) GetIntegrateSettings(integrateTypes []string) ([]*models.IntegrateSetting, error) {
+ var integrateSettings []*models.IntegrateSetting
qs := model.ormer.QueryTable(model.IntegrateSettingTableName).Filter("deleted", false)
- if integrateType != "" {
- qs = qs.Filter("type", integrateType)
+ if len(integrateTypes) > 0 {
+ qs = qs.Filter("type__in", integrateTypes)
}
_, err := qs.All(&integrateSettings)
if err != nil {
@@ -64,7 +73,7 @@ func (model *SysSettingModel) GetIntegrateSettings(integrateType string) ([]*mod
}
// GetIntegrateSettingsByPagination ..
-func (model *SysSettingModel) GetIntegrateSettingsByPagination(filter *query.FilterQuery) (*query.QueryResult, []*models.IntegrateSetting, error) {
+func (model *SysSettingModel) GetIntegrateSettingsByPagination(filter *query.FilterQuery, intergrateTypes []string) (*query.QueryResult, []*models.IntegrateSetting, error) {
rst := &query.QueryResult{Item: []*models.IntegrateSetting{}}
queryCond := orm.NewCondition().AndCond(orm.NewCondition().And("deleted", false))
@@ -72,6 +81,9 @@ func (model *SysSettingModel) GetIntegrateSettingsByPagination(filter *query.Fil
queryCond = queryCond.AndCond(filterCond)
}
qs := model.ormer.QueryTable(model.IntegrateSettingTableName).OrderBy("-create_at").SetCond(queryCond)
+ if len(intergrateTypes) > 0 {
+ qs = qs.Filter("type__in", intergrateTypes)
+ }
count, err := qs.Count()
if err != nil {
return nil, nil, err
diff --git a/internal/dao/project.go b/internal/dao/project.go
index 2062d4f3..fd4d6c18 100644
--- a/internal/dao/project.go
+++ b/internal/dao/project.go
@@ -476,10 +476,10 @@ func (model *ProjectModel) GetProjectAppsList(projectID int64, filter *models.Pr
// CreateProjectAppIfNotExist ...
func (model *ProjectModel) CreateProjectAppIfNotExist(app *models.ProjectApp) (int64, error) {
- created, id, err := model.ormer.ReadOrCreate(app, "project_id", "name", "repo_id", "deleted")
+ created, id, err := model.ormer.ReadOrCreate(app, "project_id", "scm_id", "deleted")
if err == nil {
if !created {
- err = fmt.Errorf(fmt.Sprintf("app: %v existed in project", app.FullName))
+ err = fmt.Errorf(fmt.Sprintf("app: %v existed in project", app.ScmID))
}
}
return id, err
@@ -526,6 +526,15 @@ func (model *ProjectModel) GetProjectApp(projectAppID int64) (*models.ProjectApp
return &app, err
}
+// GetProjectApp ...
+func (model *ProjectModel) GetProjectAppByScmID(projectID, scmID int64) (*models.ProjectApp, error) {
+ app := models.ProjectApp{}
+ qs := model.ormer.QueryTable(model.projectAppTableName).Filter("deleted", false)
+ qs = qs.Filter("scm_id", scmID).Filter("project_id", projectID)
+ err := qs.One(&app)
+ return &app, err
+}
+
// UpdateProjectApp ...
func (model *ProjectModel) UpdateProjectApp(projectApp *models.ProjectApp) error {
_, err := model.ormer.Update(projectApp)
diff --git a/internal/dao/role.go b/internal/dao/role.go
index e64d8e4a..acb4961f 100644
--- a/internal/dao/role.go
+++ b/internal/dao/role.go
@@ -18,6 +18,7 @@ package dao
import (
"fmt"
+
mycasbin "github.com/go-atomci/atomci/internal/middleware/casbin"
"github.com/go-atomci/atomci/internal/middleware/log"
"github.com/go-atomci/atomci/internal/models"
@@ -78,7 +79,6 @@ func CreateGroupRole(req *models.GroupRoleReq) (*models.GroupRole, error) {
return nil, err
}
- log.Log.Debug("req operations length: %v", len(req.Operations))
err := GenerateCasbinrules(req.Role, req.Operations)
if err != nil {
log.Log.Error("generate casbin rules error: %s", err.Error())
@@ -160,10 +160,6 @@ func AddRoleOperation(req *models.GroupRoleOperationReq) error {
if _, err := GetOrmer().Raw(sql).Exec(); err != nil {
return err
}
-
- if err := GenerateCasbinrules(req.Role, req.Operations); err != nil {
- return err
- }
}
return nil
}
diff --git a/internal/dao/gitapp.go b/internal/dao/scmapp.go
similarity index 51%
rename from internal/dao/gitapp.go
rename to internal/dao/scmapp.go
index 2e67cfd4..d60ed725 100644
--- a/internal/dao/gitapp.go
+++ b/internal/dao/scmapp.go
@@ -18,7 +18,6 @@ package dao
import (
"fmt"
- "strings"
"github.com/go-atomci/atomci/internal/models"
"github.com/go-atomci/atomci/utils/query"
@@ -26,98 +25,95 @@ import (
"github.com/astaxie/beego/orm"
)
-// GitAppModel ...
-type GitAppModel struct {
- ormer orm.Ormer
- gitAppTableName string
- repoServerTableName string
- AppBranchTableName string
+// ScmAppModel ...
+type ScmAppModel struct {
+ ormer orm.Ormer
+ scmAppTableName string
+ AppBranchTableName string
}
// NewGitAppModel ...
-func NewGitAppModel() (model *GitAppModel) {
- return &GitAppModel{
- ormer: GetOrmer(),
- gitAppTableName: (&models.GitApp{}).TableName(),
- repoServerTableName: (&models.RepoServer{}).TableName(),
- AppBranchTableName: (&models.AppBranch{}).TableName(),
+func NewScmAppModel() (model *ScmAppModel) {
+ return &ScmAppModel{
+ ormer: GetOrmer(),
+ scmAppTableName: (&models.ScmApp{}).TableName(),
+ AppBranchTableName: (&models.AppBranch{}).TableName(),
}
}
-// GetGitRepoByID ...
-func (model *GitAppModel) GetGitRepoByID(repoID int64) (*models.RepoServer, error) {
- app := models.RepoServer{}
- err := model.ormer.QueryTable(model.repoServerTableName).
- Filter("deleted", false).
- Filter("id", repoID).One(&app)
- return &app, err
+// CreateProjectAppIfNotExist ...
+func (model *ScmAppModel) CreateScmAppIfNotExist(app *models.ScmApp) (int64, error) {
+ created, id, err := model.ormer.ReadOrCreate(app, "name", "repo_id", "deleted")
+ if err == nil {
+ if !created {
+ err = fmt.Errorf(fmt.Sprintf("app: %v existed in project", app.FullName))
+ }
+ }
+ return id, err
}
-// GetReposByprojectID ..
-func (model *GitAppModel) GetReposByprojectID(cID int64) ([]*models.RepoServer, error) {
- repos := []*models.RepoServer{}
- _, err := model.ormer.QueryTable(model.repoServerTableName).
- Filter("deleted", false).
- Filter("cid", cID).All(&repos)
- return repos, err
+func (model *ScmAppModel) GetScmApps() ([]*models.ScmApp, error) {
+ app := []*models.ScmApp{}
+ qs := model.ormer.QueryTable(model.scmAppTableName).Filter("deleted", false)
+ // TODO: add scm app tags
+ _, err := qs.All(&app)
+ return app, err
}
-// GetRepoBycIDAndType ..
-func (model *GitAppModel) GetRepoBycIDAndType(cID int64, repoType string) (*models.RepoServer, error) {
- repo := models.RepoServer{}
- err := model.ormer.QueryTable(model.repoServerTableName).
+func (model *ScmAppModel) GetScmAppByID(appID int64) (*models.ScmApp, error) {
+ app := models.ScmApp{}
+ err := model.ormer.QueryTable(model.scmAppTableName).
Filter("deleted", false).
- Filter("cid", cID).
- Filter("type", strings.ToLower(repoType)).One(&repo)
- return &repo, err
+ Filter("id", appID).One(&app)
+ return &app, err
}
-// GetRepoByID ..
-func (model *GitAppModel) GetRepoByID(repoID int64) (*models.RepoServer, error) {
- repo := models.RepoServer{}
- err := model.ormer.QueryTable(model.repoServerTableName).
- Filter("deleted", false).
- Filter("id", repoID).One(&repo)
- return &repo, err
+// UpdateProjectApp ...
+func (model *ScmAppModel) UpdateSCMApp(scmApp *models.ScmApp) error {
+ _, err := model.ormer.Update(scmApp)
+ return err
}
-// CreateDefaultRepo ..
-func (model *GitAppModel) CreateDefaultRepo(cID int64, repoType string) error {
- rs := &models.RepoServer{
- CID: cID,
- Type: strings.ToLower(repoType),
- }
- if _, err := model.createRepo(rs); err != nil {
+// DeleteProjectApp ...
+func (model *ScmAppModel) DeleteSCMApp(scmAppID int64) error {
+ app, err := model.GetScmAppByID(scmAppID)
+ if err != nil {
return err
}
- return nil
-}
-
-// UpdateRepo ...
-func (model *GitAppModel) UpdateRepo(repo *models.RepoServer) error {
- _, err := model.ormer.Update(repo)
+ app.MarkDeleted()
+ _, err = model.ormer.Delete(app)
return err
}
-func (model *GitAppModel) createRepo(rs *models.RepoServer) (int64, error) {
- _, id, err := model.ormer.ReadOrCreate(rs, "type", "deleted", "cid")
- return id, err
-}
+// GetCompileEnvsByPagination ..
+func (model *ScmAppModel) GetScmAppsByPagination(filter *query.FilterQuery) (*query.QueryResult, error) {
+ rst := &query.QueryResult{Item: []*models.ScmApp{}}
+ queryCond := orm.NewCondition().AndCond(orm.NewCondition().And("deleted", false))
+
+ if filterCond := query.FilterCondition(filter, filter.FilterKey); filterCond != nil {
+ queryCond = queryCond.AndCond(filterCond)
+ }
+ qs := model.ormer.QueryTable(model.scmAppTableName).OrderBy("-create_at").SetCond(queryCond)
+ count, err := qs.Count()
+ if err != nil {
+ return nil, err
+ }
+ if err = query.FillPageInfo(rst, filter.PageIndex, filter.PageSize, int(count)); err != nil {
+ return nil, err
+ }
-// GetGitApps ...
-func (model *GitAppModel) GetGitApps(appIDs []int64) ([]*models.GitApp, error) {
- apps := []*models.GitApp{}
- qs := model.ormer.QueryTable(model.gitAppTableName).Filter("deleted", false)
- if appIDs != nil {
- qs = qs.Filter("id__in", appIDs)
+ scmApplist := []*models.ScmApp{}
+ _, err = qs.Limit(filter.PageSize, filter.PageSize*(filter.PageIndex-1)).All(&scmApplist)
+ if err != nil {
+ return nil, err
}
+ rst.Item = scmApplist
- _, err := qs.All(&apps)
- return apps, err
+ return rst, nil
}
// CreateAppBranchIfNotExist ...
-func (model *GitAppModel) CreateAppBranchIfNotExist(branch *models.AppBranch) (int64, error) {
+func (model *ScmAppModel) CreateAppBranchIfNotExist(branch *models.AppBranch) (int64, error) {
created, id, err := model.ormer.ReadOrCreate(branch, "branch_name", "app_id", "deleted")
if err == nil {
if !created {
@@ -128,19 +124,19 @@ func (model *GitAppModel) CreateAppBranchIfNotExist(branch *models.AppBranch) (i
}
// UpdateAppBranch ...
-func (model *GitAppModel) UpdateAppBranch(branch *models.AppBranch) error {
+func (model *ScmAppModel) UpdateAppBranch(branch *models.AppBranch) error {
_, err := model.ormer.Update(branch)
return err
}
// SoftDeleteAppBranch ...
-func (model *GitAppModel) SoftDeleteAppBranch(branch *models.AppBranch) error {
+func (model *ScmAppModel) SoftDeleteAppBranch(branch *models.AppBranch) error {
branch.MarkDeleted()
return model.UpdateAppBranch(branch)
}
// GetAppBranchesByPagination ...
-func (model *GitAppModel) GetAppBranchesByPagination(appID int64, filter *query.FilterQuery) (*query.QueryResult, error) {
+func (model *ScmAppModel) GetAppBranchesByPagination(appID int64, filter *query.FilterQuery) (*query.QueryResult, error) {
rst := &query.QueryResult{Item: []*models.AppBranch{}}
queryCond := orm.NewCondition().AndCond(orm.NewCondition().And("deleted", false))
@@ -169,7 +165,7 @@ func (model *GitAppModel) GetAppBranchesByPagination(appID int64, filter *query.
}
// GetAppBranches ...
-func (model *GitAppModel) GetAppBranches(appID int64) ([]*models.AppBranch, error) {
+func (model *ScmAppModel) GetAppBranches(appID int64) ([]*models.AppBranch, error) {
branches := []*models.AppBranch{}
qs := model.ormer.QueryTable(model.AppBranchTableName).Filter("deleted", false)
if appID != 0 {
@@ -180,7 +176,7 @@ func (model *GitAppModel) GetAppBranches(appID int64) ([]*models.AppBranch, erro
}
// GetAppBranchByName ...
-func (model *GitAppModel) GetAppBranchByName(appID int64, branchName string) (*models.AppBranch, error) {
+func (model *ScmAppModel) GetAppBranchByName(appID int64, branchName string) (*models.AppBranch, error) {
branch := models.AppBranch{}
err := model.ormer.QueryTable(model.AppBranchTableName).
Filter("deleted", false).
diff --git a/internal/dao/user.go b/internal/dao/user.go
index d44460e7..8bd1fb3f 100644
--- a/internal/dao/user.go
+++ b/internal/dao/user.go
@@ -238,3 +238,19 @@ func GetUserResourceConstraintValues(resourceType, user string) (UserResourceCon
conValues.Values = append(conValues.Values, values)
return conValues, nil
}
+
+// GetProjectMemberByConstraint ..
+func GetProjectMemberByConstraint(projectId int64) ([]models.GroupUserConstraint, error) {
+ var user []models.GroupUserConstraint
+ query := GetOrmer().QueryTable("sys_group_user_constraint").Filter("deleted", false)
+ if projectId != 0 {
+ query = query.
+ Filter("constraint", "project_id").Filter("value", projectId)
+ }
+ _, err := query.All(&user)
+ if err != nil {
+ logs.Error("get project user by constraint error: %s", err.Error())
+ return user, err
+ }
+ return user, nil
+}
diff --git a/internal/initialize/constants.go b/internal/initialize/constants.go
index 54fdd480..8443ff72 100644
--- a/internal/initialize/constants.go
+++ b/internal/initialize/constants.go
@@ -78,12 +78,10 @@ var resourceReq = ResourceReq{
[]string{"GetAppsByPagination", "获取项目应用分页列表"},
[]string{"GetArrange", "获取应用编排"},
[]string{"SetArrange", "设置应用编排"},
- []string{"GetAppBranches", "获取应用分支"},
- []string{"SyncAppBranches", "同步远程分支"},
- []string{"SwitchProjectBranch", "切换项目应用的默认分支"},
[]string{"DeleteProjectApp", "删除项目应用"},
- []string{"GetRepos", "获取代码仓库列表"},
[]string{"GetGitProjectsByRepoID", "获取代码仓库项目列表"},
+ []string{"GetAppBranches", "获取应用分支"},
+ []string{"SyncAppBranches", "同步远程分支"},
[]string{"ParserAppArrange", "应用编排解析"},
[]string{"GetJenkinsConfig", "获取Jenkins配置"},
@@ -185,8 +183,12 @@ var gaetwayReq = RouterReq{
[]string{"atomci/api/v1/groups/:group/users/:user", "DELETE", "atomci", "group", "RemoveGroupUser"},
// app repo
- []string{"atomci/api/v1/repos", "GET", "atomci", "repository", "GetRepos"},
[]string{"atomci/api/v1/repos/:repo_id/projects", "POST", "atomci", "repository", "GetGitProjectsByRepoID"},
+ []string{"atomci/api/v1/apps/:app_id/branches", "POST", "atomci", "repository", "GetAppBranches"},
+ []string{"atomci/api/v1/apps/:app_id/syncBranches", "POST", "atomci", "repository", "SyncAppBranches"},
+ []string{"atomci/api/v1/apps/:app_id", "GET", "atomci", "repository", "GetScmApp"},
+ []string{"atomci/api/v1/apps/:app_id", "PUT", "atomci", "repository", "UpdateScmApp"},
+ []string{"atomci/api/v1/apps/:app_id", "DELETE", "atomci", "repository", "DeleteScmApp"},
// project
[]string{"atomci/api/v1/projects", "POST", "atomci", "project", "ProjectList"},
@@ -210,10 +212,7 @@ var gaetwayReq = RouterReq{
[]string{"atomci/api/v1/arrange/yaml/parser", "POST", "atomci", "project", "ParserAppArrange"},
[]string{"atomci/api/v1/pipelines/stages/:stage_id/jenkins-config", "GET", "atomci", "project", "GetJenkinsConfig"},
- []string{"atomci/api/v1/projects/:project_id/apps/:app_id/branches", "POST", "atomci", "project", "GetAppBranches"},
- []string{"atomci/api/v1/projects/:project_id/apps/:app_id/syncBranches", "POST", "atomci", "project", "SyncAppBranches"},
[]string{"atomci/api/v1/projects/:project_id/apps/:project_app_id", "PUT", "atomci", "project", "UpdateProjectApp"},
- []string{"atomci/api/v1/projects/:project_id/apps/:project_app_id", "PATCH", "atomci", "project", "SwitchProjectBranch"},
[]string{"atomci/api/v1/projects/:project_id/apps/:project_app_id", "DELETE", "atomci", "project", "DeleteProjectApp"},
[]string{"atomci/api/v1/projects/:project_id/clusters/:cluster/apps", "POST", "atomci", "project", "GetProjectAppServices"},
[]string{"atomci/api/v1/clusters/:cluster/namespaces/:namespace/apps/:app", "GET", "atomci", "project", "GetAppServiceInspect"},
diff --git a/internal/initialize/init.go b/internal/initialize/init.go
index 0e96c93d..29386290 100644
--- a/internal/initialize/init.go
+++ b/internal/initialize/init.go
@@ -23,7 +23,7 @@ import (
"github.com/go-atomci/atomci/utils/errors"
)
-func init() {
+func Init() {
// 注册/更新资源
initResource()
@@ -47,19 +47,4 @@ func init() {
os.Exit(2)
}
}
-
- /*
- TODO: Below resources just run once
- */
- if err := Component(); err != nil {
- os.Exit(2)
- }
-
- // init compile envs
- initCompileEnvs()
-
- // init task tmpls
- if err := initTaskTemplates(); err != nil {
- os.Exit(2)
- }
}
diff --git a/internal/initialize/init_compile_envs.go b/internal/initialize/init_compile_envs.go
deleted file mode 100644
index edbfe957..00000000
--- a/internal/initialize/init_compile_envs.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package initialize
-
-import (
- "github.com/astaxie/beego/logs"
- "github.com/astaxie/beego/orm"
- "github.com/go-atomci/atomci/internal/core/settings"
- "github.com/go-atomci/atomci/internal/dao"
- "github.com/go-atomci/atomci/internal/middleware/log"
- "github.com/go-atomci/atomci/internal/models"
-)
-
-var compileEnvs = []settings.CompileEnvReq{
- {
- Name: "jnlp",
- Image: "colynn/jenkins-jnlp-agent:latest",
- Description: "",
- },
- {
- Name: "kaniko",
- Image: "colynn/kaniko-executor:debug",
- Command: "/bin/sh -c",
- Args: "cat",
- },
- {
- Name: "node",
- Image: "node:12.12-alpine",
- Description: "nodejs编译环境",
- },
- {
- Name: "maven",
- Image: "maven:3.8.2-openjdk-8",
- Command: "/bin/sh -c",
- Args: "cat",
- },
-}
-
-func initCompileEnvs() error {
- settingModel := dao.NewSysSettingModel()
- for _, item := range compileEnvs {
- _, err := settingModel.GetCompileEnvByName(item.Name)
- if err != nil {
- if err == orm.ErrNoRows {
- component := &models.CompileEnv{
- Addons: models.NewAddons(),
- Name: item.Name,
- Image: item.Image,
- Command: item.Command,
- Creator: "admin", // create use 'admin'
- Args: item.Args,
- Description: item.Description,
- }
- if err := settingModel.CreateCompileEnv(component); err != nil {
- log.Log.Error("when init compile env, occur error: %s", err.Error())
- continue
- }
- } else {
- logs.Warn("init compile env occur error: %s", err.Error())
- continue
- }
- } else {
- log.Log.Debug("component type `%s` already exists, skip", item.Name)
- continue
- }
- }
- return nil
-}
diff --git a/internal/initialize/init_component.go b/internal/initialize/init_component.go
deleted file mode 100644
index a064b4f7..00000000
--- a/internal/initialize/init_component.go
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package initialize
-
-import (
- "github.com/go-atomci/atomci/internal/dao"
- "github.com/go-atomci/atomci/internal/middleware/log"
- "github.com/go-atomci/atomci/internal/models"
-
- "github.com/astaxie/beego/orm"
-)
-
-type component struct {
- Name string
- Type string
- Params string
-}
-
-// Component ..
-func Component() error {
- components := []component{
- {
- Name: "人工卡点",
- Type: "manual",
- },
- {
- Name: "构建",
- Type: "build",
- },
- {
- Name: "部署",
- Type: "deploy",
- },
- }
- for _, comp := range components {
- pipelineModel := dao.NewPipelineStageModel()
- _, err := pipelineModel.GetFlowComponentByType(comp.Type)
- if err != nil {
- if err == orm.ErrNoRows {
- component := &models.FlowComponent{
- Addons: models.NewAddons(),
- Name: comp.Name,
- Type: comp.Type,
- Params: comp.Params,
- }
- if err := pipelineModel.CreateFlowComponent(component); err != nil {
- log.Log.Error("when init component, occur error: %s", err.Error())
- return err
- }
- } else {
- return err
- }
- } else {
- log.Log.Debug("component type `%s` already exists, skip", comp.Type)
- continue
- }
- }
- return nil
-}
diff --git a/internal/initialize/init_resource.go b/internal/initialize/init_resource.go
index bffade30..30da15c7 100644
--- a/internal/initialize/init_resource.go
+++ b/internal/initialize/init_resource.go
@@ -103,7 +103,7 @@ func initRouterItems() error {
err := fmt.Errorf("invalid router parameter: %v", route)
return err
}
- // TODO: add get verify
+ // TODO: Does validation already exist?
if err := dao.CreateGatewayRoute(route[0], route[1], route[2], route[3], route[4]); err != nil {
if !errors.OrmError1062(err) {
log.Log.Error("Init gateway error: %s", err.Error())
diff --git a/internal/initialize/init_system_user.go b/internal/initialize/init_system_user.go
index 2cece9ef..38418de5 100644
--- a/internal/initialize/init_system_user.go
+++ b/internal/initialize/init_system_user.go
@@ -123,10 +123,8 @@ func initSystemRole() error {
"GetArrange",
"SetArrange",
"GetAppBranches",
- "GetRepos",
"GetGitProjectsByRepoID",
"SyncAppBranches",
- "SwitchProjectBranch",
"DeleteProjectApp",
"GetProjectEnvs",
"GetIntegrateSettings",
diff --git a/internal/initialize/init_task_tmpl.go b/internal/initialize/init_task_tmpl.go
deleted file mode 100644
index 6fb6529e..00000000
--- a/internal/initialize/init_task_tmpl.go
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package initialize
-
-import (
- "github.com/astaxie/beego/logs"
- "github.com/astaxie/beego/orm"
- "github.com/go-atomci/atomci/internal/core/pipelinemgr"
- "github.com/go-atomci/atomci/internal/middleware/log"
-)
-
-func initTaskTemplates() error {
-
- taskTmpls := []pipelinemgr.TaskTmplReq{
- {
- Name: "应用构建",
- Type: "build",
- Description: "用于应用构建",
- SubTask: []pipelinemgr.SubTask{
- {
- Index: 1,
- Type: "checkout",
- Name: "检出代码",
- },
- {
- Index: 2,
- Type: "compile",
- Name: "编译",
- },
- {
- Index: 3,
- Type: "build-image",
- Name: "制作镜像",
- },
- },
- },
- {
- Name: "应用部署",
- Type: "deploy",
- Description: "用于应用部署健康检查",
- },
- {
- Name: "人工卡点",
- Type: "manual",
- Description: "人工卡点",
- },
- }
-
- pipeline := pipelinemgr.NewPipelineManager()
-
- for _, item := range taskTmpls {
- _, err := pipeline.GetTaskTmplByName(item.Name)
- if err != nil {
- if err == orm.ErrNoRows {
- if err := pipeline.CreateTaskTmpl(&item, "admin"); err != nil {
- log.Log.Error("when init task template, occur error: %s", err.Error())
- continue
- }
- } else {
- logs.Warn("init task template occur error: %s", err.Error())
- continue
- }
- } else {
- log.Log.Debug("component type `%s` already exists, skip", item.Name)
- continue
- }
- }
- return nil
-}
diff --git a/internal/middleware/authorization.go b/internal/middleware/authorization.go
index 0fab74a5..36b9c8b6 100644
--- a/internal/middleware/authorization.go
+++ b/internal/middleware/authorization.go
@@ -27,7 +27,7 @@ import (
func Authorization(c *context.Context, username string) (bool, error) {
e, err := mycasbin.NewCasbin()
if err != nil {
- log.Log.Error("casbin new occur error: %v", err)
+ log.Log.Error("casbin new occur error: %v", err.Error())
return false, err
}
urlPath := c.Request.URL.Path
diff --git a/internal/middleware/casbin/model.go b/internal/middleware/casbin/model.go
deleted file mode 100644
index 6ef7c810..00000000
--- a/internal/middleware/casbin/model.go
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package mycasbin
-
-// CasbinRule ..
-type CasbinRule struct {
- ID uint `gorm:"primaryKey;autoIncrement"`
- Ptype string `gorm:"size:512"`
- V0 string `gorm:"size:512"`
- V1 string `gorm:"size:512"`
- V2 string `gorm:"size:512"`
- V3 string `gorm:"size:512"`
- V4 string `gorm:"size:512"`
- V5 string `gorm:"size:512"`
-}
-
-// TableName ..
-func (CasbinRule) TableName() string {
- return "casbin_rule"
-}
diff --git a/internal/middleware/casbin/mycasbin.go b/internal/middleware/casbin/mycasbin.go
index 6c55dfc5..4e3393f4 100644
--- a/internal/middleware/casbin/mycasbin.go
+++ b/internal/middleware/casbin/mycasbin.go
@@ -17,24 +17,33 @@ limitations under the License.
package mycasbin
import (
+ glog "log"
+ "sync"
+
"github.com/astaxie/beego"
"github.com/go-atomci/atomci/internal/middleware/log"
- glog "log"
- beegoormadapter "github.com/casbin/beego-orm-adapter/v3"
"github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/model"
+ beegoormadapter "github.com/go-atomci/atomci/pkg/beego-orm-adapter"
_ "github.com/go-sql-driver/mysql"
)
-var casbinObj *casbin.Enforcer
+var casbinadapter *beegoormadapter.Adapter
+var casbinadapterOnce sync.Once
+var casbinErr error
+
+// GetOrmer :set ormer singleton
+func GetAdapter() (*beegoormadapter.Adapter, error) {
+ casbinadapterOnce.Do(func() {
+ casbinadapter, casbinErr = initAdapter()
+ })
+ return casbinadapter, casbinErr
+}
// NewCasbin ..
func NewCasbin() (*casbin.Enforcer, error) {
-
- if casbinObj == nil {
-
- rbacModel, err := model.NewModelFromString(`
+ rbacModel, err := model.NewModelFromString(`
[request_definition]
r = sub, obj, act
@@ -52,25 +61,31 @@ e = some(where (p.eft == allow))
# m = g(r.sub, p.sub) && r.obj == p.obj && (r.act == p.act || p.act == "*") || r.sub == "admin"
m = g(r.sub, p.sub) && keyMatch2(r.obj,p.obj) && (r.act == p.act || p.act == "*") || r.sub == "admin"
`)
- if err != nil {
- glog.Fatalf("error: model: %s", err)
- }
-
- dsn := beego.AppConfig.String("DB::url")
- rbacPolicy, _ := beegoormadapter.NewAdapter("casbin", "mysql", dsn)
-
- e, err := casbin.NewEnforcer(rbacModel, rbacPolicy)
- if err != nil {
- log.Log.Error("casbin new enforcer error: %s", err.Error())
- return nil, err
- }
- if err := e.LoadPolicy(); err == nil {
- casbinObj = e
- return e, err
- }
- log.Log.Error("casbin rbac_model or policy init error, message: %v", err)
+ if err != nil {
+ glog.Fatalf("error: model: %s", err)
+ }
+ a, err := GetAdapter()
+ if err != nil {
+ return nil, err
+ }
+ e, err := casbin.NewEnforcer(rbacModel, a)
+ if err != nil {
+ log.Log.Error("casbin new enforcer error: %s", err.Error())
return nil, err
}
+ if err := e.LoadPolicy(); err != nil {
+ log.Log.Error("casbin rbac_model or policy init error, message: %v", err.Error())
+ return e, err
+ }
+ return e, nil
+}
- return casbinObj, nil
+func initAdapter() (*beegoormadapter.Adapter, error) {
+ dsn := beego.AppConfig.String("DB::url")
+ a, err := beegoormadapter.NewAdapter("casbin", "mysql", dsn)
+ if err != nil {
+ log.Log.Error("beego orm adapter error: %s", err.Error())
+ return nil, err
+ }
+ return a, nil
}
diff --git a/internal/migrations/migration20220101.go b/internal/migrations/migration20220101.go
new file mode 100644
index 00000000..5679be40
--- /dev/null
+++ b/internal/migrations/migration20220101.go
@@ -0,0 +1,101 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/astaxie/beego/orm"
+ "github.com/go-atomci/atomci/internal/middleware/log"
+)
+
+type Migration20220101 struct {
+}
+
+func (m Migration20220101) GetCreateAt() time.Time {
+ return time.Date(2022, 1, 1, 0, 0, 0, 0, time.Local)
+}
+
+func (m Migration20220101) Upgrade(ormer orm.Ormer) error {
+ tables := []string{
+ "sys_resource_type",
+ "sys_resource_operation",
+ "sys_resource_constraint",
+ "sys_user",
+ "sys_group",
+ "sys_group_user_rel",
+ "sys_group_user_constraint",
+ "sys_group_role",
+ "sys_group_role_user",
+ "sys_group_role_operation",
+ "sys_audit",
+ "sys_resource_router",
+ }
+
+ if err := setCreateAt(ormer, tables); err != nil {
+ log.Log.Error(err.Error())
+ return err
+ }
+ if err := setUpdateAt(ormer, tables); err != nil {
+ log.Log.Error(err.Error())
+ return err
+ }
+ return nil
+}
+
+func setCreateAt(ormer orm.Ormer, tables []string) error {
+ for _, table := range tables {
+ var count int
+ sql := `SELECT count(1) FROM INFORMATION_SCHEMA.Columns WHERE table_schema=DATABASE() AND table_name=?
+ AND column_name='create_at' AND COLUMN_DEFAULT='CURRENT_TIMESTAMP'`
+ if err := ormer.Raw(sql, table).QueryRow(&count); err != nil {
+ return err
+ }
+ if count == 0 {
+ sql = `alter table ` + table + ` modify column create_at datetime not null DEFAULT CURRENT_TIMESTAMP`
+ if _, err := ormer.Raw(sql).Exec(); err != nil {
+ return err
+ }
+ log.Log.Info(sql)
+ } else {
+ log.Log.Debug(fmt.Sprintf("table `%v` already alter create_at, skip", table))
+ }
+ }
+ return nil
+}
+
+func setUpdateAt(ormer orm.Ormer, tables []string) error {
+ for _, table := range tables {
+ var count int
+ sql := `SELECT count(1) FROM INFORMATION_SCHEMA.Columns WHERE table_schema=DATABASE() AND table_name=?
+ AND column_name='update_at' AND COLUMN_DEFAULT='CURRENT_TIMESTAMP' AND EXTRA='on update CURRENT_TIMESTAMP'`
+ if err := ormer.Raw(sql, table).QueryRow(&count); err != nil {
+ return err
+ }
+ if count == 0 {
+ sql = `alter table ` + table + ` modify column update_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP`
+ if _, err := ormer.Raw(sql).Exec(); err != nil {
+ return err
+ }
+ log.Log.Info(sql)
+ } else {
+ log.Log.Debug(fmt.Sprintf("table `%v` already alter update_at, skip", table))
+ }
+ }
+ return nil
+}
diff --git a/internal/migrations/migration20220309.go b/internal/migrations/migration20220309.go
new file mode 100644
index 00000000..e116113d
--- /dev/null
+++ b/internal/migrations/migration20220309.go
@@ -0,0 +1,63 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "strings"
+ "time"
+
+ "github.com/astaxie/beego/orm"
+)
+
+type Migration20220309 struct {
+}
+
+func (m Migration20220309) GetCreateAt() time.Time {
+ return time.Date(2022, 3, 9, 0, 0, 0, 0, time.Local)
+}
+
+func (m Migration20220309) Upgrade(ormer orm.Ormer) error {
+ _, err := ormer.Raw("UPDATE `sys_integrate_setting` SET `type`='registry' WHERE `type`='harbor';").Exec()
+ if err != nil {
+ return err
+ }
+
+ _, err = ormer.Raw("DROP PROCEDURE IF EXISTS `ModifyHarborToRegistry`;").Exec()
+ _, err = ormer.Raw(strings.ReplaceAll(`CREATE PROCEDURE <|SPIT|>ModifyHarborToRegistry<|SPIT|>()
+BEGIN
+ DECLARE HARBOREXISTS int DEFAULT 0;
+ DECLARE REGISTRYEXISTS int DEFAULT 0;
+ SELECT count(1) INTO @HARBOREXISTS FROM information_schema.COLUMNS WHERE TABLE_NAME='project_env' AND COLUMN_NAME='harbor';
+ SELECT count(1) INTO @REGISTRYEXISTS FROM information_schema.COLUMNS WHERE TABLE_NAME='project_env' AND COLUMN_NAME='registry';
+ IF @HARBOREXISTS>0 AND @REGISTRYEXISTS=0
+ THEN
+ ALTER TABLE <|SPIT|>project_env<|SPIT|> CHANGE COLUMN <|SPIT|>harbor<|SPIT|> <|SPIT|>registry<|SPIT|> bigint(20) NOT NULL DEFAULT 0;
+ ELSEIF @HARBOREXISTS>0 AND @REGISTRYEXISTS>0
+ THEN
+ UPDATE <|SPIT|>project_env<|SPIT|> SET <|SPIT|>registry<|SPIT|>=<|SPIT|>harbor<|SPIT|>;
+ ALTER TABLE <|SPIT|>project_env<|SPIT|> DROP COLUMN <|SPIT|>harbor<|SPIT|>;
+ END IF;
+END;`, "<|SPIT|>", "`")).Exec()
+
+ _, err = ormer.Raw("CALL `ModifyHarborToRegistry`;").Exec()
+ _, err = ormer.Raw("DROP PROCEDURE IF EXISTS `ModifyHarborToRegistry`;").Exec()
+
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/internal/migrations/migration20220324.go b/internal/migrations/migration20220324.go
new file mode 100644
index 00000000..66ac69a5
--- /dev/null
+++ b/internal/migrations/migration20220324.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "time"
+
+ "github.com/astaxie/beego/orm"
+ "github.com/go-atomci/atomci/internal/core/settings"
+)
+
+type Migration20220324 struct {
+}
+
+func (m Migration20220324) GetCreateAt() time.Time {
+ return time.Date(2022, 3, 24, 0, 0, 0, 0, time.Local)
+}
+
+func (m Migration20220324) Upgrade(ormer orm.Ormer) error {
+ pm := settings.NewSettingManager()
+ k8sSettings, err := pm.GetIntegrateSettings([]string{"kubernetes"})
+ if err != nil {
+ return err
+ }
+ for _, setting := range k8sSettings {
+ req := &setting.IntegrateSettingReq
+ cfg := req.Config.(*settings.KubeConfig)
+ if cfg.Type == "" {
+ cfg.Type = settings.KubernetesConfig
+ cfg.URL = ""
+ err = pm.UpdateIntegrateSetting(req, setting.ID)
+ if err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
diff --git a/internal/migrations/migration20220414.go b/internal/migrations/migration20220414.go
new file mode 100644
index 00000000..25d33029
--- /dev/null
+++ b/internal/migrations/migration20220414.go
@@ -0,0 +1,176 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/astaxie/beego/orm"
+ "github.com/go-atomci/atomci/internal/core/apps"
+ "github.com/go-atomci/atomci/internal/core/project"
+ "github.com/go-atomci/atomci/internal/core/settings"
+ "github.com/go-atomci/atomci/internal/middleware/log"
+ "github.com/go-atomci/atomci/utils"
+)
+
+type Migration20220414 struct {
+}
+
+func (m Migration20220414) GetCreateAt() time.Time {
+ return time.Date(2022, 4, 14, 0, 0, 0, 0, time.Local)
+}
+
+type repoServer struct {
+ ID int64 `orm:"column(id);"`
+ Type string `orm:"column(type);"`
+ BaseURL string `orm:"column(base_url);"`
+ User string `orm:"column(user);"`
+ Token string `orm:"column(token);"`
+ Password string `orm:"column(password);"`
+ CID int64 `orm:"column(cid);"`
+}
+
+type projectApp struct {
+ ID int64 `orm:"column(id)"`
+ Creator string `orm:"column(creator)"`
+ ProjectID int64 `orm:"column(project_id)"`
+ Name string `orm:"column(name)"`
+ FullName string `orm:"column(full_name)"`
+ Language string `orm:"column(language)"`
+ BranchName string `orm:"column(branch_name)"`
+ Path string `orm:"column(path)"`
+ RepoID int64 `orm:"column(repo_id)"`
+ CompileEnvID int64 `orm:"column(compile_env_id)"`
+ BuildPath string `orm:"column(build_path)"`
+ Dockerfile string `orm:"column(dockerfile)"`
+}
+
+func (m Migration20220414) Upgrade(ormer orm.Ormer) error {
+ // 01. migrate pub_repo_server into sys_integrate_setting table
+ // * save repo_id mapping into integrate_setting id
+ // 02. migrate pub_project_app into pub_scm_app
+ // * repo_id change to sys_integrate_setting id
+ // * pub_project_app add scm_id
+ // 03. clean pub_app_branch data
+ // 04. pub_project_app delete unused column
+
+ // 01.
+ var repoServerItems []repoServer
+ _, err := ormer.Raw("SELECT id,type,base_url,user,token,password,cid FROM pub_repo_server WHERE deleted=0;").QueryRows(&repoServerItems)
+ if err != nil {
+ if strings.Contains(err.Error(), " doesn't exist") {
+ return nil
+ }
+ return fmt.Errorf("select pub_repo_server: %s", err.Error())
+ }
+ log.Log.Debug("reposerver len: %v", len(repoServerItems))
+ repoItemsMapping, err := m.migrateRepoServerIntoIntegrateSetting(repoServerItems)
+ if err != nil {
+ return fmt.Errorf("repo items mappings, error: %s", err.Error())
+ }
+ log.Log.Debug("repoItems mapping item: %+v", repoItemsMapping)
+
+ // 02.
+ // get all project apps
+ var appsRes []projectApp
+ _, err = ormer.Raw("SELECT id,creator,project_id,name,full_name,language,branch_name,path,repo_id,compile_env_id,build_path,dockerfile FROM pub_project_app WHERE deleted=0;").QueryRows(&appsRes)
+ if err != nil {
+ return fmt.Errorf("select pub_project_app : %s", err.Error())
+ }
+ scmAppHander := apps.NewAppManager()
+ projectAppHander := project.NewProjectManager()
+ for _, projectApp := range appsRes {
+ log.Log.Debug("project app repo_id: %v", projectApp.RepoID)
+ item := apps.ScmAppReq{
+ Name: projectApp.Name,
+ CompileEnvID: projectApp.CompileEnvID,
+ Language: projectApp.Language,
+ Path: projectApp.Path,
+ RepoID: repoItemsMapping[projectApp.RepoID],
+ FullName: projectApp.FullName,
+ BranchName: projectApp.BranchName,
+ BuildPath: projectApp.BuildPath,
+ Dockerfile: projectApp.Dockerfile,
+ }
+ scmID, err := scmAppHander.CreateSCMApp(&item, projectApp.Creator)
+ if err != nil {
+ log.Log.Warn("migrate pub_scm_app, name: %s, occur error: %s, skip item", projectApp.Name, err.Error())
+ continue
+ }
+ log.Log.Debug("created scm id: %v", scmID)
+ req := project.ProjectAppUpdateReq{
+ ScmID: scmID,
+ }
+ if err := projectAppHander.UpdateProjectApp(projectApp.ProjectID, projectApp.ID, &req); err != nil {
+ log.Log.Warn("migrate pub_project_app, update scm_id into project app(%v), occur error: %s, skip item", projectApp.ID, err.Error())
+ continue
+ }
+ log.Log.Debug("project app id: %v, migrated succeed", projectApp.ID)
+ }
+ // 03
+ if _, err := ormer.Raw("delete from pub_app_branch;").Exec(); err != nil {
+ return err
+ }
+
+ // 04
+ return nil
+}
+
+func (m Migration20220414) migrateRepoServerIntoIntegrateSetting(items []repoServer) (map[int64]int64, error) {
+ resp := map[int64]int64{}
+ sm := settings.NewSettingManager()
+ for _, item := range items {
+ integrateSettingName := fmt.Sprintf("%v-%v", item.Type, utils.GenerateRandomstring(5))
+ req := settings.IntegrateSettingReq{
+ Name: integrateSettingName,
+ Type: item.Type,
+ Config: m.generateRepoConf(item),
+ }
+ if err := sm.CreateIntegrateSetting(&req, "admin"); err != nil {
+ log.Log.Warn("migrate repo_server: %v when create integrate error: %s", item.BaseURL, err.Error())
+ continue
+ }
+ scmIntegrateItem, err := sm.GetIntegrateSettingByName(integrateSettingName, item.Type)
+ if err != nil {
+ log.Log.Warn("migrate repo_server: %v when get integratesetting item error: %s", item.BaseURL, err.Error())
+ continue
+ }
+ resp[item.ID] = scmIntegrateItem.ID
+ }
+ return resp, nil
+}
+
+func (m Migration20220414) generateRepoConf(repoItem repoServer) (item interface{}) {
+ switch strings.ToLower(repoItem.Type) {
+ case "gitlab":
+ item = settings.ScmAuthConf{
+ User: repoItem.User,
+ ScmBaseConfig: settings.ScmBaseConfig{
+ URL: repoItem.BaseURL,
+ Token: repoItem.Token,
+ },
+ }
+ case "gitee", "gitea", "github":
+ item = settings.ScmBaseConfig{
+ URL: repoItem.BaseURL,
+ Token: repoItem.Token,
+ }
+ }
+ return item
+}
diff --git a/internal/migrations/migration20220415.go b/internal/migrations/migration20220415.go
new file mode 100644
index 00000000..30c321ef
--- /dev/null
+++ b/internal/migrations/migration20220415.go
@@ -0,0 +1,203 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "time"
+
+ "github.com/astaxie/beego/logs"
+ "github.com/astaxie/beego/orm"
+ "github.com/go-atomci/atomci/internal/core/pipelinemgr"
+ "github.com/go-atomci/atomci/internal/core/settings"
+ "github.com/go-atomci/atomci/internal/dao"
+ "github.com/go-atomci/atomci/internal/middleware/log"
+ "github.com/go-atomci/atomci/internal/models"
+)
+
+type Migration20220415 struct {
+}
+
+func (m Migration20220415) GetCreateAt() time.Time {
+ return time.Date(2022, 4, 15, 0, 0, 0, 0, time.Local)
+}
+
+func (m Migration20220415) Upgrade(ormer orm.Ormer) error {
+ // init component
+ _ = initComponent()
+
+ // init compile envs
+ _ = initCompileEnvs()
+
+ // init task tmpls
+ _ = initTaskTemplates()
+ return nil
+}
+
+type component struct {
+ Name string
+ Type string
+ Params string
+}
+
+// initComponent ..
+func initComponent() error {
+ components := []component{
+ {
+ Name: "人工卡点",
+ Type: "manual",
+ },
+ {
+ Name: "构建",
+ Type: "build",
+ },
+ {
+ Name: "部署",
+ Type: "deploy",
+ },
+ }
+ for _, comp := range components {
+ pipelineModel := dao.NewPipelineStageModel()
+ _, err := pipelineModel.GetFlowComponentByType(comp.Type)
+ if err != nil {
+ if err == orm.ErrNoRows {
+ component := &models.FlowComponent{
+ Addons: models.NewAddons(),
+ Name: comp.Name,
+ Type: comp.Type,
+ Params: comp.Params,
+ }
+ if err := pipelineModel.CreateFlowComponent(component); err != nil {
+ log.Log.Warn("when init component, occur error: %s", err.Error())
+ }
+ } else {
+ log.Log.Warn("when init component, occur error: %s", err.Error())
+ }
+ } else {
+ log.Log.Debug("component type `%s` already exists, skip", comp.Type)
+ }
+ }
+ return nil
+}
+
+var compileEnvs = []settings.CompileEnvReq{
+ {
+ Name: "jnlp",
+ Image: "colynn/jenkins-jnlp-agent:latest",
+ Description: "",
+ },
+ {
+ Name: "kaniko",
+ Image: "colynn/kaniko-executor:debug",
+ Command: "/bin/sh -c",
+ Args: "cat",
+ },
+ {
+ Name: "node",
+ Image: "node:12.12-alpine",
+ Description: "nodejs编译环境",
+ },
+ {
+ Name: "maven",
+ Image: "maven:3.8.2-openjdk-8",
+ Command: "/bin/sh -c",
+ Args: "cat",
+ },
+}
+
+func initCompileEnvs() error {
+ settingModel := dao.NewSysSettingModel()
+ for _, item := range compileEnvs {
+ _, err := settingModel.GetCompileEnvByName(item.Name)
+ if err != nil {
+ if err == orm.ErrNoRows {
+ component := &models.CompileEnv{
+ Addons: models.NewAddons(),
+ Name: item.Name,
+ Image: item.Image,
+ Command: item.Command,
+ Creator: "admin", // create use 'admin'
+ Args: item.Args,
+ Description: item.Description,
+ }
+ if err := settingModel.CreateCompileEnv(component); err != nil {
+ log.Log.Warn("when init compile env, occur error: %s", err.Error())
+ }
+ } else {
+ log.Log.Warn("init compile env occur error: %s", err.Error())
+ }
+ } else {
+ log.Log.Debug("init compile env `%s` already exists, skip", item.Name)
+ }
+ }
+ return nil
+}
+
+func initTaskTemplates() error {
+
+ taskTmpls := []pipelinemgr.TaskTmplReq{
+ {
+ Name: "应用构建",
+ Type: "build",
+ Description: "用于应用构建",
+ SubTask: []pipelinemgr.SubTask{
+ {
+ Index: 1,
+ Type: "checkout",
+ Name: "检出代码",
+ },
+ {
+ Index: 2,
+ Type: "compile",
+ Name: "编译",
+ },
+ {
+ Index: 3,
+ Type: "build-image",
+ Name: "制作镜像",
+ },
+ },
+ },
+ {
+ Name: "应用部署",
+ Type: "deploy",
+ Description: "用于应用部署健康检查",
+ },
+ {
+ Name: "人工卡点",
+ Type: "manual",
+ Description: "人工卡点",
+ },
+ }
+
+ pipeline := pipelinemgr.NewPipelineManager()
+
+ for _, item := range taskTmpls {
+ _, err := pipeline.GetTaskTmplByName(item.Name)
+ if err != nil {
+ if err == orm.ErrNoRows {
+ if err := pipeline.CreateTaskTmpl(&item, "admin"); err != nil {
+ log.Log.Error("when init task template, occur error: %s", err.Error())
+ }
+ } else {
+ logs.Warn("init task template occur error: %s", err.Error())
+ }
+ } else {
+ log.Log.Debug("init task template `%s` already exists, skip", item.Name)
+ }
+ }
+ return nil
+}
diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go
new file mode 100644
index 00000000..0b0056e9
--- /dev/null
+++ b/internal/migrations/migrations.go
@@ -0,0 +1,127 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrations
+
+import (
+ "os"
+ "sort"
+ "time"
+
+ "github.com/astaxie/beego/orm"
+ "github.com/go-atomci/atomci/internal/middleware/log"
+)
+
+type MigrationTypes []Migration
+
+// Migration db migration base interface
+type Migration interface {
+ GetCreateAt() time.Time
+ Upgrade(ormer orm.Ormer) error
+}
+
+// Len 排序三人组
+func (t MigrationTypes) Len() int {
+ return len(t)
+}
+
+// Less 排序三人组
+func (t MigrationTypes) Less(i, j int) bool {
+ return t[i].GetCreateAt().Before(t[j].GetCreateAt())
+}
+
+// Swap 排序三人组
+func (t MigrationTypes) Swap(i, j int) {
+ t[i], t[j] = t[j], t[i]
+}
+
+// initMigration db migration register
+func initMigration() {
+ migrationTypes := MigrationTypes{
+ new(Migration20220101),
+ new(Migration20220309),
+ new(Migration20220324),
+ new(Migration20220414),
+ new(Migration20220415),
+ }
+
+ migrateInTx(migrationTypes)
+}
+
+func migrateInTx(migrationTypes MigrationTypes) {
+ //升序
+ sort.Sort(migrationTypes)
+
+ //数据迁移(事务)
+ ormClient := orm.NewOrm()
+ last := getNewestData(ormClient)
+ tempLast := last
+ errRet := ormClient.Begin()
+ for _, m := range migrationTypes {
+ if m.GetCreateAt().After(last) {
+ errRet = m.Upgrade(ormClient)
+ if errRet != nil {
+ log.Log.Error("migrate: %v, upgrade error: %v", m.GetCreateAt(), errRet.Error())
+ break
+ }
+ }
+ tempLast = m.GetCreateAt()
+ }
+ errRet = updateNewestData(ormClient, tempLast)
+ if errRet != nil {
+ ormClient.Rollback()
+ } else {
+ ormClient.Commit()
+ }
+}
+
+func getNewestData(ormer orm.Ormer) time.Time {
+ sureCreateTable(ormer)
+ sql := `Select * From __dbmigration Limit 1`
+ var lastMigrationDate time.Time
+ ormer.Raw(sql).QueryRow(&lastMigrationDate)
+ if lastMigrationDate.IsZero() {
+ lastMigrationDate = time.Unix(0, 0)
+ }
+ return lastMigrationDate
+}
+
+func updateNewestData(ormer orm.Ormer, lastTime time.Time) error {
+ countSql := "Select count(*) from __dbmigration"
+ var count int
+ ormer.Raw(countSql).QueryRow(&count)
+
+ sql := "Update __dbmigration set last_migration_date=?"
+ if count == 0 {
+ sql = "Insert into __dbmigration(last_migration_date) values (?)"
+ }
+ _, err := ormer.Raw(sql, lastTime).Exec()
+ return err
+}
+
+func sureCreateTable(ormer orm.Ormer) {
+ ddl := `CREATE TABLE IF NOT EXISTS __dbmigration (
+ last_migration_date datetime DEFAULT CURRENT_TIMESTAMP
+ )`
+ ormer.Raw(ddl).Exec()
+}
+
+func Migrate() {
+ if len(os.Args) > 1 && os.Args[1][:5] == "-test" {
+ return
+ }
+ initMigration()
+}
diff --git a/internal/models/gitapp.go b/internal/models/gitapp.go
deleted file mode 100644
index 3816a268..00000000
--- a/internal/models/gitapp.go
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package models
-
-// GitApp ...
-type GitApp struct {
- Addons
- Name string `orm:"column(name);size(64)" json:"name"`
- Description string `orm:"column(description);size(256)" json:"description"`
- Department string `orm:"column(department);size(64)" json:"department"`
- Product string `orm:"column(product);size(64)" json:"product"`
- Language string `orm:"column(language);size(64)" json:"language"`
- Type string `orm:"column(type);size(64)" json:"type"`
- VcsType string `orm:"column(vcs_type);size(64)" json:"vcs_type"`
- Path string `orm:"column(path);size(256)" json:"path"`
- BuildPath string `orm:"column(build_path);size(256)" json:"build_path"`
- IsArranged bool `orm:"column(is_arranged);default(true)" json:"is_arranged"`
-}
-
-// TableName ...
-func (t *GitApp) TableName() string {
- return "pub_gitapp"
-}
-
-// TableUnique ...
-func (t *GitApp) TableUnique() [][]string {
- return [][]string{
- []string{"Name", "Department"},
- }
-}
-
-// AppBranch ...
-type AppBranch struct {
- Addons
- AppID int64 `orm:"column(app_id);" json:"app_id"`
- BranchName string `orm:"column(branch_name);size(64)" json:"branch_name"`
- Path string `orm:"column(path);size(256)" json:"path"`
-}
-
-// TableName ...
-func (t *AppBranch) TableName() string {
- return "pub_app_branch"
-}
-
-// RepoServer ..
-type RepoServer struct {
- Addons
- Type string `orm:"column(type);" json:"type"`
- BaseURL string `orm:"column(base_url);" json:"base_url"`
- User string `orm:"column(user);" json:"user"`
- Token string `orm:"column(Token);" json:"token"`
- Password string `orm:"column(Password);" json:"password"`
- CID int64 `orm:"column(cid);" json:"cid"`
-}
-
-// TableName ...
-func (t *RepoServer) TableName() string {
- return "pub_repo_server"
-}
diff --git a/internal/models/integrate.go b/internal/models/integrate.go
index 6ce99d3c..0a8dcaf4 100644
--- a/internal/models/integrate.go
+++ b/internal/models/integrate.go
@@ -37,7 +37,6 @@ func (t *IntegrateSetting) TableName() string {
}
func (t *IntegrateSetting) CryptoConfig(raw string) {
- t.crypto(raw)
t.Config = t.crypto(raw)
}
diff --git a/internal/models/models.go b/internal/models/models.go
index cdc7e700..99b11c3a 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -21,8 +21,6 @@ import (
"os"
"time"
- "github.com/go-atomci/atomci/internal/middleware/log"
-
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/go-sql-driver/mysql"
@@ -66,50 +64,6 @@ var (
tableNames []string
)
-func setCreateAt(tables []string) error {
- for _, table := range tables {
- var count int
- sql := `SELECT count(1) FROM INFORMATION_SCHEMA.Columns WHERE table_schema=DATABASE() AND table_name=?
- AND column_name='create_at' AND COLUMN_DEFAULT='CURRENT_TIMESTAMP'`
- ormer := orm.NewOrm()
- if err := ormer.Raw(sql, table).QueryRow(&count); err != nil {
- return err
- }
- if count == 0 {
- sql = `alter table ` + table + ` modify column create_at datetime not null DEFAULT CURRENT_TIMESTAMP`
- if _, err := ormer.Raw(sql).Exec(); err != nil {
- return err
- }
- log.Log.Info(sql)
- } else {
- log.Log.Debug(fmt.Sprintf("table `%v` already alter create_at, skip", table))
- }
- }
- return nil
-}
-
-func setUpdateAt(tables []string) error {
- for _, table := range tables {
- var count int
- sql := `SELECT count(1) FROM INFORMATION_SCHEMA.Columns WHERE table_schema=DATABASE() AND table_name=?
- AND column_name='update_at' AND COLUMN_DEFAULT='CURRENT_TIMESTAMP' AND EXTRA='on update CURRENT_TIMESTAMP'`
- ormer := orm.NewOrm()
- if err := ormer.Raw(sql, table).QueryRow(&count); err != nil {
- return err
- }
- if count == 0 {
- sql = `alter table ` + table + ` modify column update_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP`
- if _, err := ormer.Raw(sql).Exec(); err != nil {
- return err
- }
- log.Log.Info(sql)
- } else {
- log.Log.Debug(fmt.Sprintf("table `%v` already alter update_at, skip", table))
- }
- }
- return nil
-}
-
func initOrm() {
DatabaseURL := beego.AppConfig.String("DB::url")
DatabaseDebug, _ := beego.AppConfig.Bool("DB::debug")
@@ -167,10 +121,10 @@ func initOrm() {
new(Audit),
new(GatewayRouter),
+ new(ScmApp),
new(Project),
new(ProjectUser),
new(ProjectApp),
- new(RepoServer),
new(FlowComponent),
new(TaskTmpl),
@@ -193,32 +147,13 @@ func initOrm() {
orm.RunSyncdb("default", false, true)
- tables := []string{
- "sys_resource_type",
- "sys_resource_operation",
- "sys_resource_constraint",
- "sys_user",
- "sys_group",
- "sys_group_user_rel",
- "sys_group_user_constraint",
- "sys_group_role",
- "sys_group_role_user",
- "sys_group_role_operation",
- "sys_audit",
- "sys_resource_router",
- }
- if err := setCreateAt(tables); err != nil {
- log.Log.Error(err.Error())
- os.Exit(2)
- }
- if err := setUpdateAt(tables); err != nil {
- log.Log.Error(err.Error())
- os.Exit(2)
- }
}
// Init ...
-func init() {
+func InitDB() {
+ if len(os.Args) > 1 && os.Args[1][:5] == "-test" {
+ return
+ }
initOrm()
// orm.RunSyncdb("default", false, true)
}
diff --git a/internal/models/project.go b/internal/models/project.go
index c0453b6f..1390708c 100644
--- a/internal/models/project.go
+++ b/internal/models/project.go
@@ -108,15 +108,7 @@ type ProjectApp struct {
Addons
Creator string `orm:"column(creator);size(64);null" json:"creator"`
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
- Name string `orm:"column(name);size(64)" json:"name"`
- FullName string `orm:"column(full_name);size(64)" json:"full_name"`
- Language string `orm:"column(language);size(64)" json:"language"`
- BranchName string `orm:"column(branch_name);size(64)" json:"branch_name"`
- Path string `orm:"column(path);size(255)" json:"path"`
- RepoID int64 `orm:"column(repo_id)" json:"repo_id"`
- CompileEnvID int64 `orm:"column(compile_env_id);size(64)" json:"compile_env_id"`
- BuildPath string `orm:"column(build_path);size(64)" json:"build_path"`
- Dockerfile string `orm:"column(dockerfile);size(256)" json:"dockerfile"`
+ ScmID int64 `orm:"column(scm_id)" json:"scm_id"`
BranchHistoryList []string `orm:"-" json:"branch_history_list"`
}
diff --git a/internal/models/scmapp.go b/internal/models/scmapp.go
new file mode 100644
index 00000000..de092bf9
--- /dev/null
+++ b/internal/models/scmapp.go
@@ -0,0 +1,51 @@
+/*
+Copyright 2021 The AtomCI Group Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package models
+
+// ScmApp ...
+type ScmApp struct {
+ Addons
+ Creator string `orm:"column(creator);size(64);null" json:"creator"`
+ Name string `orm:"column(name);size(64)" json:"name"`
+ FullName string `orm:"column(full_name);size(64)" json:"full_name"`
+ Language string `orm:"column(language);size(64)" json:"language"`
+ BranchName string `orm:"column(branch_name);size(64)" json:"branch_name"`
+ Path string `orm:"column(path);size(255)" json:"path"`
+ RepoID int64 `orm:"column(repo_id)" json:"repo_id"`
+ CompileEnvID int64 `orm:"column(compile_env_id);size(64)" json:"compile_env_id"`
+ BuildPath string `orm:"column(build_path);size(64)" json:"build_path"`
+ Dockerfile string `orm:"column(dockerfile);size(256)" json:"dockerfile"`
+ BranchHistoryList []string `orm:"-" json:"branch_history_list"`
+}
+
+// TableName ..
+func (t *ScmApp) TableName() string {
+ return "pub_scm_app"
+}
+
+// AppBranch ...
+type AppBranch struct {
+ Addons
+ AppID int64 `orm:"column(app_id);" json:"app_id"`
+ BranchName string `orm:"column(branch_name);size(64)" json:"branch_name"`
+ Path string `orm:"column(path);size(256)" json:"path"`
+}
+
+// TableName ...
+func (t *AppBranch) TableName() string {
+ return "pub_app_branch"
+}
diff --git a/internal/routers/router.go b/internal/routers/router.go
index b8f0040c..d4cfe139 100644
--- a/internal/routers/router.go
+++ b/internal/routers/router.go
@@ -51,6 +51,7 @@ func RegisterRoutes() {
beego.NSRouter("/users", &api.UserController{}, "get:UserList;post:CreateUser"),
beego.NSRouter("/users/:user", &api.UserController{}, "get:GetUser;put:UpdateUser;delete:DeleteUser"),
+ beego.NSRouter("/users/:project_id/projectMemberByConstraint", &api.UserController{}, "get:GetProjectMemberByConstraint"),
beego.NSRouter("/users/:user/resources/:resourceType/constraints/values", &api.UserController{}, "get:GetUserResourceConstraintValues"),
beego.NSRouter("/groups", &api.GroupController{}, "get:GroupList"),
@@ -81,6 +82,7 @@ func RegisterRoutes() {
// Integrate Settings
beego.NSRouter("/integrate/settings", &api.IntegrateController{}, "get:GetIntegrateSettings;post:GetIntegrateSettingsByPagination"),
beego.NSRouter("/integrate/settings/create", &api.IntegrateController{}, "post:CreateIntegrateSetting"),
+ beego.NSRouter("/integrate/settings/scms", &api.IntegrateController{}, "get:GetSCMIntegrateSettings;post:GetSCMIntegrateSettingsByPagination"),
beego.NSRouter("/integrate/settings/:id", &api.IntegrateController{}, "put:UpdateIntegrateSetting;delete:DeleteIntegrateSetting"),
beego.NSRouter("/integrate/settings/verify", &api.IntegrateController{}, "post:VerifyIntegrateSetting"),
beego.NSRouter("/integrate/clusters", &api.IntegrateController{}, "get:GetClusterIntegrateSettings"),
@@ -89,14 +91,26 @@ func RegisterRoutes() {
beego.NSRouter("/integrate/compile_envs/create", &api.IntegrateController{}, "post:CreateCompileEnv"),
beego.NSRouter("/integrate/compile_envs/:id", &api.IntegrateController{}, "put:UpdateCompileEnv;delete:DeleteCompileEnv"),
- // Git Repository
- beego.NSRouter("/repos", &api.AppController{}, "get:GetRepos"),
+ // scm apps
beego.NSRouter("/repos/:repo_id/projects", &api.AppController{}, "post:GetGitProjectsByRepoID"),
+ beego.NSRouter("/apps/create", &api.AppController{}, "post:CreateSCMApp"),
+ beego.NSRouter("/apps", &api.AppController{}, "get:GetAllApps;post:GetAppsByPagination"),
+ beego.NSRouter("/apps/:app_id", &api.AppController{}, "get:ScmAppInfo;put:UpdateScmApp;delete:DeleteScmApp"),
+ beego.NSRouter("/apps/:app_id/syncBranches", &api.AppController{}, "post:SyncAppBranches"),
+ beego.NSRouter("/apps/:app_id/branches", &api.AppController{}, "post:GetAppBranches"),
// Project
beego.NSRouter("/projects", &api.ProjectController{}, "post:ProjectList"),
beego.NSRouter("/projects/create", &api.ProjectController{}, "post:Create"),
beego.NSRouter("/projects/:project_id", &api.ProjectController{}, "put:Update;delete:Delete;get:GetProject"),
+
+ // Project App
+ beego.NSRouter("/projects/:project_id/apps/create", &api.ProjectController{}, "post:CreateApp"),
+ beego.NSRouter("/projects/:project_id/apps", &api.ProjectController{}, "get:GetApps;post:GetAppsByPagination"),
+ beego.NSRouter("/projects/:project_id/apps/:app_id/:env_id/arrange", &api.AppController{}, "get:GetArrange;post:SetArrange"),
+ beego.NSRouter("/arrange/yaml/parser", &api.AppController{}, "post:ParseArrangeYaml"),
+ beego.NSRouter("/projects/:project_id/apps/:project_app_id", &api.ProjectController{}, "put:UpdateProjectApp;delete:DeleteProjectApp"),
+
beego.NSRouter("/projects/:project_id/checkProjectOwner", &api.ProjectController{}, "post:CheckProjetCreator"),
beego.NSRouter("/projects/:project_id/clusters/:cluster/apps", &api.ProjectController{}, "post:GetAppserviceList"),
beego.NSRouter("/clusters/:cluster/namespaces/:namespace/apps/:app", &api.ProjectController{}, "get:AppInspect;delete:AppDelete"),
@@ -119,16 +133,6 @@ func RegisterRoutes() {
beego.NSRouter("/projects/:project_id/pipelines", &api.ProjectController{}, "get:GetProjectPipelines;post:GetPipelinesByPagination"),
beego.NSRouter("/projects/:project_id/pipelines/create", &api.ProjectController{}, "post:CreatePipeline"),
beego.NSRouter("/projects/:project_id/pipelines/:id", &api.ProjectController{}, "get:GetProjectPipeline;put:UpdatePipelineConfig;delete:DeleteProjectPipeline"),
-
- // Project App
- beego.NSRouter("/projects/:project_id/apps/create", &api.ProjectController{}, "post:CreateApp"),
- beego.NSRouter("/projects/:project_id/apps", &api.ProjectController{}, "get:GetApps;post:GetAppsByPagination"),
- beego.NSRouter("/projects/:project_id/apps/:app_id/:env_id/arrange", &api.AppController{}, "get:GetArrange;post:SetArrange"),
- beego.NSRouter("/arrange/yaml/parser", &api.AppController{}, "post:ParseArrangeYaml"),
- beego.NSRouter("/projects/:project_id/apps/:app_id/branches", &api.AppController{}, "post:GetAppBranches"),
- beego.NSRouter("/projects/:project_id/apps/:app_id/syncBranches", &api.AppController{}, "post:SyncAppBranches"),
- beego.NSRouter("/projects/:project_id/apps/:project_app_id", &api.ProjectController{}, "get:ProjectAppInfo;patch:SwitchProjectBranch;put:UpdateProjectApp;delete:DeleteProjectApp"),
-
// Project stats
beego.NSRouter("/projects/:project_id/publish/stats", &api.PipelineController{}, "post:GetPublishStats"),
diff --git a/pkg/beego-orm-adapter/adapter.go b/pkg/beego-orm-adapter/adapter.go
new file mode 100644
index 00000000..bb81fd15
--- /dev/null
+++ b/pkg/beego-orm-adapter/adapter.go
@@ -0,0 +1,267 @@
+// Copyright 2017 The casbin Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package beegoormadapter
+
+import (
+ "fmt"
+ "runtime"
+
+ "github.com/astaxie/beego/orm"
+ "github.com/casbin/casbin/v2/model"
+ "github.com/casbin/casbin/v2/persist"
+)
+
+type CasbinRule struct {
+ Id int
+ Ptype string
+ V0 string
+ V1 string
+ V2 string
+ V3 string
+ V4 string
+ V5 string
+}
+
+func init() {
+ orm.RegisterModel(new(CasbinRule))
+}
+
+const (
+ defaultTableName = "casbin_rule"
+)
+
+// Adapter represents the Xorm adapter for policy storage.
+type Adapter struct {
+ driverName string
+ dataSourceName string
+ dataSourceAlias string
+ tableName string
+ dbSpecified bool
+ o orm.Ormer
+}
+
+// finalizer is the destructor for Adapter.
+func finalizer(a *Adapter) {
+}
+
+// NewAdapter is the constructor for Adapter.
+// dataSourceAlias: Database alias. ORM will use it to switch database.
+// driverName: database driverName.
+// dataSourceName: connection string
+func NewAdapter(dataSourceAlias, driverName, dataSourceName string) (*Adapter, error) {
+ a := &Adapter{}
+ a.driverName = driverName
+ a.dataSourceName = dataSourceName
+ a.dataSourceAlias = dataSourceAlias
+ a.tableName = defaultTableName
+
+ err := a.open()
+
+ if err != nil {
+ return nil, err
+ }
+
+ // Call the destructor when the object is released.
+ runtime.SetFinalizer(a, finalizer)
+
+ return a, nil
+}
+
+func (a *Adapter) registerDataBase(aliasName, driverName, dataSource string, params ...int) error {
+ err := orm.RegisterDataBase(aliasName, driverName, dataSource, params...)
+ return err
+}
+
+func (a *Adapter) open() error {
+ var err error
+
+ err = a.registerDataBase(a.dataSourceAlias, a.driverName, a.dataSourceName)
+ if err != nil {
+ return err
+ }
+
+ a.o = orm.NewOrm()
+ err = a.o.Using(a.dataSourceAlias)
+ if err != nil {
+ return err
+ }
+
+ err = a.createTable()
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (a *Adapter) close() {
+ a.o = nil
+}
+
+func (a *Adapter) createTable() error {
+ return orm.RunSyncdb(a.dataSourceAlias, false, false)
+}
+
+func (a *Adapter) dropTable() error {
+ _, err := a.o.Raw(fmt.Sprintf("DROP TABLE IF EXISTS %v;", a.tableName)).Exec()
+ return err
+}
+
+func loadPolicyLine(line CasbinRule, model model.Model) {
+ lineText := line.Ptype
+ if line.V0 != "" {
+ lineText += ", " + line.V0
+ }
+ if line.V1 != "" {
+ lineText += ", " + line.V1
+ }
+ if line.V2 != "" {
+ lineText += ", " + line.V2
+ }
+ if line.V3 != "" {
+ lineText += ", " + line.V3
+ }
+ if line.V4 != "" {
+ lineText += ", " + line.V4
+ }
+ if line.V5 != "" {
+ lineText += ", " + line.V5
+ }
+
+ persist.LoadPolicyLine(lineText, model)
+}
+
+// LoadPolicy loads policy from database.
+func (a *Adapter) LoadPolicy(model model.Model) error {
+ var lines []CasbinRule
+ _, err := a.o.QueryTable("casbin_rule").All(&lines)
+ if err != nil {
+ return err
+ }
+
+ for _, line := range lines {
+ loadPolicyLine(line, model)
+ }
+
+ return nil
+}
+
+func savePolicyLine(ptype string, rule []string) CasbinRule {
+ line := CasbinRule{}
+
+ line.Ptype = ptype
+ if len(rule) > 0 {
+ line.V0 = rule[0]
+ }
+ if len(rule) > 1 {
+ line.V1 = rule[1]
+ }
+ if len(rule) > 2 {
+ line.V2 = rule[2]
+ }
+ if len(rule) > 3 {
+ line.V3 = rule[3]
+ }
+ if len(rule) > 4 {
+ line.V4 = rule[4]
+ }
+ if len(rule) > 5 {
+ line.V5 = rule[5]
+ }
+
+ return line
+}
+
+// SavePolicy saves policy to database.
+func (a *Adapter) SavePolicy(model model.Model) error {
+ err := a.dropTable()
+ if err != nil {
+ return err
+ }
+
+ err = a.createTable()
+ if err != nil {
+ return err
+ }
+
+ var lines []CasbinRule
+
+ for ptype, ast := range model["p"] {
+ for _, rule := range ast.Policy {
+ line := savePolicyLine(ptype, rule)
+ lines = append(lines, line)
+ }
+ }
+
+ for ptype, ast := range model["g"] {
+ for _, rule := range ast.Policy {
+ line := savePolicyLine(ptype, rule)
+ lines = append(lines, line)
+ }
+ }
+
+ _, err = a.o.InsertMulti(len(lines), lines)
+ return err
+}
+
+// AddPolicy adds a policy rule to the storage.
+func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error {
+ line := savePolicyLine(ptype, rule)
+ _, err := a.o.Insert(&line)
+ return err
+}
+
+// RemovePolicy removes a policy rule from the storage.
+func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error {
+ line := savePolicyLine(ptype, rule)
+ _, err := a.o.Delete(&line, "ptype", "v0", "v1", "v2", "v3", "v4", "v5")
+ return err
+}
+
+// RemoveFilteredPolicy removes policy rules that match the filter from the storage.
+func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {
+ line := CasbinRule{}
+
+ line.Ptype = ptype
+ filter := []string{}
+ filter = append(filter, "ptype")
+ if fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {
+ line.V0 = fieldValues[0-fieldIndex]
+ filter = append(filter, "v0")
+ }
+ if fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {
+ line.V1 = fieldValues[1-fieldIndex]
+ filter = append(filter, "v1")
+ }
+ if fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {
+ line.V2 = fieldValues[2-fieldIndex]
+ filter = append(filter, "v2")
+ }
+ if fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {
+ line.V3 = fieldValues[3-fieldIndex]
+ filter = append(filter, "v3")
+ }
+ if fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {
+ line.V4 = fieldValues[4-fieldIndex]
+ filter = append(filter, "v4")
+ }
+ if fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {
+ line.V5 = fieldValues[5-fieldIndex]
+ filter = append(filter, "v5")
+ }
+
+ _, err := a.o.Delete(&line, filter...)
+ return err
+}
diff --git a/pkg/kube/clientset.go b/pkg/kube/clientset.go
index 28a9d08d..d40fb24b 100644
--- a/pkg/kube/clientset.go
+++ b/pkg/kube/clientset.go
@@ -17,53 +17,38 @@ limitations under the License.
package kube
import (
- "sync"
-
+ "github.com/go-atomci/atomci/internal/core/settings"
"k8s.io/client-go/kubernetes"
+ "k8s.io/client-go/rest"
+ "k8s.io/client-go/tools/clientcmd"
)
-var (
- clusterClientsetMapMutex sync.RWMutex
- clusterClientsetMap = make(map[string]kubernetes.Interface)
-)
-
-func findClientset(cluster string) (client kubernetes.Interface, ok bool) {
- clusterClientsetMapMutex.RLock()
- defer clusterClientsetMapMutex.RUnlock()
- client, ok = clusterClientsetMap[cluster]
- return client, ok
-}
+func GetClientset(cluster string) (client kubernetes.Interface, cfg *rest.Config, err error) {
-func newClientset(cluster string) (client kubernetes.Interface, err error) {
- var ok bool
- clusterClientsetMapMutex.Lock()
- defer clusterClientsetMapMutex.Unlock()
- client, ok = clusterClientsetMap[cluster]
- if !ok {
- client, err = clientsetProvider(cluster)
- if err == nil {
- clusterClientsetMap[cluster] = client
- }
+ pm := settings.NewSettingManager()
+ resp, err := pm.GetIntegrateSettingByName(cluster, settings.KubernetesType)
+ if err != nil {
+ return nil, nil, err
}
- return client, err
+ return buildK8sClient(resp.IntegrateSettingReq.Config.(*settings.KubeConfig))
}
-func GetClientset(cluster string) (client kubernetes.Interface, err error) {
- var ok bool
- client, ok = findClientset(cluster)
- if !ok {
- client, err = newClientset(cluster)
+func buildK8sClient(kube *settings.KubeConfig) (client kubernetes.Interface, cfg *rest.Config, err error) {
+ var k8sConfig *rest.Config
+ switch kube.Type {
+ case settings.KubernetesConfig:
+ k8sConfig, err = clientcmd.RESTConfigFromKubeConfig([]byte(kube.Conf))
+ if err != nil {
+ return nil, nil, err
+ }
+ case settings.KubernetesToken:
+ k8sConfig = &rest.Config{
+ BearerToken: kube.Conf,
+ TLSClientConfig: rest.TLSClientConfig{Insecure: true},
+ Host: kube.URL,
+ }
}
- return client, err
-}
-func UpdateClientset(cluster string) (client kubernetes.Interface, err error) {
- clusterClientsetMapMutex.Lock()
- defer clusterClientsetMapMutex.Unlock()
- client, err = clientsetProvider(cluster)
- if err != nil {
- return
- }
- clusterClientsetMap[cluster] = client
- return
+ clientSet, err := kubernetes.NewForConfig(k8sConfig)
+ return clientSet, k8sConfig, err
}
diff --git a/pkg/kube/kube.go b/pkg/kube/kube.go
deleted file mode 100644
index df2bb2ef..00000000
--- a/pkg/kube/kube.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright 2021 The AtomCI Group Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kube
-
-import (
- "path"
-
- "github.com/astaxie/beego"
- "github.com/astaxie/beego/config"
- "k8s.io/client-go/kubernetes"
- "k8s.io/client-go/tools/clientcmd"
-)
-
-var clientsetProvider func(cluster string) (kubernetes.Interface, error)
-
-var appConfigProvider func() config.Configer
-
-func Init() {
- clientsetProvider = func(cluster string) (kubernetes.Interface, error) {
- configPath := path.Join(beego.AppConfig.String("k8s::configPath"), cluster)
- config, err := clientcmd.BuildConfigFromFlags("", configPath)
-
- if err != nil {
- return nil, err
- }
- return kubernetes.NewForConfig(config)
- }
-
- appConfigProvider = func() config.Configer {
- return beego.AppConfig
- }
-}
diff --git a/utils/utils.go b/utils/utils.go
index 61a8a8f2..cf3dd243 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -55,6 +55,10 @@ func MakeToken() string {
return token
}
+func GenerateRandomstring(length int) string {
+ return string(Krand(length, KC_RAND_KIND_ALL))
+}
+
// Contains ..
func Contains(s []string, e string) bool {
for _, a := range s {
diff --git a/utils/utils_test.go b/utils/utils_test.go
index 61b8da77..6f52fd90 100644
--- a/utils/utils_test.go
+++ b/utils/utils_test.go
@@ -8,7 +8,7 @@ import (
)
func TestAesCrypto(t *testing.T) {
- crypted := base64.StdEncoding.EncodeToString(AesEny([]byte("Hello")))
- log.Printf("%s", crypted)
- assert.NotEmpty(t, crypted)
+ encrypted := base64.StdEncoding.EncodeToString(AesEny([]byte("Hello")))
+ log.Printf("%s", encrypted)
+ assert.NotEmpty(t, encrypted)
}
diff --git a/utils/uuid_test.go b/utils/uuid_test.go
new file mode 100644
index 00000000..fed8872a
--- /dev/null
+++ b/utils/uuid_test.go
@@ -0,0 +1,12 @@
+package utils
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+func Test_NEWUUID_SHOULD_NOT_EMPTY(t *testing.T) {
+ uuid := NewUUID()
+
+ assert.NotEmpty(t, uuid)
+}
diff --git a/web/src/api/backend.js b/web/src/api/backend.js
index 8356c2f1..ac408983 100644
--- a/web/src/api/backend.js
+++ b/web/src/api/backend.js
@@ -350,10 +350,6 @@ const backendAPI = {
getProjectApp(id, cb) {
Package.httpMethods('get', `/atomci/api/v1/projects/${id}/apps`, cb);
},
- // 获得应用仓库列表
- getWarehouse(body, cb) {
- Package.httpMethods('post', '/atomci/api/v1/apps', cb, body);
- },
// 关联应用
postWarehouse(body, cb) {
Package.httpMethods('post', '/atomci/api/v1/apps/create', cb, body);
@@ -374,6 +370,11 @@ const backendAPI = {
getUserList(cb) {
Package.httpMethods('get', '/atomci/api/v1/users', cb);
},
+ // 获得项目成员列表数据
+ projectMemberByConstraint(id,cb) {
+ Package.httpMethods('get', `/atomci/api/v1/users/${id}/projectMemberByConstraint`, cb);
+ },
+
// 创建用户
addUser(body, cb) {
Package.httpMethods('post', '/atomci/api/v1/users', cb, body);
@@ -496,7 +497,7 @@ const backendAPI = {
},
// 添加项目应用模块
addProjectApp(id, body, cb) {
- Package.httpMethods('post', `/atomci/api/v1/projects/${id}/apps`, cb, body);
+ Package.httpMethods('post', `/atomci/api/v1/projects/${id}/apps/create`, cb, body);
},
// 删除项目应用模块
delProjectApp(id, projectAppId, cb) {
@@ -506,10 +507,6 @@ const backendAPI = {
updateProjectApp(id, projectAppId, body, cb) {
Package.httpMethods('put', `/atomci/api/v1/projects/${id}/apps/${projectAppId}`, cb, body);
},
- // 同步远程分支
- synBranch(appID, cb) {
- Package.httpMethods('post', `/atomci/api/v1/apps/${appID}/syncBranches`, cb);
- },
// 获得部门列表
getBus(cb) {
@@ -713,8 +710,8 @@ const backendAPI = {
getIntegrateSettings(body, cb) {
Package.httpMethods('post', '/atomci/api/v1/integrate/settings', cb, body);
},
- getStagesAll(cb) {
- Package.httpMethods('get', '/atomci/api/v1/integrate/settings', cb);
+ getSCMIntegrateSettings(body, cb) {
+ Package.httpMethods('post', '/atomci/api/v1/integrate/settings/scms', cb, body);
},
AddIntegrateSetting(body,cb) {
Package.httpMethods('post', '/atomci/api/v1/integrate/settings/create', cb, body);
@@ -862,19 +859,34 @@ const backendAPI = {
Package.httpMethods('delete', `/atomci/api/v1/projects/${projectId}/pipelines/${stepId}`, cb);
},
// 应用列表
+ getScmApps(body, cb) {
+ Package.httpMethods('post', `/atomci/api/v1/apps`, cb, body);
+ },
+ getAllScmApps(cb) {
+ Package.httpMethods('get', `/atomci/api/v1/apps`, cb);
+ },
+ // 获取单个应用详情
+ getScmAppDetail(appID, cb) {
+ Package.httpMethods('get', `/atomci/api/v1/apps/${appID}`, cb);
+ },
+ updateScmAppInfo(appId, body, cb) {
+ Package.httpMethods('put', `/atomci/api/v1/apps/${appId}`, cb, body);
+ },
+ delScmApp(scmAppID, cb) {
+ Package.httpMethods('delete', `/atomci/api/v1/apps/${scmAppID}`, cb);
+ },
+ asyncBranch(app_id, cb) {
+ Package.httpMethods('post', `/atomci/api/v1/apps/${app_id}/syncBranches`, cb);
+ },
+ getScmBranch(app_id, body, cb) {
+ Package.httpMethods('post', `/atomci/api/v1/apps/${app_id}/branches`, cb, body);
+ },
getApp(projectId, body, cb) {
Package.httpMethods('post', `/atomci/api/v1/projects/${projectId}/apps`, cb, body);
},
getAppAll(projectId, cb) {
Package.httpMethods('get', `/atomci/api/v1/projects/${projectId}/apps`, cb);
},
- appDialogBranch(repo_id, code_id, cb, body, errCb) {
- Package.httpMethods('get', `/atomci/api/v1/repos/${repo_id}/projects/${code_id}/branches`, cb, body, errCb);
- },
- // 获取单个代码仓库详情
- getAppDetail(projectId, appID, cb) {
- Package.httpMethods('get', `/atomci/api/v1/projects/${projectId}/apps/${appID}`, cb);
- },
updateAppInfo(projectId, appId, body, cb) {
Package.httpMethods('put', `/atomci/api/v1/projects/${projectId}/apps/${appId}`, cb, body);
},
@@ -882,25 +894,19 @@ const backendAPI = {
changeBranch(id, projectAppId, body, cb) {
Package.httpMethods('patch', `/atomci/api/v1/projects/${id}/apps/${projectAppId}`, cb, body);
},
- getProjectBranch(project_id, app_id, body, cb) {
- Package.httpMethods('post', `/atomci/api/v1/projects/${project_id}/apps/${app_id}/branches`, cb, body);
- },
createBranch(project_id, body, cb) {
Package.httpMethods('post', `/atomci/api/v1/projects/${project_id}/apps/branches`, cb, body);
},
- asyncBranch(project_id, app_id, cb) {
- Package.httpMethods('post', `/atomci/api/v1/projects/${project_id}/apps/${app_id}/syncBranches`, cb);
- },
- //新增应用模块
- getRepos(project_id, cb) {
- Package.httpMethods('get', `/atomci/api/v1/repos?project_id=${project_id}`, cb);
+ //获取集成的代码源
+ getIntegrateRepos(cb) {
+ Package.httpMethods('get', `/atomci/api/v1/integrate/settings/scms`, cb);
},
- getReposList(repo_id, project_id, body, cb, errcb) {
- Package.httpMethods('post', `/atomci/api/v1/repos/${repo_id}/projects?project_id=${project_id}`, cb, body, errcb);
+ getReposList(repo_id, cb, errcb) {
+ Package.httpMethods('post', `/atomci/api/v1/repos/${repo_id}/projects`, cb, errcb);
},
//新增
- addAppPro(project_id, body, cb) {
- Package.httpMethods('post', `/atomci/api/v1/projects/${project_id}/apps/create`, cb, body);
+ addScmAppPro(body, cb) {
+ Package.httpMethods('post', `/atomci/api/v1/apps/create`, cb, body);
},
//应用编排
getProjectArrange(project_id, app_id, arrange_env, cb) {
diff --git a/web/src/components/Breadcrumb/index.vue b/web/src/components/Breadcrumb/index.vue
index ccc633a7..a5597b9e 100644
--- a/web/src/components/Breadcrumb/index.vue
+++ b/web/src/components/Breadcrumb/index.vue
@@ -36,8 +36,6 @@ export default {
let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0]
- // console.log('xxxx breadcrumb: ')
- // console.log(first, first.name)
const routerName = first.name
if (routerName.startsWith('project') && routerName !== 'projects') {
matched = [{ path: '/project', meta: { title: '我的项目' }}].concat(matched)
diff --git a/web/src/components/utils/user/UserConstraints.vue b/web/src/components/utils/user/UserConstraints.vue
index 23774586..39c187d7 100644
--- a/web/src/components/utils/user/UserConstraints.vue
+++ b/web/src/components/utils/user/UserConstraints.vue
@@ -186,12 +186,10 @@ export default {
dataValue.push(item.value);
});
if (this.isEdit) {
- // TODO: use default group system
backend.putUserConstraintsItem("system", this.$route.params.user, this.form.constraint, dataValue, () => {
successCallBack();
});
} else {
- // TODO: use default group system
backend.postUserConstraints("system", this.$route.params.user, this.form.constraint, dataValue, () => {
successCallBack();
});
diff --git a/web/src/components/view/UserDetail.vue b/web/src/components/view/UserDetail.vue
index 0c125899..a1faa322 100644
--- a/web/src/components/view/UserDetail.vue
+++ b/web/src/components/view/UserDetail.vue
@@ -85,7 +85,6 @@ export default {
},
getList() {
if (this.$props.isUser) {
- // TODO: group's name use system , tmp
backend.getGroupUserRole("system", this.$route.params.user, (data) => {
if (data) {
this.curList = data.map((item) => {
diff --git a/web/src/i18n/lang/zh-CN.js b/web/src/i18n/lang/zh-CN.js
index a251c218..a60a61d0 100644
--- a/web/src/i18n/lang/zh-CN.js
+++ b/web/src/i18n/lang/zh-CN.js
@@ -53,7 +53,7 @@ export default {
projectDetails: '项目详情',
basicInfo: '基础信息',
appModules: '代码仓库',
- branchManage: '分支信息',
+ details: '详情',
releaseBran: '构建分支',
buildCompile: '构建命令',
branchName: '分支名称',
diff --git a/web/src/layout/components/Navbar.vue b/web/src/layout/components/Navbar.vue
index ea901f3c..70026200 100644
--- a/web/src/layout/components/Navbar.vue
+++ b/web/src/layout/components/Navbar.vue
@@ -101,7 +101,8 @@ body > .el-menu--horizontal .el-menu-item:not(.is-disabled):not(:first-child):ho