Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pref-9366' into pref-9366
Browse files Browse the repository at this point in the history
  • Loading branch information
yjieliang committed Oct 26, 2023
2 parents 50e9bab + 0c7a888 commit 787a9db
Show file tree
Hide file tree
Showing 16 changed files with 389 additions and 162 deletions.
54 changes: 54 additions & 0 deletions CHANGELOG/CHANGELOG-1.13.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<!-- BEGIN MUNGE: GENERATED_TOC -->

- [v1.13.0-rc.4](#v1130-rc4)
- [Changelog since v1.13.0-rc.3](#changelog-since-v1130-rc3)
- [v1.13.0-rc.3](#v1130-rc3)
- [Changelog since v1.13.0-rc.2](#changelog-since-v1130-rc2)
- [v1.13.0-rc.2](#v1130-rc2)
- [Changelog since v1.12.0-rc.8](#changelog-since-v1120-rc8)

Expand All @@ -7,6 +12,55 @@


<!-- NEW RELEASE NOTES ENTRY -->

# v1.13.0-rc.4
## Changelog since v1.13.0-rc.3
#### 新增
- [新增] 新增判断是否是项目成员user态接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9569)
- [新增] 新增获取部门员工信息接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9570)
- [新增] 支持开通蓝盾项目权限的同时开通对应的监控空间权限 [链接](http://github.com/TencentBlueKing/bk-ci/issues/8935)
- [新增] 增加获取项目信息及成员信息接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9392)
- [新增] 接入审计中心 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9414)
- [新增] fit-sec线权限升级支持 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9521)
- [新增] 优化Env模块的日志打印逻辑 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9470)
- [新增] user类接口传递网关token [链接](http://github.com/TencentBlueKing/bk-ci/issues/9482)
- [新增] build_msg需要根据事件触发场景细化 [链接](http://github.com/TencentBlueKing/bk-ci/issues/8831)
- [新增] bkrepo客户端新增apk加固接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9423)
- [新增] 新增不用SQL检查的代码 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9346)

#### 优化
- [优化] 静态资源文件的url地址域名支持适配特定环境 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9504)
- [优化] metrics接口优化补充,调整项目下插件信息来源 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9488)
- [优化] 增加国际化初始化配置 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9413)

#### 修复
- [修复] 获取子流水线执行状态接口不需要做权限校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9552)
- [修复] 查看研发商店的模版时,若插件可见范围符合要求,不应该提示项目xxx不允许使用插件xxx [链接](http://github.com/TencentBlueKing/bk-ci/issues/9531)
- [修复] 增加开源版插件的task.json的packagePath字段的非空校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9509)
- [修复] 删除流水线后,未删除制品库中流水线的资源 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9491)

# v1.13.0-rc.3
## Changelog since v1.13.0-rc.2
#### 新增
- [新增] yaml 方式下,mr 触发器支持配置是否阻塞 mr 合并 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9412)
- [新增] auth服务异常信息规范 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9455)
- [新增] 研发商店插件的质量红线指标支持占位符 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9506)
- [新增] 日志组件文件名错误 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9502)
- [新增] 蓝盾权限-支持查询某单一资源的用户组人员名单 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9116)
- [新增] 修改日志请求地址 & 支持 devx 跳转路径 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9495)
- [新增] [stream] 构建结束默认消息通知内容有误 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9485)
- [新增] project的op接口支持查询remotedev类型 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9472)
- [新增] 人工审核插件参数支持变量 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9373)
- [新增] 对接RBAC权限优化 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9149)

#### 优化
- [优化] 支持将分区库里的项目的数据迁移至指定数据库优化 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9494)

#### 修复
- [修复] 申请加入组bug修复 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9512)
- [修复] 调用权限中心接口增加重试 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9477)
- [修复] 共享凭据不需要依赖插件敏感接口权限校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9398)

# v1.13.0-rc.2
## Changelog since v1.12.0-rc.8
#### 新增
Expand Down
1 change: 1 addition & 0 deletions src/backend/ci/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ allprojects {
entry("org.eclipse.jgit.ssh.jsch")
}
dependency("com.tencent.bk.sdk:iam-java-sdk:${Versions.iam}")
dependency("com.jakewharton:disklrucache:${Versions.disklrucache}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ object Versions {
const val Okhttp = "4.9.0"
const val jgit = "5.13.1.202206130422-r"
const val iam = "1.0.39-SNAPSHOT"
const val disklrucache = "2.0.2"
}
1 change: 1 addition & 0 deletions src/backend/ci/core/common/common-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ dependencies {
api("org.apache.commons:commons-csv")
api("com.github.ben-manes.caffeine:caffeine")
api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
api("com.jakewharton:disklrucache")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.tencent.devops.common.api.cache

import com.jakewharton.disklrucache.DiskLruCache
import com.tencent.devops.common.api.util.ShaUtils
import org.slf4j.LoggerFactory
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.IOException

/**
* 蓝盾文件磁盘缓存
*/
class BkDiskLruFileCache(
private val cacheDir: String,
private val cacheSize: Long
) {

private val diskCache: DiskLruCache = DiskLruCache.open(File(cacheDir), 1, 1, cacheSize)

companion object {
private const val BUFFER_SIZE = 1024
private val logger = LoggerFactory.getLogger(BkDiskLruFileCache::class.java)
}

/**
* 把文件放入磁盘缓存
* @param key 磁盘缓存key
* @param inputFile 缓存文件
*/
@Throws(IOException::class)
fun put(key: String, inputFile: File) {
// 根据key获取缓存编辑器(为了保证key格式符合DiskLruCache规范,key需要用sha算法计算出散列值进行转换)
val editor = diskCache.edit(ShaUtils.sha256(key)) ?: return
// 如果编辑器不为空,把文件写入磁盘缓存
FileInputStream(inputFile).use { inputStream ->
editor.newOutputStream(0).use { outputStream ->
val buffer = ByteArray(BUFFER_SIZE)
var bytesRead: Int
while (inputStream.read(buffer).also { bytesRead = it } != -1) {
outputStream.write(buffer, 0, bytesRead)
}
}
}
editor.commit()
// 手动触发淘汰策略
diskCache.flush()
}

/**
* 从磁盘缓存中获取文件到指定位置
* @param key 磁盘缓存key
* @param outputFile 输出文件
*/
@Throws(IOException::class)
fun get(key: String, outputFile: File) {
// 根据key从磁盘缓存获取snapshot对象
val snapshot = diskCache[ShaUtils.sha256(key)]
snapshot?.getInputStream(0)?.use { inputStream ->
// 将snapshot对象输出流写入输出文件
FileOutputStream(outputFile).use { outputStream ->
val buffer = ByteArray(BUFFER_SIZE)
var bytesRead: Int
while (inputStream.read(buffer).also { bytesRead = it } != -1) {
outputStream.write(buffer, 0, bytesRead)
}
}
}
// 将文件设置为可执行文件
if (outputFile.exists()) {
val success = outputFile.setExecutable(true)
if (success) {
logger.info("file[${outputFile.absolutePath}] execution permission added successfully.")
} else {
logger.warn("file[${outputFile.absolutePath}] failed to add execution permission.")
}
}
}

/**
* 从磁盘缓存中移除缓存对象
* @param key 磁盘缓存key
*/
@Throws(IOException::class)
fun remove(key: String) {
diskCache.remove(ShaUtils.sha256(key))
}

/**
* 关闭缓存
*/
@Throws(IOException::class)
fun close() {
diskCache.close()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.common.api.factory

import com.tencent.devops.common.api.cache.BkDiskLruFileCache

object BkDiskLruFileCacheFactory {

fun getDiskLruFileCache(
cacheDir: String,
cacheSize: Long
): BkDiskLruFileCache {
return BkDiskLruFileCache(cacheDir, cacheSize)
}
}
1 change: 1 addition & 0 deletions src/backend/ci/core/common/common-redis/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ dependencies {
implementation("io.micrometer:micrometer-core")
api("org.springframework.boot:spring-boot-starter-data-redis")
api("org.apache.commons:commons-pool2")
api("com.github.ben-manes.caffeine:caffeine")
}
Loading

0 comments on commit 787a9db

Please sign in to comment.