Skip to content

Commit

Permalink
Merge remote-tracking branch 'Tencent/master' into issue-9574
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Nov 27, 2023
2 parents 5ab7ea9 + 62eedc2 commit ce58e9c
Show file tree
Hide file tree
Showing 343 changed files with 13,215 additions and 2,714 deletions.
85 changes: 46 additions & 39 deletions docs/overview/db/devops_ci_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
| [T_PIPELINE_VIEW_USER_LAST_VIEW](#T_PIPELINE_VIEW_USER_LAST_VIEW) | |
| [T_PIPELINE_VIEW_USER_SETTINGS](#T_PIPELINE_VIEW_USER_SETTINGS) | |
| [T_PIPELINE_WEBHOOK](#T_PIPELINE_WEBHOOK) | |
| [T_PIPELINE_WEBHOOK_BUILD_LOG](#T_PIPELINE_WEBHOOK_BUILD_LOG) | |
| [T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL](#T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL) | |
| [T_PIPELINE_WEBHOOK_QUEUE](#T_PIPELINE_WEBHOOK_QUEUE) | |
| [T_PROJECT_PIPELINE_CALLBACK](#T_PROJECT_PIPELINE_CALLBACK) | |
| [T_PROJECT_PIPELINE_CALLBACK_HISTORY](#T_PROJECT_PIPELINE_CALLBACK_HISTORY) | |
Expand All @@ -60,6 +58,8 @@
| [T_TEMPLATE_INSTANCE_BASE](#T_TEMPLATE_INSTANCE_BASE) | 模板实列化基本信息表 |
| [T_TEMPLATE_INSTANCE_ITEM](#T_TEMPLATE_INSTANCE_ITEM) | 模板实列化项信息表 |
| [T_TEMPLATE_PIPELINE](#T_TEMPLATE_PIPELINE) | 流水线模板-实例映射表 |
| [T_PIPELINE_TRIGGER_EVENT](#T_PIPELINE_TRIGGER_EVENT) | 流水线触发事件表 |
| [T_PIPELINE_TRIGGER_DETAIL](#T_PIPELINE_TRIGGER_DETAIL) | 流水线触发事件明细表 |

**表名:** <a id="T_AUDIT_RESOURCE">T_AUDIT_RESOURCE</a>

Expand Down Expand Up @@ -848,44 +848,10 @@
| 8 | PROJECT_NAME | varchar | 128 | 0 | Y | N | | 项目名称 |
| 9 | TASK_ID | varchar | 34 | 0 | Y | N | | 任务id |
| 10 | DELETE | bit | 1 | 0 | Y | N | b'0' | 是否删除 |
| 11 | EXTERNAL_ID | varchar | 255 | 0 | Y | N | | webhook事件生产者ID,工蜂-工蜂ID,github-github id,svn-svn path,p4-p4port |
| 12 | EVENT_TYPE | varchar | 32 | 0 | Y | N | | 事件类型 |
| 13 | REPOSITORY_HASH_ID | varchar | 64 | 0 | Y | N | | 代码库hashId |

**表名:** <a id="T_PIPELINE_WEBHOOK_BUILD_LOG">T_PIPELINE_WEBHOOK_BUILD_LOG</a>

**说明:**

**数据列:**

| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 1 | ID | bigint | 20 | 0 | N | Y | | 主键ID |
| 2 | CODE_TYPE | varchar | 32 | 0 | N | N | | 代码库类型 |
| 3 | REPO_NAME | varchar | 128 | 0 | N | N | | 代码库别名 |
| 4 | COMMIT_ID | varchar | 64 | 0 | N | N | | 代码提交ID |
| 5 | REQUEST_CONTENT | text | 65535 | 0 | Y | N | | 事件内容 |
| 6 | CREATED_TIME | datetime | 19 | 0 | N | Y | CURRENT_TIMESTAMP | 创建时间 |
| 7 | RECEIVED_TIME | datetime | 19 | 0 | N | N | | 接收时间 |
| 8 | FINISHED_TIME | datetime | 19 | 0 | N | N | | 完成时间 |

**表名:** <a id="T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL">T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL</a>

**说明:**

**数据列:**

| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 1 | ID | bigint | 20 | 0 | N | Y | | 主键ID |
| 2 | LOG_ID | bigint | 20 | 0 | N | N | | |
| 3 | CODE_TYPE | varchar | 32 | 0 | N | N | | 代码库类型 |
| 4 | REPO_NAME | varchar | 128 | 0 | N | N | | 代码库别名 |
| 5 | COMMIT_ID | varchar | 64 | 0 | N | N | | 代码提交ID |
| 6 | PROJECT_ID | varchar | 32 | 0 | N | N | | 项目ID |
| 7 | PIPELINE_ID | varchar | 34 | 0 | N | N | | 流水线ID |
| 8 | TASK_ID | varchar | 34 | 0 | N | N | | 任务id |
| 9 | TASK_NAME | varchar | 128 | 0 | Y | N | | 任务名称 |
| 10 | SUCCESS | bit | 1 | 0 | Y | N | b'0' | 是否成功 |
| 11 | TRIGGER_RESULT | text | 65535 | 0 | Y | N | | 触发结果 |
| 12 | CREATED_TIME | datetime | 19 | 0 | N | Y | CURRENT_TIMESTAMP | 创建时间 |

**表名:** <a id="T_PIPELINE_WEBHOOK_QUEUE">T_PIPELINE_WEBHOOK_QUEUE</a>

Expand Down Expand Up @@ -1055,3 +1021,44 @@
| 12 | BUILD_NO | text | 65535 | 0 | Y | N | | 构建号 |
| 13 | PARAM | mediumtext | 16777215 | 0 | Y | N | | 参数 |
| 14 | DELETED | bit | 1 | 0 | Y | N | b'0' | 流水线已被软删除 |

**表名:** <a id="T_PIPELINE_TRIGGER_EVENT">T_PIPELINE_TRIGGER_EVENT</a>

**说明:** 流水线触发事件表

**数据列:**

| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 1 | REQUEST_ID | varchar | 64 | 0 | N | N | | 请求ID |
| 2 | PROJECT_ID | varchar | 64 | 0 | N | Y | | 项目ID |
| 3 | EVENT_ID | bigint | 20 | 0 | N | Y | | 事件ID |
| 4 | TRIGGER_TYPE | varchar | 32 | 0 | N | N | | 触发类型 |
| 5 | EVENT_SOURCE | varchar | 20 | 0 | N | N | | 触发源,代码库hashId/触发人/远程ip |
| 6 | EVENT_TYPE | varchar | 64 | 0 | N | N | | 事件类型 |
| 7 | TRIGGER_USER | varchar | 100 | 0 | N | N | | 触发用户 |
| 8 | EVENT_DESC | text | | 0 | N | N | | 事件描述 |
| 9 | REPLAY_REQUEST_ID | varchar | 64 | 0 | Y | N | | 重放请求ID |
| 10 | REQUEST_PARAMS | text | | 0 | N | N | | 请求参数 |
| 11 | CREATE_TIME | timestamp | | 0 | N | Y | | 事件时间 |

**表名:** <a id="T_PIPELINE_TRIGGER_DETAIL">T_PIPELINE_TRIGGER_DETAIL</a>

**说明:** 流水线触发事件明细表

**数据列:**

| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 1 | DETAIL_ID | varchar | 64 | 0 | N | Y | | 事件明细ID |
| 2 | PROJECT_ID | varchar | 64 | 0 | N | N | | 项目ID |
| 3 | EVENT_ID | bigint | 20 | 0 | N | N | | 事件ID |
| 4 | STATUS | varchar | 32 | 0 | Y | N | | 状态(success or failure) |
| 5 | PIPELINE_ID | varchar | 20 | 0 | Y | N | | 流水线ID |
| 6 | PIPELINE_NAME | varchar | 64 | 0 | Y | N | | 流水线名称 |
| 7 | VERSION | varchar | 100 | 0 | Y | N | | 流水线版本号 |
| 8 | BUILD_ID | text | | 0 | Y | N | | 构建ID |
| 9 | BUILD_NUM | varchar | 64 | 0 | Y | N | | 构建编号 |
| 10 | REASON | text | | 0 | Y | N | | 失败原因 |
| 11 | REASON_DETAIL | timestamp | | 0 | Y | N | | 原因详情 |
| 12 | CREATE_TIME | timestamp | | 0 | Y | Y | | 创建时间 |
4 changes: 2 additions & 2 deletions scripts/render_tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sed_script=$(mktemp /tmp/XXXXXX.sed)

usage () {
echo "Usage: $0 [-c] [-n] [-E k=v, -E k=v] tpl_path ..."
}
}

usage_and_exit () {
usage
Expand All @@ -34,7 +34,7 @@ target_file_path () {
echo ${_target_file%.tpl}
}

[[ $# -eq 0 ]] && usage_and_exit 1
[[ $# -eq 0 ]] && usage_and_exit 1
declare -i DRY_RUN=0 CHECK=0
declare MODULE=""
declare -a EXTRA_ENV=()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.tencent.devops.auth.api.oauth2

import com.tencent.devops.auth.pojo.dto.Oauth2AuthorizationCodeDTO
import com.tencent.devops.auth.pojo.vo.Oauth2AuthorizationInfoVo
import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID
import com.tencent.devops.common.api.pojo.Result
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
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.Produces
import javax.ws.rs.QueryParam
import javax.ws.rs.core.MediaType

@Api(tags = ["OAUTH2_ENDPOINT"], description = "oauth2相关")
@Path("/desktop/oauth2/endpoint")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
interface Oauth2DesktopEndpointResource {
@GET
@Path("/getAuthorizationInformation")
@ApiOperation("获取授权信息")
fun getAuthorizationInformation(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@ApiParam("待校验用户ID", required = true)
userId: String,
@QueryParam("clientId")
@ApiParam("客户端ID", required = true)
clientId: String,
@QueryParam("redirectUri")
@ApiParam("跳转链接", required = true)
redirectUri: String
): Result<Oauth2AuthorizationInfoVo>

@POST
@Path("/getAuthorizationCode")
@ApiOperation("获取授权码")
fun getAuthorizationCode(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@ApiParam("待校验用户ID", required = true)
userId: String,
@QueryParam("clientId")
@ApiParam("客户端ID", required = true)
clientId: String,
@QueryParam("redirectUri")
@ApiParam("跳转链接", required = true)
redirectUri: String,
@ApiParam("oauth2获取授权码请求报文体", required = true)
authorizationCodeDTO: Oauth2AuthorizationCodeDTO
): Result<String>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.tencent.devops.auth.api.oauth2

import com.tencent.devops.auth.pojo.Oauth2AccessTokenRequest
import com.tencent.devops.auth.pojo.dto.Oauth2AuthorizationCodeDTO
import com.tencent.devops.auth.pojo.vo.Oauth2AccessTokenVo
import com.tencent.devops.auth.pojo.vo.Oauth2AuthorizationInfoVo
import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID
import com.tencent.devops.common.api.auth.AUTH_HEADER_OAUTH2_AUTHORIZATION
import com.tencent.devops.common.api.auth.AUTH_HEADER_OAUTH2_CLIENT_ID
import com.tencent.devops.common.api.auth.AUTH_HEADER_OAUTH2_CLIENT_SECRET
import com.tencent.devops.common.api.pojo.Result
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
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.Produces
import javax.ws.rs.QueryParam
import javax.ws.rs.core.MediaType

@Api(tags = ["OAUTH2_ENDPOINT"], description = "oauth2相关")
@Path("/service/oauth2/endpoint")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
interface Oauth2ServiceEndpointResource {
@GET
@Path("/getAuthorizationInformation")
@ApiOperation("获取授权信息")
fun getAuthorizationInformation(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@ApiParam("待校验用户ID", required = true)
userId: String,
@QueryParam("clientId")
@ApiParam("客户端ID", required = true)
clientId: String,
@QueryParam("redirectUri")
@ApiParam("跳转链接", required = true)
redirectUri: String
): Result<Oauth2AuthorizationInfoVo>

@POST
@Path("/getAuthorizationCode")
@ApiOperation("获取授权码")
fun getAuthorizationCode(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@ApiParam("待校验用户ID", required = true)
userId: String,
@QueryParam("clientId")
@ApiParam("客户端ID", required = true)
clientId: String,
@QueryParam("redirectUri")
@ApiParam("跳转链接", required = true)
redirectUri: String,
@ApiParam("oauth2获取授权码请求报文体", required = true)
authorizationCodeDTO: Oauth2AuthorizationCodeDTO
): Result<String>

@POST
@Path("/getAccessToken")
@ApiOperation("获取accessToken")
fun getAccessToken(
@HeaderParam(AUTH_HEADER_OAUTH2_CLIENT_ID)
@ApiParam("客户端id", required = true)
clientId: String,
@HeaderParam(AUTH_HEADER_OAUTH2_CLIENT_SECRET)
@ApiParam("客户端秘钥", required = true)
clientSecret: String,
@ApiParam("oauth2获取token请求报文体", required = true)
accessTokenRequest: Oauth2AccessTokenRequest
): Result<Oauth2AccessTokenVo?>

@POST
@Path("/verifyAccessToken")
@ApiOperation("校验accessToken")
fun verifyAccessToken(
@HeaderParam(AUTH_HEADER_OAUTH2_CLIENT_ID)
@ApiParam("客户端id", required = true)
clientId: String,
@HeaderParam(AUTH_HEADER_OAUTH2_CLIENT_SECRET)
@ApiParam("客户端秘钥", required = true)
clientSecret: String,
@HeaderParam(AUTH_HEADER_OAUTH2_AUTHORIZATION)
@ApiParam("access token", required = true)
accessToken: String
): Result<String>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.tencent.devops.auth.api.oauth2

import com.tencent.devops.auth.pojo.dto.ClientDetailsDTO
import com.tencent.devops.auth.pojo.dto.ScopeOperationDTO
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import javax.ws.rs.Consumes
import javax.ws.rs.DELETE
import javax.ws.rs.POST
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.QueryParam
import javax.ws.rs.core.MediaType
import com.tencent.devops.common.api.pojo.Result

@Api(tags = ["OP_OAUTH2"], description = "oauth2相关-op接口")
@Path("/op/oauth2/")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
interface OpOauth2Resource {
@POST
@Path("/createClientDetails")
@ApiOperation("新增Oauth2客户端信息")
fun createClientDetails(
@ApiParam("Oauth2客户端请求实体", required = true)
clientDetailsDTO: ClientDetailsDTO
): Result<Boolean>

@DELETE
@Path("/deleteClientDetails")
@ApiOperation("删除Oauth2客户端信息")
fun deleteClientDetails(
@ApiParam("客户端ID", required = true)
@QueryParam("clientId")
clientId: String
): Result<Boolean>

@POST
@Path("/createScopeOperation")
@ApiOperation("新增Oauth2授权操作信息")
fun createScopeOperation(
@ApiParam("Oauth2授权操作信息请求实体", required = true)
scopeOperationDTO: ScopeOperationDTO
): Result<Boolean>

@DELETE
@Path("/deleteScopeOperation")
@ApiOperation("删除Oauth2授权操作信息")
fun deleteScopeOperation(
@ApiParam("授权操作ID", required = true)
@QueryParam("operationId")
operationId: String
): Result<Boolean>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.tencent.devops.auth.api.service

import com.tencent.devops.auth.pojo.vo.UserAndDeptInfoVo
import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID
import com.tencent.devops.common.api.pojo.Result
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import javax.ws.rs.Consumes
import javax.ws.rs.GET
import javax.ws.rs.HeaderParam
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.QueryParam
import javax.ws.rs.core.MediaType

@Api(tags = ["SERVICE_SECURITY"], description = "安全相关")
@Path("/service/security")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
interface ServiceSecurityResource {
@GET
@Path("/getUserSecurityInfo")
@ApiOperation("获取安全相关信息")
fun getUserSecurityInfo(
@HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
@ApiParam("用户ID", required = true)
userId: String,
@ApiParam("项目ID", required = true)
@QueryParam("projectCode")
projectCode: String
): Result<UserAndDeptInfoVo>
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,24 @@ object AuthMessageCode {
const val ERROR_MIGRATE_AUTH_COMPARE_FAIL = "2121061" // 迁移项目{0}失败,权限策略对比失败
const val ERROR_CREATOR_NOT_EXIST = "2121062" // 创建人离职
const val ERROR_RESOURCE_CREATE_FAIL = "2121063" // 资源创建失败
const val ERROR_CLIENT_NOT_EXIST = "2121064" // 客户端{0}不存在
const val INVALID_AUTHORIZATION_TYPE = "2121065" // 授权类型{0}不合法
const val INVALID_REDIRECT_URI = "2121066" // 跳转链接{0}不合法
const val INVALID_CLIENT_SECRET = "2121067" // 客户端{0}密钥不合法
const val INVALID_AUTHORIZATION_CODE = "2121068" // 授权码不合法
const val INVALID_AUTHORIZATION_EXPIRED = "2121069" // 授权码已过期
const val ERROR_REFRESH_TOKEN_NOT_FOUND = "2121070" // refresh_token不能为空
const val INVALID_REFRESH_TOKEN = "2121071" // refresh_token不合法
const val ERROR_REFRESH_TOKEN_EXPIRED = "2121072" // refresh token已过期
const val ERROR_ACCESS_TOKEN_NOT_FOUND = "2121073" // access token不能为空
const val INVALID_ACCESS_TOKEN = "2121074" // access token不合法
const val ERROR_ACCESS_TOKEN_EXPIRED = "2121075" // access token已过期
const val INVALID_SCOPE = "2121076" // scope不合法

const val ERROR_MONITOR_SPACE_NOT_EXIST = "2121077" // 监控空间不存在
const val ERROR_MONITOR_READ_ONLY_ACTIONS_NOT_EXIST = "2121078" // 业务只读组不存在
const val ERROR_MONITOR_OPS_ACTIONS_NOT_EXIST = "2121079" // 业务运维组不存在

const val ERROR_WATER_MARK_NOT_EXIST = "2121080" // 水印信息不存在
const val ERROR_USER_NOT_EXIST = "2121081" // 用户不存在
}
Loading

0 comments on commit ce58e9c

Please sign in to comment.