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
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@ -18,6 +18,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 {
|
||||||
@ -80,6 +81,7 @@ pipeline {
|
|||||||
def latestImage = "${base}:latest"
|
def latestImage = "${base}:latest"
|
||||||
echo "Building ${svc}:${ver}..."
|
echo "Building ${svc}:${ver}..."
|
||||||
bat """
|
bat """
|
||||||
|
chcp 65001 >nul
|
||||||
docker login ${ACR_REGISTRY} -u ${ACR_USERNAME} -p %ACR_PASS%
|
docker login ${ACR_REGISTRY} -u ${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
|
||||||
@ -110,6 +112,7 @@ pipeline {
|
|||||||
echo "Deploying ${svc}..."
|
echo "Deploying ${svc}..."
|
||||||
retry(2) {
|
retry(2) {
|
||||||
bat """
|
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"
|
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()
|
""".stripIndent()
|
||||||
writeFile file: 'update_versions.py', text: updateScript
|
writeFile file: 'update_versions.py', text: updateScript
|
||||||
bat """
|
bat """
|
||||||
|
chcp 65001 >nul
|
||||||
scp -i "%SSH_KEY%" -o StrictHostKeyChecking=no update_versions.py ${PROD_USER}@${PROD_HOST}:/tmp/update_versions.py
|
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"
|
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 versionFiles = serviceVersions.keySet().collect { "VERSION.${it}" }.join(' ')
|
||||||
def summary = serviceVersions.collect { svc, ver -> "${svc}=${ver}" }.join(', ')
|
def summary = serviceVersions.collect { svc, ver -> "${svc}=${ver}" }.join(', ')
|
||||||
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 ${versionFiles}
|
git add ${versionFiles}
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户