更新jenkins脚本
parent
14a2c4af7c
commit
94ba4e3010
|
|
@ -135,27 +135,71 @@ pipeline {
|
|||
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/build_tools/"
|
||||
}
|
||||
}
|
||||
stage('修改渠道文件夹') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// 先安装pyyaml
|
||||
sh "pip3 install pyyaml --user"
|
||||
// 调用python脚本修改渠道文件夹
|
||||
echo "根据 [${params.Channel}] 渠道修改文件夹"
|
||||
def channelPath = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}"
|
||||
def sdkPath = "${WORKSPACE}/Tool/sdk_packages"
|
||||
echo "Channel Path: ${channelPath}"
|
||||
echo "SDK Path: ${sdkPath}"
|
||||
// python脚本: Tool/py_tools/PreHandle.py <sdk_path> <channel_path>
|
||||
sh "chmod +x $WORKSPACE/Tool/py_tools/PreHandle.py"
|
||||
// 使用 returnStatus 获取脚本的退出码
|
||||
def pythonResult = sh(script: "python3 $WORKSPACE/Tool/py_tools/PreHandle.py ${sdkPath} ${channelPath}", returnStatus: true)
|
||||
if (pythonResult != 0) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】修改渠道文件夹失败: pythonResult=${pythonResult}"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】根据渠道修改工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据渠道修改工程') {
|
||||
steps {
|
||||
echo "根据 [${params.Channel}] 渠道修改工程"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/modify_project_by_channel.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/modify_project_by_channel.sh $WORKSPACE ${CHANNEL_PARAM}"
|
||||
script {
|
||||
try {
|
||||
echo "根据 [${params.Channel}] 渠道修改工程"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/modify_project_by_channel.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/modify_project_by_channel.sh $WORKSPACE ${CHANNEL_PARAM}"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】根据渠道修改工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '根据渠道修改工程' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据渠道获取相关参数') {
|
||||
steps {
|
||||
script {
|
||||
echo "根据 [${params.Channel}] 渠道获取相关参数"
|
||||
def playersettings = "$WORKSPACE/Tool/Channels/$CHANNEL_PARAM/ChannelSetting.txt"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/get_build_version.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/get_build_upload_path.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/get_build_assets_end_point.sh"
|
||||
VERSION_PARAM = sh(script: "$WORKSPACE/Tool/build_tools/get_build_version.sh $playersettings", returnStdout: true).trim()
|
||||
OSS_UPLOAD_PATH_PARAM = sh(script: "$WORKSPACE/Tool/build_tools/get_build_upload_path.sh $playersettings", returnStdout: true).trim()
|
||||
ASSETS_END_POINT_PARAM = sh(script: "$WORKSPACE/Tool/build_tools/get_build_assets_end_point.sh $playersettings", returnStdout: true).trim()
|
||||
BUILD_PATH = "Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
log_path="$BUILD_PATH/build.log"
|
||||
echo "获取到的版本是 ${VERSION_PARAM}, 获取到的上传地址是 ${OSS_UPLOAD_PATH_PARAM},获取到的assets-oss-endpoint是 ${ASSETS_END_POINT_PARAM}"
|
||||
try {
|
||||
echo "根据 [${params.Channel}] 渠道获取相关参数"
|
||||
def playersettings = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}/ChannelSetting.yaml"
|
||||
// 1. 读取并解析 YAML,得到一个 Groovy Map
|
||||
def cfg = readYaml(file: playersettings)
|
||||
// 2. 提取字段 根据 YAML 键名取值
|
||||
VERSION_PARAM = (cfg?.Version ?: '').trim()
|
||||
OSS_UPLOAD_PATH_PARAM = (cfg?.OssRemoteUploadPath ?: '').trim()
|
||||
ASSETS_END_POINT_PARAM = (cfg?.AssetsEndPoint ?: '').trim()
|
||||
// 3.其他数据
|
||||
BUILD_PATH = "Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
log_path="$BUILD_PATH/build.log"
|
||||
echo "获取到的版本是 ${VERSION_PARAM}, 获取到的上传地址是 ${OSS_UPLOAD_PATH_PARAM},获取到的assets-oss-endpoint是 ${ASSETS_END_POINT_PARAM}"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】根据渠道获取相关参数失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '根据渠道获取相关参数' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -239,9 +283,13 @@ pipeline {
|
|||
// 增量更新不需要上传符号表
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_symbol_file.sh"
|
||||
if (params.Build_InitApp == true){
|
||||
def playersettings = "$WORKSPACE/Tool/Channels/$CHANNEL_PARAM/ChannelSetting.txt"
|
||||
def playersettings = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}/ChannelSetting.yaml"
|
||||
def symbol_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
def upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${symbol_path} ${playersettings}", returnStatus: true, returnStdout: false)
|
||||
|
||||
def crashsightConfig = cfg?."CrashSight_${PLATFORM_PARAM}"
|
||||
def crashsightId = (crashsightConfig?.id ?: '').trim()
|
||||
def crashsightKey = (crashsightConfig?.key ?: '').trim()
|
||||
def upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${symbol_path} ${crashsightId} ${crashsightKey}", returnStatus: true, returnStdout: false)
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】上传符号表异常"
|
||||
|
|
|
|||
Loading…
Reference in New Issue