fix(ci): 修复凭据ID、Windows兼容性和post块上下文
这个提交包含在:
父节点
141f5e3e30
当前提交
2247c1146e
33
Jenkinsfile
vendored
33
Jenkinsfile
vendored
@ -29,8 +29,7 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
NEXUS_USER = credentials('nexus-android-user')
|
||||
NEXUS_PASS = credentials('nexus-android-pass')
|
||||
NEXUS_CREDS = credentials('NEXUS_CREDS')
|
||||
}
|
||||
|
||||
stages {
|
||||
@ -86,8 +85,8 @@ pipeline {
|
||||
script {
|
||||
if (!params.CUSTOM_VERSION) {
|
||||
// 从 gradle.properties 读取当前版本号
|
||||
def currentVer = sh(
|
||||
script: "grep '^PUBLISH_VERSION=' gradle.properties | cut -d= -f2",
|
||||
def currentVer = bat(
|
||||
script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "Current PUBLISH_VERSION: ${currentVer}"
|
||||
@ -113,7 +112,7 @@ pipeline {
|
||||
echo "Auto-bumped PUBLISH_VERSION: ${currentVer} → ${newVer}"
|
||||
|
||||
// 更新 gradle.properties
|
||||
sh "sed -i '' 's/^PUBLISH_VERSION=.*/PUBLISH_VERSION=${newVer}/' gradle.properties"
|
||||
bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${newVer}' | Set-Content gradle.properties\""
|
||||
|
||||
// 用新版本号重建所有模块的 VERSION_ARGS
|
||||
def modules = env.PUBLISH_MODULES.split(',').toList()
|
||||
@ -209,7 +208,7 @@ pipeline {
|
||||
script {
|
||||
def modules = env.PUBLISH_MODULES.split(',').toList()
|
||||
def publishTasks = modules.collect { ":${it}:publish" }.join(' ')
|
||||
def credArgs = "-PNEXUS_USER=%NEXUS_USER% -PNEXUS_PASSWORD=%NEXUS_PASS%"
|
||||
def credArgs = "-PNEXUS_USER=%NEXUS_CREDS_USR% -PNEXUS_PASSWORD=%NEXUS_CREDS_PSW%"
|
||||
bat "gradlew.bat ${publishTasks} ${env.VERSION_ARGS} ${credArgs} --no-daemon"
|
||||
}
|
||||
}
|
||||
@ -218,15 +217,23 @@ pipeline {
|
||||
|
||||
post {
|
||||
always {
|
||||
bat 'adb emu kill || exit 0'
|
||||
archiveArtifacts artifacts: 'test-results-*.txt, cross-*.txt', allowEmptyArchive: true
|
||||
script {
|
||||
node {
|
||||
bat 'adb emu kill || exit 0'
|
||||
archiveArtifacts artifacts: 'test-results-*.txt, cross-*.txt', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
bat '''
|
||||
adb -s emulator-5554 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5554.txt || exit 0
|
||||
adb -s emulator-5556 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5556.txt || exit 0
|
||||
'''
|
||||
archiveArtifacts artifacts: 'logcat-*.txt', allowEmptyArchive: true
|
||||
script {
|
||||
node {
|
||||
bat '''
|
||||
adb -s emulator-5554 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5554.txt || exit 0
|
||||
adb -s emulator-5556 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5556.txt || exit 0
|
||||
'''
|
||||
archiveArtifacts artifacts: 'logcat-*.txt', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
success { echo "Android SDK 构建成功" }
|
||||
}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户