Skip to content

Commit

Permalink
Merge branch 'TencentBlueKing:master' into issue_2765
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 authored Dec 26, 2024
2 parents 7e93bdb + b4eb20b commit b1d844a
Show file tree
Hide file tree
Showing 73 changed files with 10,345 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,16 @@ if [[ $ALL -eq 1 || $BACKEND -eq 1 ]] ; then
for SERVICE in "${BACKENDS[@]}";
do
log "构建${SERVICE}镜像..."
if [[ $SERVICE == "preview" ]]; then
DOCKERFILE="$IMAGE_DIR/backend/preview.Dockerfile"
else
DOCKERFILE="$IMAGE_DIR/backend/backend.Dockerfile"
fi
$BACKEND_DIR/gradlew -p $BACKEND_DIR :$SERVICE:boot-$SERVICE:build -P'devops.assemblyMode'=k8s -x test
rm -rf $tmp_dir/*
cp $IMAGE_DIR/backend/startup.sh $tmp_dir/
cp $BACKEND_DIR/release/boot-$SERVICE.jar $tmp_dir/app.jar
docker build -f $IMAGE_DIR/backend/backend.Dockerfile -t $REGISTRY/$NAMESPACE/bkrepo-$SERVICE:$VERSION $tmp_dir --network=host
docker build -f $DOCKERFILE -t $REGISTRY/$NAMESPACE/bkrepo-$SERVICE:$VERSION $tmp_dir --network=host
if [[ $PUSH -eq 1 ]] ; then
docker push $REGISTRY/$NAMESPACE/bkrepo-$SERVICE:$VERSION
fi
Expand Down
4 changes: 4 additions & 0 deletions src/backend/buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ object Versions {
const val Notice = "1.0.0"
const val SpringCloudFunction = "3.2.11"
const val Audit = "1.0.8"
const val JodConverter = "4.4.6"
const val Galimatias = "0.2.1"
const val CommonsNet = "3.9.0"
const val JuniversalCharDet = "1.0.3"
}
37 changes: 37 additions & 0 deletions src/backend/preview/api-preview/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.
*/

dependencies {
api(project(":common:common-api"))
api(project(":repository:api-repository"))
api(project(":auth:api-auth"))
compileOnly("org.springframework:spring-web")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.bkrepo.preview.artifact

import com.tencent.bkrepo.common.artifact.api.ArtifactInfo

class PreviewArtifactInfo(
projectId: String,
repoName: String,
artifactUri: String
) : ArtifactInfo(projectId, repoName, artifactUri) {
companion object {
const val PREVIEW_BKREPO_MAPPING_URI = "/api/file/onlinePreview/{projectId}/{repoName}/**"
const val PREVIEW_REMOTE_MAPPING_URI = "/api/file/onlinePreview"
const val PREVIEW_INFO_REMOTE_MAPPING_URI = "/api/file/getPreviewInfo"
const val PREVIEW_INFO_BKREPO_MAPPING_URI = "/api/file/getPreviewInfo/{projectId}/{repoName}/**"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.bkrepo.preview.constant

const val BKREPO_PREFIX = "X-BKREPO-"

// 节点详情
const val PREVIEW_NODE_DETAIL = BKREPO_PREFIX + "PREVIEW_NODE_DETAIL"
// 临时文件保存路径
const val PREVIEW_TMP_FILE_SAVE_PATH = BKREPO_PREFIX + "PREVIEW_TMP_FILE_SAVE_PATH"
// 是否把制品流保存至文件
const val PREVIEW_ARTIFACT_TO_FILE = BKREPO_PREFIX + "PREVIEW_ARTIFACT_TO_FILE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.bkrepo.preview.constant

import com.tencent.bkrepo.common.api.message.MessageCode

enum class PreviewMessageCode(private val key: String) : MessageCode {
PREVIEW_FILE_NOT_FOUND("preview.file.not-found"),
PREVIEW_NODE_NOT_FOUND("preview.node.not-found"),
PREVIEW_REPO_NOT_FOUND("preview.repo.not-found"),
PREVIEW_FIlE_CONVERT_ERROR("preview.file.convert.error"),
PREVIEW_FILE_SIZE_LIMIT_ERROR("preview.file.size.limit.error"),
PREVIEW_FILE_NOT_SUPPORT_ERROR("preview.file.not-support"),
PREVIEW_PARAMETER_INVALID("preview.parameter.invalid")
;

override fun getBusinessCode() = ordinal + 1
override fun getKey() = key
override fun getModuleCode() = 26
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.bkrepo.preview.pojo

/**
* 下载结果
*/
data class DownloadResult(
var code: Int = CODE_SUCCESS,
var filePath: String? = null,
var msg: String? = null,
var size: Long = 0,
var md5: String? = null
) {
companion object {
const val CODE_SUCCESS = 0
const val CODE_FAIL = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2020 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.bkrepo.preview.pojo

import io.swagger.annotations.ApiModel

@ApiModel("预览文件信息")
data class FileAttribute (
// 存储类型:0-bkrepo文件,1-远程文件
var storageType: Int = 0,

// 项目id,bkrepo文件需要
var projectId: String? = null,

// 仓库名称,bkrepo文件需要
var repoName: String? = null,

// 文件全路径,bkrepo文件需要
var artifactUri: String? = null,

// 文件名称
var fileName: String? = null,

// 文件的完整下载地址,远程文件需要
var url: String? = null,

// 文件的md5
var md5: String? = null,

// 文件大小(byte)
var size: Long = 0,

// office预览类型(image / pdf)
val officePreviewType: String = "pdf",

// 转换后的文件路径
var outFilePath: String? = null,
// 下载文件保存路径
var originFilePath: String? = null,
// 转换后的文件名
var convertFileName: String? = null,

// 最终文件临时路径
var finalFilePath: String? = null,

// xlsx是否转成html
var isHtmlView: Boolean = false,

// 文件类型
var type: FileType? = null,

// 文件后缀
var suffix: String? = null,
)
Loading

0 comments on commit b1d844a

Please sign in to comment.