fix(jenkins): 修复Jenkins构建中的字符编码和API参数问题

- 在Jenkinsfile中添加JAVA_TOOL_OPTIONS环境变量设置UTF-8编码
- 在Windows批处理命令前添加chcp 65001命令解决中文字符显示问题
- 修复BugCollectIssues组件中API参数从type改为level
- 修复BugCollectWebhooks组件中API字段映射eventTypes到events和cooldownSeconds到cooldownSec
- 更新webhook请求数据结构以匹配后端API要求
这个提交包含在:
XuqmGroup 2026-06-18 11:14:34 +08:00
父节点 66414f7987
当前提交 eb85e53d3f
共有 3 个文件被更改,包括 25 次插入13 次删除

5
Jenkinsfile vendored
查看文件

@ -16,6 +16,7 @@ pipeline {
COMPOSE_FILE = '/opt/xuqm/deploy/compose.production.yaml' COMPOSE_FILE = '/opt/xuqm/deploy/compose.production.yaml'
VERSIONS_FILE = '/opt/xuqm/deploy/versions.json' VERSIONS_FILE = '/opt/xuqm/deploy/versions.json'
DOCKER_BUILDKIT = '1' DOCKER_BUILDKIT = '1'
JAVA_TOOL_OPTIONS = '-Dfile.encoding=UTF-8 -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8'
} }
options { options {
@ -81,6 +82,7 @@ pipeline {
: "--build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${latestImage}" : "--build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${latestImage}"
def gitCommit = env.GIT_COMMIT ?: 'unknown' def gitCommit = env.GIT_COMMIT ?: 'unknown'
bat """ bat """
chcp 65001 >nul
docker login ${env.ACR_REGISTRY} -u ${env.ACR_USERNAME} -p %ACR_PASS% docker login ${env.ACR_REGISTRY} -u ${env.ACR_USERNAME} -p %ACR_PASS%
if %errorlevel% neq 0 exit /b 1 if %errorlevel% neq 0 exit /b 1
docker pull --platform=linux/amd64 ${latestImage} || echo Pull failed, will build fresh docker pull --platform=linux/amd64 ${latestImage} || echo Pull failed, will build fresh
@ -107,6 +109,7 @@ pipeline {
def latestImage = "${env.ACR_REGISTRY}/${env.ACR_NAMESPACE}/${env.IMAGE_NAME}:latest" def latestImage = "${env.ACR_REGISTRY}/${env.ACR_NAMESPACE}/${env.IMAGE_NAME}:latest"
retry(2) { retry(2) {
bat """ bat """
chcp 65001 >nul
ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${env.PROD_USER}@${env.PROD_HOST} "docker image prune -f 2>/dev/null || true; docker pull ${latestImage} || exit 1; docker compose -f ${env.COMPOSE_FILE} up -d --no-deps --force-recreate ${env.DEPLOY_SERVICE} || exit 1; docker image prune -f" ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${env.PROD_USER}@${env.PROD_HOST} "docker image prune -f 2>/dev/null || true; docker pull ${latestImage} || exit 1; docker compose -f ${env.COMPOSE_FILE} up -d --no-deps --force-recreate ${env.DEPLOY_SERVICE} || exit 1; docker image prune -f"
""" """
} }
@ -129,6 +132,7 @@ print('versions.json updated: ${svcName}=${svcVer}')
""".stripIndent() """.stripIndent()
writeFile file: 'update_versions_web.py', text: updateScript writeFile file: 'update_versions_web.py', text: updateScript
bat """ bat """
chcp 65001 >nul
scp -i "%SSH_KEY%" -o StrictHostKeyChecking=no update_versions_web.py ${env.PROD_USER}@${env.PROD_HOST}:/tmp/update_versions_web.py scp -i "%SSH_KEY%" -o StrictHostKeyChecking=no update_versions_web.py ${env.PROD_USER}@${env.PROD_HOST}:/tmp/update_versions_web.py
ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${env.PROD_USER}@${env.PROD_HOST} "python3 /tmp/update_versions_web.py && rm /tmp/update_versions_web.py" ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${env.PROD_USER}@${env.PROD_HOST} "python3 /tmp/update_versions_web.py && rm /tmp/update_versions_web.py"
""" """
@ -141,6 +145,7 @@ print('versions.json updated: ${svcName}=${svcVer}')
stage('Commit Version') { stage('Commit Version') {
steps { steps {
bat """ bat """
chcp 65001 >nul
git config user.email "jenkins@xuqm.com" git config user.email "jenkins@xuqm.com"
git config user.name "Jenkins CI" git config user.name "Jenkins CI"
git add ${env.VERSION_FILE} git add ${env.VERSION_FILE}

查看文件

@ -138,7 +138,7 @@ async function loadData() {
loading.value = true loading.value = true
try { try {
const res = await bugCollectApi.issues(appKey.value, { const res = await bugCollectApi.issues(appKey.value, {
type: filters.value.type || undefined, level: filters.value.type || undefined,
platform: filters.value.platform || undefined, platform: filters.value.platform || undefined,
startDate: filters.value.dateRange?.[0] || undefined, startDate: filters.value.dateRange?.[0] || undefined,
endDate: filters.value.dateRange?.[1] || undefined, endDate: filters.value.dateRange?.[1] || undefined,

查看文件

@ -137,8 +137,8 @@ function openDialog(row?: BugCollectWebhook) {
editingId.value = row.id editingId.value = row.id
form.value = { form.value = {
url: row.url, url: row.url,
eventTypes: [...row.eventTypes], eventTypes: [...row.events],
cooldownSeconds: row.cooldownSeconds, cooldownSeconds: row.cooldownSec,
enabled: row.enabled, enabled: row.enabled,
} }
} else { } else {
@ -152,11 +152,18 @@ async function handleSave() {
if (!form.value.url || !form.value.eventTypes.length) return if (!form.value.url || !form.value.eventTypes.length) return
saving.value = true saving.value = true
try { try {
const requestData = {
appKey: appKey.value,
url: form.value.url,
events: form.value.eventTypes,
cooldownSec: form.value.cooldownSeconds,
enabled: form.value.enabled,
}
if (editingId.value) { if (editingId.value) {
await bugCollectApi.webhooks.update(editingId.value, form.value) await bugCollectApi.webhooks.update(editingId.value, requestData)
ElMessage.success('更新成功') ElMessage.success('更新成功')
} else { } else {
await bugCollectApi.webhooks.create(appKey.value, form.value) await bugCollectApi.webhooks.create(requestData)
ElMessage.success('创建成功') ElMessage.success('创建成功')
} }
dialogVisible.value = false dialogVisible.value = false