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要求
这个提交包含在:
父节点
fbc9d02e2a
当前提交
0a6ea7777e
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -10,14 +10,15 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
ACR_REGISTRY = 'crpi-n44qjpuucgjt8e8c.cn-beijing.personal.cr.aliyuncs.com'
|
||||
ACR_NAMESPACE = 'xuqmgroup'
|
||||
ACR_USERNAME = 'xuqinmin12'
|
||||
PROD_HOST = '106.54.23.149'
|
||||
PROD_USER = 'ubuntu'
|
||||
COMPOSE_FILE = '/opt/xuqm/deploy/compose.production.yaml'
|
||||
VERSIONS_FILE = '/opt/xuqm/deploy/versions.json'
|
||||
DOCKER_BUILDKIT = '1'
|
||||
ACR_REGISTRY = 'crpi-n44qjpuucgjt8e8c.cn-beijing.personal.cr.aliyuncs.com'
|
||||
ACR_NAMESPACE = 'xuqmgroup'
|
||||
ACR_USERNAME = 'xuqinmin12'
|
||||
PROD_HOST = '106.54.23.149'
|
||||
PROD_USER = 'ubuntu'
|
||||
COMPOSE_FILE = '/opt/xuqm/deploy/compose.production.yaml'
|
||||
VERSIONS_FILE = '/opt/xuqm/deploy/versions.json'
|
||||
DOCKER_BUILDKIT = '1'
|
||||
JAVA_TOOL_OPTIONS = '-Dfile.encoding=UTF-8 -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8'
|
||||
}
|
||||
|
||||
options {
|
||||
@ -80,6 +81,7 @@ pipeline {
|
||||
def latestImage = "${base}:latest"
|
||||
echo "Building ${svc}:${ver}..."
|
||||
bat """
|
||||
chcp 65001 >nul
|
||||
docker login ${ACR_REGISTRY} -u ${ACR_USERNAME} -p %ACR_PASS%
|
||||
if %errorlevel% neq 0 exit /b 1
|
||||
docker pull --platform=linux/amd64 ${latestImage} || echo Pull failed, will build fresh
|
||||
@ -110,6 +112,7 @@ pipeline {
|
||||
echo "Deploying ${svc}..."
|
||||
retry(2) {
|
||||
bat """
|
||||
chcp 65001 >nul
|
||||
ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST} "docker image prune -f 2>/dev/null || true; docker pull ${latestImage} || exit 1; docker compose -f ${COMPOSE_FILE} up -d --no-deps --force-recreate ${svc} || exit 1; docker image prune -f"
|
||||
"""
|
||||
}
|
||||
@ -145,6 +148,7 @@ print('versions.json updated, platformVersion=' + d.get('platformVersion', ''))
|
||||
""".stripIndent()
|
||||
writeFile file: 'update_versions.py', text: updateScript
|
||||
bat """
|
||||
chcp 65001 >nul
|
||||
scp -i "%SSH_KEY%" -o StrictHostKeyChecking=no update_versions.py ${PROD_USER}@${PROD_HOST}:/tmp/update_versions.py
|
||||
ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST} "python3 /tmp/update_versions.py && rm /tmp/update_versions.py"
|
||||
"""
|
||||
@ -161,6 +165,7 @@ print('versions.json updated, platformVersion=' + d.get('platformVersion', ''))
|
||||
def versionFiles = serviceVersions.keySet().collect { "VERSION.${it}" }.join(' ')
|
||||
def summary = serviceVersions.collect { svc, ver -> "${svc}=${ver}" }.join(', ')
|
||||
bat """
|
||||
chcp 65001 >nul
|
||||
git config user.email "jenkins@xuqm.com"
|
||||
git config user.name "Jenkins CI"
|
||||
git add ${versionFiles}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户