diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
index cdc0aa42843..75a8fc5c6fe 100644
--- a/.github/workflows/frontend.yml
+++ b/.github/workflows/frontend.yml
@@ -5,7 +5,7 @@ name: Frontend CI
on:
push:
- branches: [master]
+ branches: ["*"]
paths:
- "src/frontend/**"
pull_request:
diff --git a/docs/overview/db/devops_ci_artifactory.md b/docs/overview/db/devops_ci_artifactory.md
index aa233af1dff..b13839df9a4 100644
--- a/docs/overview/db/devops_ci_artifactory.md
+++ b/docs/overview/db/devops_ci_artifactory.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_artifactory
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_artifactory 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_auth.md b/docs/overview/db/devops_ci_auth.md
index a3b30e4d45c..ae8fd164cb8 100644
--- a/docs/overview/db/devops_ci_auth.md
+++ b/docs/overview/db/devops_ci_auth.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_auth
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_auth 的数据库文档
| 表名 | 说明 |
@@ -27,8 +27,12 @@
| T_AUTH_OAUTH2_SCOPE | 授权范围表 |
| T_AUTH_OAUTH2_SCOPE_OPERATION | 授权操作信息表 |
| T_AUTH_RESOURCE | 资源表 |
+| T_AUTH_RESOURCE_AUTHORIZATION | 资源授权管理表 |
| T_AUTH_RESOURCE_GROUP | 资源关联用户组表 |
+| T_AUTH_RESOURCE_GROUP_APPLY | 用户组申请记录表 |
| T_AUTH_RESOURCE_GROUP_CONFIG | 资源用户组配置表 |
+| T_AUTH_RESOURCE_GROUP_MEMBER | 资源组成员 |
+| T_AUTH_RESOURCE_SYNC | 同步 IAM 资源 |
| T_AUTH_RESOURCE_TYPE | 权限资源类型表 |
| T_AUTH_STRATEGY | 权限策略表 |
| T_AUTH_TEMPORARY_VERIFY_RECORD | 迁移-鉴权记录表 |
@@ -375,6 +379,25 @@
| 11 | CREATE_USER | varchar | 64 | 0 | N | N | | 创建者 |
| 12 | UPDATE_USER | varchar | 64 | 0 | N | N | | 修改人 |
+**表名:** T_AUTH_RESOURCE_AUTHORIZATION
+
+**说明:** 资源授权管理表
+
+**数据列:**
+
+| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| 1 | ID | bigint | 20 | 0 | N | Y | | 主键 ID |
+| 2 | PROJECT_CODE | varchar | 32 | 0 | N | N | | 项目 ID |
+| 3 | RESOURCE_TYPE | varchar | 32 | 0 | N | N | | 资源类型 |
+| 4 | RESOURCE_CODE | varchar | 255 | 0 | N | N | | 资源 ID |
+| 5 | RESOURCE_NAME | varchar | 255 | 0 | N | N | | 资源名 |
+| 6 | HANDOVER_FROM | varchar | 64 | 0 | N | N | | 授予人 |
+| 7 | HANDOVER_FROM_CN_NAME | varchar | 64 | 0 | N | N | | 授予人中文名称 |
+| 8 | HANDOVER_TIME | timestamp | 19 | 0 | N | N | CURRENT_TIMESTAMP | 授予时间 |
+| 9 | CREATE_TIME | timestamp | 19 | 0 | Y | N | CURRENT_TIMESTAMP | 创建时间 |
+| 10 | UPDATE_TIME | timestamp | 19 | 0 | Y | N | CURRENT_TIMESTAMP | 更新时间 |
+
**表名:** T_AUTH_RESOURCE_GROUP
**说明:** 资源关联用户组表
@@ -395,6 +418,25 @@
| 10 | RELATION_ID | varchar | 32 | 0 | N | N | | 关联的 IAM 组 ID |
| 11 | CREATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 创建时间 |
| 12 | UPDATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
+| 13 | DESCRIPTION | varchar | 512 | 0 | Y | N | | 用户组描述 |
+| 14 | IAM_TEMPLATE_ID | int | 10 | 0 | Y | N | | 人员模板 ID |
+
+**表名:** T_AUTH_RESOURCE_GROUP_APPLY
+
+**说明:** 用户组申请记录表
+
+**数据列:**
+
+| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| 1 | ID | bigint | 20 | 0 | N | Y | | 主键 ID |
+| 2 | PROJECT_CODE | varchar | 64 | 0 | N | N | | 项目 ID |
+| 3 | MEMBER_ID | varchar | 64 | 0 | N | N | | 成员 ID |
+| 4 | IAM_GROUP_ID | int | 10 | 0 | N | N | | IAM 组 ID |
+| 5 | STATUS | int | 10 | 0 | Y | N | 0 | 状态,0-审批中,1-审批成功,2-审批超时 |
+| 6 | NUMBER_OF_CHECKS | int | 10 | 0 | Y | N | 0 | 检查次数,用于同步组数据 |
+| 7 | CREATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 创建时间 |
+| 8 | UPDATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
**表名:** T_AUTH_RESOURCE_GROUP_CONFIG
@@ -416,6 +458,42 @@
| 10 | CREATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 创建时间 |
| 11 | UPDATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
+**表名:** T_AUTH_RESOURCE_GROUP_MEMBER
+
+**说明:** 资源组成员
+
+**数据列:**
+
+| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| 1 | ID | bigint | 20 | 0 | N | Y | | 主键 ID |
+| 2 | PROJECT_CODE | varchar | 64 | 0 | N | N | | 项目 ID |
+| 3 | RESOURCE_TYPE | varchar | 32 | 0 | N | N | | 资源类型 |
+| 4 | RESOURCE_CODE | varchar | 255 | 0 | N | N | | 资源 ID |
+| 5 | GROUP_CODE | varchar | 32 | 0 | N | N | | 用户组标识 |
+| 6 | IAM_GROUP_ID | int | 10 | 0 | N | N | | IAM 组 ID |
+| 7 | MEMBER_ID | varchar | 64 | 0 | N | N | | 成员 ID |
+| 8 | MEMBER_NAME | varchar | 512 | 0 | N | N | | 成员名 |
+| 9 | MEMBER_TYPE | varchar | 32 | 0 | N | N | | 成员类型,用户/组织/模板 |
+| 10 | EXPIRED_TIME | datetime | 19 | 0 | N | N | | 过期时间 |
+| 11 | CREATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 创建时间 |
+| 12 | UPDATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
+
+**表名:** T_AUTH_RESOURCE_SYNC
+
+**说明:** 同步 IAM 资源
+
+**数据列:**
+
+| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| 1 | PROJECT_CODE | varchar | 64 | 0 | N | Y | | 项目 ID |
+| 2 | STATUS | int | 10 | 0 | Y | N | 0 | 迁移状态,0-同步中,1-同步成功,2-同步失败 |
+| 3 | ERROR_MESSAGE | text | 65535 | 0 | Y | N | | 错误信息 |
+| 4 | TOTAL_TIME | bigint | 20 | 0 | Y | N | | 总耗时 |
+| 5 | CREATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 创建时间 |
+| 6 | UPDATE_TIME | datetime | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
+
**表名:** T_AUTH_RESOURCE_TYPE
**说明:** 权限资源类型表
diff --git a/docs/overview/db/devops_ci_dispatch.md b/docs/overview/db/devops_ci_dispatch.md
index 1f54524f78c..6d2b38941b0 100644
--- a/docs/overview/db/devops_ci_dispatch.md
+++ b/docs/overview/db/devops_ci_dispatch.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_dispatch
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_dispatch 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_environment.md b/docs/overview/db/devops_ci_environment.md
index f6f82037fee..ccd99671861 100644
--- a/docs/overview/db/devops_ci_environment.md
+++ b/docs/overview/db/devops_ci_environment.md
@@ -2,11 +2,12 @@
**数据库名:** devops_ci_environment
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_environment 的数据库文档
| 表名 | 说明 |
| :---: | :---: |
+| T_AGENT_BATCH_INSTALL_TOKEN | |
| T_AGENT_FAILURE_NOTIFY_USER | |
| T_AGENT_PIPELINE_REF | |
| T_AGENT_SHARE_PROJECT | |
@@ -21,6 +22,20 @@
| T_NODE | 节点信息表 |
| T_PROJECT_CONFIG | |
+**表名:** T_AGENT_BATCH_INSTALL_TOKEN
+
+**说明:**
+
+**数据列:**
+
+| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| 1 | PROJECT_ID | varchar | 64 | 0 | N | Y | | 项目 ID |
+| 2 | USER_ID | varchar | 64 | 0 | N | Y | | token 用户 |
+| 3 | TOKEN | varchar | 64 | 0 | N | N | | Base64 编码后 TOKEN |
+| 4 | CREATED_TIME | datetime | 19 | 0 | N | N | | 创建时间 |
+| 5 | EXPIRED_TIME | datetime | 19 | 0 | N | N | | 过期时间 |
+
**表名:** T_AGENT_FAILURE_NOTIFY_USER
**说明:**
diff --git a/docs/overview/db/devops_ci_image.md b/docs/overview/db/devops_ci_image.md
index 88dcb3cf826..026cda3dba6 100644
--- a/docs/overview/db/devops_ci_image.md
+++ b/docs/overview/db/devops_ci_image.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_image
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_image 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_log.md b/docs/overview/db/devops_ci_log.md
index 2cde1010584..3a8c4f23dfe 100644
--- a/docs/overview/db/devops_ci_log.md
+++ b/docs/overview/db/devops_ci_log.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_log
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_log 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_notify.md b/docs/overview/db/devops_ci_notify.md
index 23faa1c80be..342c4c6aaa8 100644
--- a/docs/overview/db/devops_ci_notify.md
+++ b/docs/overview/db/devops_ci_notify.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_notify
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_notify 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_op.md b/docs/overview/db/devops_ci_op.md
index 061645ae86c..a303de8b68d 100644
--- a/docs/overview/db/devops_ci_op.md
+++ b/docs/overview/db/devops_ci_op.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_op
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_op 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_openapi.md b/docs/overview/db/devops_ci_openapi.md
index ac602f24397..169895172c6 100644
--- a/docs/overview/db/devops_ci_openapi.md
+++ b/docs/overview/db/devops_ci_openapi.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_openapi
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_openapi 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_plugin.md b/docs/overview/db/devops_ci_plugin.md
index ecaacc564ae..ac496d2a91b 100644
--- a/docs/overview/db/devops_ci_plugin.md
+++ b/docs/overview/db/devops_ci_plugin.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_plugin
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_plugin 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_process.md b/docs/overview/db/devops_ci_process.md
index 82aba3c8d41..6a304b0b10d 100644
--- a/docs/overview/db/devops_ci_process.md
+++ b/docs/overview/db/devops_ci_process.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_process
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_process 的数据库文档
| 表名 | 说明 |
@@ -177,6 +177,7 @@
| 14 | CONTAINER_HASH_ID | varchar | 64 | 0 | Y | N | | 容器全局唯一 ID |
| 15 | MATRIX_GROUP_FLAG | bit | 1 | 0 | Y | N | | 是否为构建矩阵 |
| 16 | MATRIX_GROUP_ID | varchar | 64 | 0 | Y | N | | 所属的矩阵组 ID |
+| 17 | JOB_ID | varchar | 128 | 0 | Y | N | | jobid |
**表名:** T_PIPELINE_BUILD_DETAIL
@@ -403,6 +404,7 @@
| 16 | START_TIME | datetime | 23 | 0 | Y | N | | 开始时间 |
| 17 | END_TIME | datetime | 23 | 0 | Y | N | | 结束时间 |
| 18 | TIMESTAMPS | text | 65535 | 0 | Y | N | | 运行中产生的时间戳集合 |
+| 19 | ASYNC_STATUS | varchar | 32 | 0 | Y | N | | 插件异步执行状态 |
**表名:** T_PIPELINE_BUILD_STAGE
@@ -491,6 +493,7 @@
| 28 | PLATFORM_ERROR_CODE | int | 10 | 0 | Y | N | | 对接平台错误码 |
| 29 | CONTAINER_HASH_ID | varchar | 64 | 0 | Y | N | | 构建 Job 唯一标识 |
| 30 | STEP_ID | varchar | 64 | 0 | Y | N | | 标识上下文的自定义 ID |
+| 31 | JOB_ID | varchar | 128 | 0 | Y | N | | jobid |
**表名:** T_PIPELINE_BUILD_TEMPLATE_ACROSS_INFO
@@ -595,6 +598,7 @@
| 16 | PIPELINE_NAME_PINYIN | varchar | 1300 | 0 | Y | N | | 流水线名称拼音 |
| 17 | LATEST_START_TIME | datetime | 23 | 0 | Y | N | | 最近启动时间 |
| 18 | LATEST_VERSION_STATUS | varchar | 64 | 0 | Y | N | | 最新分布版本状态 |
+| 19 | LOCKED | bit | 1 | 0 | Y | N | b'0' | 是否锁定,PACv3.0 新增锁定,取代原来 setting 表中的 LOCK |
**表名:** T_PIPELINE_JOB_MUTEX_GROUP
@@ -775,7 +779,8 @@
| 18 | STATUS | varchar | 16 | 0 | Y | N | | 版本状态 |
| 19 | BRANCH_ACTION | varchar | 32 | 0 | Y | N | | 分支状态 |
| 20 | DESCRIPTION | text | 65535 | 0 | Y | N | | 版本变更说明 |
-| 21 | UPDATE_TIME | timestamp | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
+| 21 | UPDATER | varchar | 64 | 0 | Y | N | | 最近更新人 |
+| 22 | UPDATE_TIME | timestamp | 19 | 0 | N | N | CURRENT_TIMESTAMP | 更新时间 |
**表名:** T_PIPELINE_RULE
diff --git a/docs/overview/db/devops_ci_project.md b/docs/overview/db/devops_ci_project.md
index 69eaef1ea59..a8be36ea8d3 100644
--- a/docs/overview/db/devops_ci_project.md
+++ b/docs/overview/db/devops_ci_project.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_project
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_project 的数据库文档
| 表名 | 说明 |
@@ -392,6 +392,7 @@
| 26 | new_window | bit | 1 | 0 | Y | N | b'0' | 是否打开新标签页 |
| 27 | new_windowUrl | varchar | 200 | 0 | Y | N | | 新标签页地址 |
| 28 | cluster_type | varchar | 32 | 0 | N | N | | 集群类型 |
+| 29 | DOC_URL | varchar | 255 | 0 | N | N | | 文档链接 |
**表名:** T_SERVICE_TYPE
diff --git a/docs/overview/db/devops_ci_quality.md b/docs/overview/db/devops_ci_quality.md
index 1d302f1919b..dc2183cf289 100644
--- a/docs/overview/db/devops_ci_quality.md
+++ b/docs/overview/db/devops_ci_quality.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_quality
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_quality 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_repository.md b/docs/overview/db/devops_ci_repository.md
index c567433a243..0779c6f3556 100644
--- a/docs/overview/db/devops_ci_repository.md
+++ b/docs/overview/db/devops_ci_repository.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_repository
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_repository 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_sign.md b/docs/overview/db/devops_ci_sign.md
index 681561a0748..590d3b62ee5 100644
--- a/docs/overview/db/devops_ci_sign.md
+++ b/docs/overview/db/devops_ci_sign.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_sign
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_sign 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_store.md b/docs/overview/db/devops_ci_store.md
index d4065da48ff..8b7ba6c3d78 100644
--- a/docs/overview/db/devops_ci_store.md
+++ b/docs/overview/db/devops_ci_store.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_store
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_store 的数据库文档
| 表名 | 说明 |
diff --git a/docs/overview/db/devops_ci_ticket.md b/docs/overview/db/devops_ci_ticket.md
index be91dbe7aa7..14c3936daaf 100644
--- a/docs/overview/db/devops_ci_ticket.md
+++ b/docs/overview/db/devops_ci_ticket.md
@@ -2,7 +2,7 @@
**数据库名:** devops_ci_ticket
-**文档版本:** 1.0.2
+**文档版本:** 1.0.4
**文档描述:** devops_ci_ticket 的数据库文档
| 表名 | 说明 |
diff --git a/helm-charts/core/ci/Chart.lock b/helm-charts/core/ci/Chart.lock
index 16713a585e1..a1070e53a50 100644
--- a/helm-charts/core/ci/Chart.lock
+++ b/helm-charts/core/ci/Chart.lock
@@ -27,4 +27,4 @@ dependencies:
repository: file://./local_chart/kubernetes-management
version: 0.0.45
digest: sha256:bb11b7ac0e3487504f5563cd2b170d04038fc8971aaecbaca3dc5ecdcb792a43
-generated: "2024-06-21T18:05:57.191350067+08:00"
+generated: "2024-08-15T12:18:41.358254786+08:00"
diff --git a/helm-charts/core/ci/base/values.yaml b/helm-charts/core/ci/base/values.yaml
index 0094c6c3794..900c9f1e4d8 100644
--- a/helm-charts/core/ci/base/values.yaml
+++ b/helm-charts/core/ci/base/values.yaml
@@ -393,7 +393,7 @@ kubernetes-manager:
targetCPU: 80
targetMemory: 80
# 使用的镜像
- image: bkci/bkci-kubernetes-manager:0.0.31
+ image: bkci/bkci-kubernetes-manager:0.0.33
# 决定每次helm部署时的构建机所在的命名空间,同时dockerInitSh也在那里,为空时默认为 {{ .Release.Namespace }}
builderNamespace:
redis:
@@ -412,11 +412,13 @@ kubernetes-manager:
apiToken:
key: Devops-Token
value: landun
- rsaPrivateKey: |
+ rsaPrivateKey: ""
volumeMount:
# 流水线构建工作空间和agent日志在容器内的挂载点
dataPath: /data/devops/workspace
logPath: /data/devops/logs
+ docker:
+ enable: true
dockerInit:
# 是否使用当前chart的 dockerinit.sh
useDockerInit: true
diff --git a/helm-charts/core/ci/charts/kubernetes-manager-0.0.45.tgz b/helm-charts/core/ci/charts/kubernetes-manager-0.0.45.tgz
index bf049c9fea9..510864f540d 100644
Binary files a/helm-charts/core/ci/charts/kubernetes-manager-0.0.45.tgz and b/helm-charts/core/ci/charts/kubernetes-manager-0.0.45.tgz differ
diff --git a/helm-charts/core/ci/local_chart/kubernetes-management/templates/deployment.yaml b/helm-charts/core/ci/local_chart/kubernetes-management/templates/deployment.yaml
index 3038bb8ebd8..26c681cde45 100644
--- a/helm-charts/core/ci/local_chart/kubernetes-management/templates/deployment.yaml
+++ b/helm-charts/core/ci/local_chart/kubernetes-management/templates/deployment.yaml
@@ -76,6 +76,14 @@ spec:
value: {{ .Values.multiCluster.enabled | quote }}
- name: DEFAULT_NAMESPACE
value: {{ .Values.multiCluster.defaultNamespace }}
+ {{- if .Values.kubernetesManager.docker.enable }}
+ - name: DOCKER_HOST
+ value: tcp://localhost:2375
+ {{- end}}
+ {{- if .Values.kubernetesManager.debug }}
+ - name: KUBERNETES_MANAGER_DEBUG_ENABLE
+ value: "true"
+ {{- end}}
workingDir: /data/workspace/kubernetes-manager
livenessProbe:
tcpSocket:
@@ -99,8 +107,22 @@ spec:
mountPath: /data/workspace/kubernetes-manager/config
readOnly: true
{{- end}}
- {{- if .Values.configmap.enabled}}
+ {{- if .Values.kubernetesManager.docker.enable }}
+ - name: kuberentes-manager-docker
+ image: {{ .Values.kubernetesManager.docker.image }}
+ command: ["dockerd", "--host", "tcp://localhost:2375"]
+ {{- if .Values.kubernetesManager.docker.resources }}
+ resources: {{- toYaml .Values.kubernetesManager.docker.resources | nindent 12 }}
+ {{- end }}
+ securityContext:
+ privileged: true
+ volumeMounts:
+ - name: docker-graph-storage
+ mountPath: /var/lib/docker
+ {{- end }}
+
volumes:
+ {{- if .Values.configmap.enabled}}
- name: kubernetes-manager-config
configMap:
name: kubernetes-manager
@@ -110,6 +132,10 @@ spec:
{{- if .Values.kubeConfig.useKubeConfig}}
- key: kubeConfig.yaml
path: kubeConfig.yaml
- {{- end}}
+ {{- end}}
+ {{- if .Values.kubernetesManager.docker.enable }}
+ - name: docker-graph-storage
+ emptyDir: {}
+ {{- end}}
{{- end}}
{{- end -}}
diff --git a/helm-charts/core/ci/local_chart/kubernetes-management/templates/kubernetes-manager-configmap.yaml b/helm-charts/core/ci/local_chart/kubernetes-management/templates/kubernetes-manager-configmap.yaml
index a8dd052b646..c2a930b027a 100644
--- a/helm-charts/core/ci/local_chart/kubernetes-management/templates/kubernetes-manager-configmap.yaml
+++ b/helm-charts/core/ci/local_chart/kubernetes-management/templates/kubernetes-manager-configmap.yaml
@@ -135,6 +135,9 @@ data:
rsaPrivateKey: |
{{- .Values.kubernetesManager.apiserver.auth.rsaPrivateKey | nindent 10 }}
+ docker:
+ enable: {{ .Values.kubernetesManager.docker.enable }}
+
{{ if .Values.kubeConfig.useKubeConfig -}}
kubeConfig.yaml: |
{{- .Values.kubeConfig.content | nindent 4 }}
diff --git a/helm-charts/core/ci/local_chart/kubernetes-management/values.yaml b/helm-charts/core/ci/local_chart/kubernetes-management/values.yaml
index c11f424f3c2..93aef6e5a23 100644
--- a/helm-charts/core/ci/local_chart/kubernetes-management/values.yaml
+++ b/helm-charts/core/ci/local_chart/kubernetes-management/values.yaml
@@ -94,6 +94,7 @@ service:
# kubernetesManager Deployment
kubernetesManager:
enabled: true
+ debug: false
replicas: 1
resources:
requests:
@@ -147,11 +148,23 @@ kubernetesManager:
apiToken:
key: Devops-Token
value: landun
- rsaPrivateKey: |
+ rsaPrivateKey: ""
volumeMount:
# 流水线构建工作空间和agent日志在容器内的挂载点
dataPath: /data/devops/workspace
logPath: /data/devops/logs
+ # manager使用docker相关配置,会启用特权模式容器
+ docker:
+ enable: false
+ image: docker:24.0.1-dind
+ resources:
+ requests:
+ cpu: 50m
+ memory: 512Mi
+ limits:
+ cpu: 100m
+ memory: 1024Mi
+
dockerInit:
# 是否使用当前chart的 dockerinit.sh
useDockerInit: true
diff --git a/helm-charts/core/ci/templates/bklog.yaml b/helm-charts/core/ci/templates/bklog.yaml
index 1754ea65616..e26e31b1e44 100644
--- a/helm-charts/core/ci/templates/bklog.yaml
+++ b/helm-charts/core/ci/templates/bklog.yaml
@@ -17,7 +17,7 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: Helm
path:
- - /data/logs/*-.log
+ - /data/workspace/*/logs/service.log
encoding: 'utf-8'
multiline:
pattern: '^[0-2][0-9][0-9][0-9].[0-1][0-9].[0-3][0-9]'
diff --git a/helm-charts/core/ci/templates/gateway/deployment.yaml b/helm-charts/core/ci/templates/gateway/deployment.yaml
index f1617fa095b..b5329e0cf51 100644
--- a/helm-charts/core/ci/templates/gateway/deployment.yaml
+++ b/helm-charts/core/ci/templates/gateway/deployment.yaml
@@ -63,8 +63,6 @@ spec:
- "-c"
- |
cp -r /data/workspace/frontend/* /tmp/frontend/
- sysctl -w net.ipv4.tcp_tw_reuse=0
- sysctl -w net.ipv4.tcp_max_tw_buckets=16384
containers:
- name: gateway
image: {{ include "bkci-gateway.image" . }}
diff --git a/helm-charts/core/ci/templates/init/init.bkrepo.yaml b/helm-charts/core/ci/templates/init/init.bkrepo.yaml
index ef3035e3f68..9d16cb9dd4e 100644
--- a/helm-charts/core/ci/templates/init/init.bkrepo.yaml
+++ b/helm-charts/core/ci/templates/init/init.bkrepo.yaml
@@ -33,7 +33,7 @@ spec:
REPO_CREATE_GENERIC_PATH="{{ .Values.config.bkRepoApiUrl }}/repository/api/repo/create"
REPO_INIT_GENERIC_METADATA_PATH="{{ .Values.config.bkRepoApiUrl }}/generic/"
create_repo_project_name_init_plugintransfer_project_generic (){
- for i in bk-store
+ for i in bk-store bkcdn
do
ret=0
echo "CI project is $i -------------------------------------------------->"
diff --git a/helm-charts/core/ci/templates/init/init.iam-rbac.yaml b/helm-charts/core/ci/templates/init/init.iam-rbac.yaml
index b802482e8a2..052741d1e3d 100644
--- a/helm-charts/core/ci/templates/init/init.iam-rbac.yaml
+++ b/helm-charts/core/ci/templates/init/init.iam-rbac.yaml
@@ -21,13 +21,13 @@ spec:
- name: init-iam
image: {{ include "bkci-backend.image" . }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
- workingDir: /data/workspace/support-files/
+ workingDir: /data/workspace/support-files/bkiam-rbac
command:
- "/bin/bash"
- "-c"
- |
# 修改auth链接
- sed -i 's/ci-auth.service.consul:21936/{{- .Values.config.bkCiHost -}}\/auth/g' bkiam-rbac/*.json
+ sed -i 's/ci-auth.service.consul:21936/{{- .Values.config.bkCiHost -}}\/auth/g' *.json
# 导入模型
for i in $(find . -name '*.json'|sort)
do
@@ -47,9 +47,22 @@ spec:
# 注册auth回调
echo "{{ include "bkci.names.fullname" . }}-auth is available";
- sed -i 's/bk-ci.service.consul/{{ include "bkci.names.fullname" . }}-gateway.{{ .Release.Namespace }}/g' ms-init/auth/iam-callback-resource-registere.conf
- iam_json_file="ms-init/auth/iam-callback-resource-registere.conf"
+ sed -i 's/bk-ci.service.consul/{{ include "bkci.names.fullname" . }}-gateway.{{ .Release.Namespace }}/g' ../ms-init/auth/iam-callback-resource-registere.conf
+ iam_json_file="../ms-init/auth/iam-callback-resource-registere.conf"
curl -X POST -H "Content-Type:application/json" -d "@$iam_json_file" "http://{{ include "bkci.names.fullname" . }}-auth.{{ .Release.Namespace }}.svc.cluster.local/api/op/auth/iam/callback/"
+
+ # 迁移所有项目的特定资源类型资源
+ curl -X 'POST' \
+ 'http://{{ include "bkci.names.fullname" . }}-auth.{{ .Release.Namespace }}.svc.cluster.local/api/op/auth/migrate/migrateSpecificResourceOfAllProject' \
+ -H 'accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "resourceType": "pipeline",
+ "includeNullRouterTag": true,
+ "migrateProjectResource": true,
+ "migrateProjectDefaultGroup": true,
+ "migrateOtherResource": true
+ }'
restartPolicy: OnFailure
{{- end -}}
{{- end -}}
diff --git a/helm-charts/core/ci/templates/init/init.iam.yaml b/helm-charts/core/ci/templates/init/init.iam.yaml
deleted file mode 100644
index 984171b3307..00000000000
--- a/helm-charts/core/ci/templates/init/init.iam.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-# 初始化iam
-{{ if .Values.init.iam }}
-{{- if eq .Values.config.bkCiAuthProvider "bk_login_v3" -}}
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: {{ include "bkci.names.fullname" . }}-init-iam
- labels: {{- include "bkci.labels.standard" . | nindent 4 }}
- app.kubernetes.io/component: init-iam
- annotations:
- "helm.sh/hook": post-install,post-upgrade
- "helm.sh/hook-weight": "-4"
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
-spec:
- template:
- metadata:
- labels: {{- include "bkci.labels.standard" . | nindent 8 }}
- app.kubernetes.io/component: init-iam
- spec:
- containers:
- - name: init-iam
- image: {{ include "bkci-backend.image" . }}
- imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
- workingDir: /data/workspace/support-files/
- {{ $mysqlData := split ":" (include "bkci.mysqlAddr" .) }}
- command:
- - "/bin/bash"
- - "-c"
- - |
- # 修改auth链接
- sed -i 's/ci-auth.service.consul:21936/{{- .Values.config.bkCiHost -}}\/auth/g' bkiam/*.json
- # 导入模型
- for i in $(find . -name '*.json'|sort)
- do
- python3 bkiam_do_migrate.py -t {{ .Values.config.bkIamPrivateUrl }} -a "{{ .Values.config.bkCiAppCode }}" -s "{{ .Values.config.bkCiAppToken }}" -f $i
- done
-
- services="auth"
- for service in $services
- do
- until curl --connect-timeout 3 -m 1 -s "http://{{ include "bkci.names.fullname" . }}-$service.{{ .Release.Namespace }}.svc.cluster.local" > nohup
- do
- echo "waiting for {{ include "bkci.names.fullname" . }}-$service";
- sleep 2;
- done
- echo "{{ include "bkci.names.fullname" . }}-$service is available";
- done
-
- # 注册auth回调
- echo "{{ include "bkci.names.fullname" . }}-auth is available";
- sed -i 's/bk-ci.service.consul/{{ include "bkci.names.fullname" . }}-gateway.{{ .Release.Namespace }}/g' ms-init/auth/iam-callback-resource-registere.conf
- iam_json_file="ms-init/auth/iam-callback-resource-registere.conf"
- curl -X POST -H "Content-Type:application/json" -d "@$iam_json_file" "http://{{ include "bkci.names.fullname" . }}-auth.{{ .Release.Namespace }}.svc.cluster.local/api/op/auth/iam/callback/"
- restartPolicy: OnFailure
-{{- end -}}
-{{- end -}}
diff --git a/src/agent/agent/src/pkg/agent/agent.go b/src/agent/agent/src/pkg/agent/agent.go
index 3441a61318e..b980f4d4aa7 100644
--- a/src/agent/agent/src/pkg/agent/agent.go
+++ b/src/agent/agent/src/pkg/agent/agent.go
@@ -51,9 +51,19 @@ func Run(isDebug bool) {
// 初始化国际化
i18n.InitAgentI18n()
+ // 启动 agent,需要等到上报启动成功才能继续
_, err := job.AgentStartup()
if err != nil {
- logs.Warn("agent startup failed: ", err.Error())
+ logs.WithError(err).Error("agent startup failed")
+ for {
+ _, err = job.AgentStartup()
+ if err == nil {
+ break
+ } else {
+ logs.WithError(err).Error("agent startup failed")
+ time.Sleep(5 * time.Second)
+ }
+ }
}
// 数据采集
diff --git a/src/backend/ci/build.gradle.kts b/src/backend/ci/build.gradle.kts
index 1ab5dc054c1..56d29d82890 100644
--- a/src/backend/ci/build.gradle.kts
+++ b/src/backend/ci/build.gradle.kts
@@ -1,3 +1,5 @@
+import java.net.URI
+
plugins {
id("com.tencent.devops.boot") version "0.0.7"
detektCheck
@@ -24,6 +26,11 @@ allprojects {
}
}
+ // 新增maven 仓库
+ repositories {
+ add(maven { url = URI("https://repo.jenkins-ci.org/releases") })
+ }
+
// 版本管理
dependencyManagement {
setApplyMavenExclusions(false)
@@ -167,4 +174,8 @@ allprojects {
}
}
}
+ configurations.all {
+ resolutionStrategy.cacheChangingModulesFor(0,"seconds")
+ resolutionStrategy.cacheDynamicVersionsFor(0,"seconds")
+ }
}
diff --git a/src/backend/ci/buildSrc/src/main/kotlin/constants/Versions.kt b/src/backend/ci/buildSrc/src/main/kotlin/constants/Versions.kt
index 7f53a5dc377..ff146df41fc 100644
--- a/src/backend/ci/buildSrc/src/main/kotlin/constants/Versions.kt
+++ b/src/backend/ci/buildSrc/src/main/kotlin/constants/Versions.kt
@@ -46,7 +46,7 @@ object Versions {
const val jjwt = "0.11.5"
const val Okhttp = "4.9.0"
const val jgit = "5.13.1.202206130422-r"
- const val iam = "1.0.6"
+ const val iam = "1.0.7"
const val disklrucache = "2.0.2"
const val BkCrypto = "1.1.3"
const val audit = "1.0.8"
diff --git a/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/BkRepoArchiveFileServiceImpl.kt b/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/BkRepoArchiveFileServiceImpl.kt
index b088d6229d8..a44a6b2057c 100644
--- a/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/BkRepoArchiveFileServiceImpl.kt
+++ b/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/BkRepoArchiveFileServiceImpl.kt
@@ -65,6 +65,7 @@ import com.tencent.devops.common.archive.util.MimeUtil
import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.AuthResourceType
import com.tencent.devops.common.service.utils.HomeHostUtil
+import com.tencent.devops.process.api.service.ServicePipelineResource
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
@@ -94,11 +95,12 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
private val dockerRegistry: String? = null
override fun show(userId: String, projectId: String, artifactoryType: ArtifactoryType, path: String): FileDetail {
- val nodeDetail = bkRepoClient.getFileDetail(userId = userId,
+ val nodeDetail = bkRepoClient.getFileDetail(
+ userId = userId,
projectId = projectId,
repoName = BkRepoUtils.getRepoName(artifactoryType),
- path = path)
- ?: throw NotFoundException("file[$projectId|$artifactoryType|$path] not found")
+ path = path
+ ) ?: throw NotFoundException("file[$projectId|$artifactoryType|$path] not found")
return nodeDetail.toFileDetail()
}
@@ -267,11 +269,15 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
page = page ?: 1,
pageSize = pageSize ?: DEFAULT_PAGE_SIZE,
totalPages = 1,
- records = nodeList.map { buildFileInfo(it) }
+ records = nodeList.map { buildFileInfo(it, getPipelineNames(nodeList), getBuildNums(nodeList)) }
)
}
- private fun buildFileInfo(it: QueryNodeInfo): FileInfo {
+ private fun buildFileInfo(
+ it: QueryNodeInfo,
+ pipelineNameMap: Map,
+ buildNumMap: Map
+ ): FileInfo {
return if (parseArtifactoryType(it.repoName) == ArtifactoryType.IMAGE) {
val (imageName, version) = DefaultPathUtils.getImageNameAndVersion(it.fullPath)
val packageVersion = bkRepoClient.getPackageVersionInfo(
@@ -297,18 +303,22 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
)
}
} else {
- buildGenericFileInfo(it)
+ buildGenericFileInfo(it, pipelineNameMap, buildNumMap)
}
}
- private fun buildGenericFileInfo(nodeInfo: QueryNodeInfo): FileInfo {
+ private fun buildGenericFileInfo(
+ nodeInfo: QueryNodeInfo,
+ pipelineNameMap: Map,
+ buildNumMap: Map
+ ): FileInfo {
// 归档插件归档目录时,在目录多归档一个.bkci_pipeline文件, 记录归档目录的信息
return if (nodeInfo.name == ".bkci_pipeline") {
FileInfo(
name = nodeInfo.path.split("/").lastOrNull { it.isNotBlank() } ?: StringPool.ROOT,
- fullName = nodeInfo.name,
- path = nodeInfo.fullPath,
- fullPath = nodeInfo.fullPath,
+ fullName = nodeInfo.path,
+ path = nodeInfo.path,
+ fullPath = nodeInfo.path,
size = nodeInfo.size,
folder = nodeInfo.folder,
properties = nodeInfo.metadata?.map { m -> Property(m.key, m.value.toString()) },
@@ -319,7 +329,7 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
} else {
FileInfo(
name = nodeInfo.name,
- fullName = nodeInfo.name,
+ fullName = getFullName(nodeInfo, pipelineNameMap, buildNumMap),
path = nodeInfo.fullPath,
fullPath = nodeInfo.fullPath,
size = nodeInfo.size,
@@ -332,6 +342,64 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
}
}
+ private fun getPipelineNames(nodeList: List): Map {
+ val pipelineIds = mutableSetOf()
+ nodeList.filter { it.repoName == REPO_NAME_PIPELINE }.forEach {
+ val paths = it.fullPath.split("/")
+ if (paths.size < 3) {
+ logger.warn("illegal pipeline repo node fullPath: ${it.fullPath}")
+ return@forEach
+ }
+ pipelineIds.add(paths[1])
+ }
+ if (pipelineIds.size == 0) {
+ return emptyMap()
+ }
+ return client.get(ServicePipelineResource::class)
+ .getPipelineNameByIds(nodeList.first().projectId, pipelineIds).data.orEmpty()
+ }
+
+ private fun getBuildNums(nodeList: List): Map {
+ val buildIds = mutableSetOf()
+ nodeList.filter { it.repoName == REPO_NAME_PIPELINE }.forEach {
+ val paths = it.fullPath.split("/")
+ if (paths.size < 3) {
+ logger.warn("illegal pipeline repo node fullPath: ${it.fullPath}")
+ return@forEach
+ }
+ buildIds.add(paths[2])
+ }
+ if (buildIds.size == 0) {
+ return emptyMap()
+ }
+ return client.get(ServicePipelineResource::class)
+ .getBuildNoByBuildIds(buildIds, nodeList.first().projectId).data.orEmpty()
+ }
+
+ private fun getFullName(
+ nodeInfo: QueryNodeInfo,
+ pipelineNameMap: Map,
+ buildNumMap: Map
+ ): String {
+ if (nodeInfo.repoName != REPO_NAME_PIPELINE) {
+ return nodeInfo.fullPath
+ }
+ val paths = nodeInfo.fullPath.split("/")
+ if (paths.size < 3) {
+ logger.warn("illegal pipeline repo node fullPath: ${nodeInfo.fullPath}")
+ return nodeInfo.fullPath
+ }
+ val pipelineId = paths[1]
+ val buildId = paths[2]
+ val pipelineName = pipelineNameMap[pipelineId]
+ val buildNum = buildNumMap[buildId]
+ if (pipelineName.isNullOrEmpty() || buildNum.isNullOrEmpty()) {
+ logger.warn("illegal pipelineId or buildId: $pipelineId, $buildId")
+ return nodeInfo.fullPath
+ }
+ return nodeInfo.fullPath.replace("/$pipelineId/$buildId", "/$pipelineName/$buildNum")
+ }
+
override fun generateDestPath(
fileType: FileTypeEnum,
projectId: String,
@@ -341,14 +409,18 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
): String {
val result = if (FileTypeEnum.BK_CUSTOM == fileType) {
if (customFilePath.isNullOrBlank() || customFilePath.contains("..")) {
- throw ErrorCodeException(errorCode = CommonMessageCode.PARAMETER_IS_NULL,
- params = arrayOf("customFilePath"))
+ throw ErrorCodeException(
+ errorCode = CommonMessageCode.PARAMETER_IS_NULL,
+ params = arrayOf("customFilePath")
+ )
}
customFilePath.removePrefix("/")
} else {
if (pipelineId.isNullOrBlank() || buildId.isNullOrBlank()) {
- throw ErrorCodeException(errorCode = CommonMessageCode.PARAMETER_IS_NULL,
- params = arrayOf("pipelineId or buildId"))
+ throw ErrorCodeException(
+ errorCode = CommonMessageCode.PARAMETER_IS_NULL,
+ params = arrayOf("pipelineId or buildId")
+ )
}
val filePath = if (customFilePath.isNullOrBlank()) {
""
@@ -383,7 +455,8 @@ class BkRepoArchiveFileServiceImpl @Autowired constructor(
projectId = projectId,
filePath = "/$filePath",
artifactoryType = artifactoryType,
- fileChannelType = fileChannelType, fullUrl = fullUrl)
+ fileChannelType = fileChannelType, fullUrl = fullUrl
+ )
}
override fun getFileDownloadUrls(
diff --git a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/migrate/OpAuthMigrateResource.kt b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/migrate/OpAuthMigrateResource.kt
index 47b9b4af4a5..1d380c079d9 100644
--- a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/migrate/OpAuthMigrateResource.kt
+++ b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/migrate/OpAuthMigrateResource.kt
@@ -140,4 +140,25 @@ interface OpAuthMigrateResource {
@Parameter(description = "按条件迁移项目实体", required = true)
projectConditionDTO: ProjectConditionDTO
): Result
+
+ @POST
+ @Path("/migrateResourceAuthorization")
+ @Operation(summary = "迁移资源授权-按照项目")
+ fun migrateResourceAuthorization(
+ @Parameter(description = "迁移项目", required = true)
+ projectCodes: List
+ ): Result
+
+ @POST
+ @Path("/migrateAllResourceAuthorization")
+ @Operation(summary = "迁移资源授权-全量")
+ fun migrateAllResourceAuthorization(): Result
+
+ @POST
+ @Path("/fixResourceGroups")
+ @Operation(summary = "修复资源组")
+ fun fixResourceGroups(
+ @Parameter(description = "迁移项目", required = true)
+ projectCodes: List
+ ): Result
}
diff --git a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/service/ServiceAuthAuthorizationResource.kt b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/service/ServiceAuthAuthorizationResource.kt
new file mode 100644
index 00000000000..fef73e0e366
--- /dev/null
+++ b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/service/ServiceAuthAuthorizationResource.kt
@@ -0,0 +1,101 @@
+/*
+ * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
+ *
+ * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
+ *
+ * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
+ *
+ * A copy of the MIT License is included in this file.
+ *
+ *
+ * Terms of the MIT License:
+ * ---------------------------------------------------
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+ * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package com.tencent.devops.auth.api.service
+
+import com.tencent.devops.common.api.model.SQLPage
+import com.tencent.devops.common.api.pojo.Result
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationConditionRequest
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationDTO
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationHandoverDTO
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationResponse
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.Parameter
+import io.swagger.v3.oas.annotations.tags.Tag
+import javax.ws.rs.Consumes
+import javax.ws.rs.GET
+import javax.ws.rs.POST
+import javax.ws.rs.PUT
+import javax.ws.rs.Path
+import javax.ws.rs.PathParam
+import javax.ws.rs.Produces
+import javax.ws.rs.core.MediaType
+
+@Tag(name = "SERVICE_RESOURCE_AUTHORIZATION", description = "权限-授权管理")
+@Path("/service/auth/authorization/{projectId}")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+interface ServiceAuthAuthorizationResource {
+ @POST
+ @Path("/addResourceAuthorization")
+ @Operation(summary = "新增资源授权管理")
+ fun addResourceAuthorization(
+ @Parameter(description = "项目Id", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "资源授权实体", required = true)
+ resourceAuthorizationList: List
+ ): Result
+
+ @GET
+ @Path("/{resourceType}/{resourceCode}/getResourceAuthorization")
+ @Operation(summary = "获取资源授予记录")
+ fun getResourceAuthorization(
+ @Parameter(description = "项目Id", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @PathParam("resourceType")
+ @Parameter(description = "资源类型", required = true)
+ resourceType: String,
+ @PathParam("resourceCode")
+ @Parameter(description = "资源code", required = true)
+ resourceCode: String
+ ): Result
+
+ @POST
+ @Path("/listResourceAuthorization")
+ @Operation(summary = "获取资源授权管理")
+ fun listResourceAuthorization(
+ @Parameter(description = "项目ID", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "查询条件", required = true)
+ condition: ResourceAuthorizationConditionRequest
+ ): Result>
+
+ @PUT
+ @Path("/batchModifyHandoverFrom")
+ @Operation(summary = "批量重置资源授权人")
+ fun batchModifyHandoverFrom(
+ @Parameter(description = "项目Id", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "重置资源授权请求体", required = true)
+ resourceAuthorizationHandoverList: List
+ ): Result
+}
diff --git a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/sync/OpAuthResourceGroupSyncResource.kt b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/sync/OpAuthResourceGroupSyncResource.kt
new file mode 100644
index 00000000000..a907ba8fb87
--- /dev/null
+++ b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/sync/OpAuthResourceGroupSyncResource.kt
@@ -0,0 +1,108 @@
+/*
+ * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
+ *
+ * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
+ *
+ * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
+ *
+ * A copy of the MIT License is included in this file.
+ *
+ *
+ * Terms of the MIT License:
+ * ---------------------------------------------------
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+ * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.tencent.devops.auth.api.sync
+
+import com.tencent.devops.common.api.pojo.Result
+import com.tencent.devops.common.auth.api.pojo.ProjectConditionDTO
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.Parameter
+import io.swagger.v3.oas.annotations.tags.Tag
+import javax.ws.rs.Consumes
+import javax.ws.rs.POST
+import javax.ws.rs.Path
+import javax.ws.rs.PathParam
+import javax.ws.rs.Produces
+import javax.ws.rs.core.MediaType
+
+@Tag(name = "AUTH_SYNC", description = "权限-同步IAM")
+@Path("/op/auth/resource/group/sync/")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+interface OpAuthResourceGroupSyncResource {
+
+ @POST
+ @Path("/syncByCondition")
+ @Operation(summary = "按条件同步组和成员")
+ fun syncByCondition(
+ @Parameter(description = "按条件迁移项目实体", required = true)
+ projectConditionDTO: ProjectConditionDTO
+ ): Result
+
+ @POST
+ @Path("/batchSyncGroupAndMember")
+ @Operation(summary = "批量同步所有用户组和成员")
+ fun batchSyncGroupAndMember(
+ @Parameter(description = "项目ID列表", required = true)
+ projectIds: List
+ ): Result
+
+ @POST
+ @Path("/batchSyncProjectGroup")
+ @Operation(summary = "批量同步项目下用户组")
+ fun batchSyncProjectGroup(
+ @Parameter(description = "项目ID列表", required = true)
+ projectIds: List
+ ): Result
+
+ @POST
+ @Path("/batchSyncAllMember")
+ @Operation(summary = "同步所有成员")
+ fun batchSyncAllMember(
+ @Parameter(description = "项目ID列表", required = true)
+ projectIds: List
+ ): Result
+
+ @POST
+ @Path("/{projectId}/{resourceType}/{resourceCode}/syncResourceMember")
+ @Operation(summary = "同步资源下用户组")
+ fun syncResourceMember(
+ @Parameter(description = "项目ID", required = true)
+ @PathParam(value = "projectId")
+ projectId: String,
+ @Parameter(description = "资源类型", required = true)
+ @PathParam(value = "resourceType")
+ resourceType: String,
+ @Parameter(description = "资源ID", required = true)
+ @PathParam(value = "resourceCode")
+ resourceCode: String
+ ): Result
+
+ @POST
+ @Path("/{projectId}/fixResourceGroupMember")
+ @Operation(summary = "修复用户组成员表")
+ fun fixResourceGroupMember(
+ @Parameter(description = "项目ID", required = true)
+ @PathParam(value = "projectId")
+ projectId: String
+ ): Result
+
+ @POST
+ @Path("/syncIamGroupMembersOfApply")
+ @Operation(summary = "同步iam组成员--用户申请加入")
+ fun syncIamGroupMembersOfApply(): Result
+}
diff --git a/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/user/UserAuthAuthorizationResource.kt b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/user/UserAuthAuthorizationResource.kt
new file mode 100644
index 00000000000..0f672983e72
--- /dev/null
+++ b/src/backend/ci/core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/api/user/UserAuthAuthorizationResource.kt
@@ -0,0 +1,141 @@
+/*
+ * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
+ *
+ * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
+ *
+ * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
+ *
+ * A copy of the MIT License is included in this file.
+ *
+ *
+ * Terms of the MIT License:
+ * ---------------------------------------------------
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+ * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package com.tencent.devops.auth.api.user
+
+import com.tencent.devops.auth.pojo.vo.ResourceTypeInfoVo
+import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID
+import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID_DEFAULT_VALUE
+import com.tencent.devops.common.api.model.SQLPage
+import com.tencent.devops.common.api.pojo.Result
+import com.tencent.devops.common.auth.api.pojo.ResetAllResourceAuthorizationReq
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationConditionRequest
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationHandoverConditionRequest
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationHandoverDTO
+import com.tencent.devops.common.auth.api.pojo.ResourceAuthorizationResponse
+import com.tencent.devops.common.auth.enums.ResourceAuthorizationHandoverStatus
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.Parameter
+import io.swagger.v3.oas.annotations.tags.Tag
+import javax.ws.rs.Consumes
+import javax.ws.rs.GET
+import javax.ws.rs.HeaderParam
+import javax.ws.rs.POST
+import javax.ws.rs.Path
+import javax.ws.rs.PathParam
+import javax.ws.rs.Produces
+import javax.ws.rs.QueryParam
+import javax.ws.rs.core.MediaType
+
+@Tag(name = "USER_RESOURCE_AUTHORIZATION", description = "用户-权限-授权管理")
+@Path("/user/auth/authorization/")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+interface UserAuthAuthorizationResource {
+
+ @POST
+ @Path("/{projectId}/listResourceAuthorization")
+ @Operation(summary = "根据条件获取资源授权管理")
+ fun listResourceAuthorization(
+ @Parameter(description = "用户名", required = true)
+ @HeaderParam(AUTH_HEADER_USER_ID)
+ userId: String,
+ @Parameter(description = "项目ID", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "查询条件", required = true)
+ condition: ResourceAuthorizationConditionRequest
+ ): Result>
+
+ @GET
+ @Path("/{projectId}/{resourceType}/getResourceAuthorization")
+ @Operation(summary = "获取资源授权管理")
+ fun getResourceAuthorization(
+ @Parameter(description = "用户名", required = true)
+ @HeaderParam(AUTH_HEADER_USER_ID)
+ userId: String,
+ @Parameter(description = "项目ID", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "资源类型", required = true)
+ @PathParam("resourceType")
+ resourceType: String,
+ @Parameter(description = "资源code", required = true)
+ @QueryParam("resourceCode")
+ resourceCode: String
+ ): Result
+
+ @GET
+ @Path("/{projectId}/{resourceType}/checkAuthorizationWhenRemoveGroupMember")
+ @Operation(summary = "当移出用户组时做授权检查")
+ fun checkAuthorizationWhenRemoveGroupMember(
+ @Parameter(description = "用户名", required = true)
+ @HeaderParam(AUTH_HEADER_USER_ID)
+ userId: String,
+ @Parameter(description = "项目ID", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "资源类型", required = true)
+ @PathParam("resourceType")
+ resourceType: String,
+ @Parameter(description = "资源code", required = true)
+ @QueryParam("resourceCode")
+ resourceCode: String,
+ @Parameter(description = "成员ID", required = true)
+ @QueryParam("memberId")
+ memberId: String
+ ): Result
+
+ @POST
+ @Path("/{projectId}/resetResourceAuthorization")
+ @Operation(summary = "重置资源授权管理")
+ fun resetResourceAuthorization(
+ @Parameter(description = "用户ID", required = true, example = AUTH_HEADER_USER_ID_DEFAULT_VALUE)
+ @HeaderParam(AUTH_HEADER_USER_ID)
+ userId: String,
+ @Parameter(description = "项目ID", required = true)
+ @PathParam("projectId")
+ projectId: String,
+ @Parameter(description = "资源授权交接条件实体", required = true)
+ condition: ResourceAuthorizationHandoverConditionRequest
+ ): Result