【打包】测试脚本
parent
ab7b1289a2
commit
8969d467a1
|
|
@ -126,6 +126,33 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('修改渠道文件夹') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// 调用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}】【Debug】【${CHANNEL_PARAM}】修改渠道文件夹失败: pythonResult=${pythonResult}"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】根据渠道修改工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据渠道修改工程') {
|
||||
steps {
|
||||
script {
|
||||
|
|
|
|||
|
|
@ -4,21 +4,25 @@ import os
|
|||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
print("Usage: python PreHandle.py <SDK_PATH> <ChannelPath>")
|
||||
return
|
||||
sys.exit(1) # 参数不足时返回错误码1
|
||||
|
||||
sdk_path = sys.argv[1]
|
||||
channel_path = sys.argv[2]
|
||||
|
||||
if not os.path.exists(sdk_path):
|
||||
print(f"Error: SDK path '{sdk_path}' does not exist.")
|
||||
return
|
||||
sys.exit(2) # SDK路径不存在时返回错误码2
|
||||
|
||||
if not os.path.exists(channel_path):
|
||||
print(f"Error: Channel path '{channel_path}' does not exist.")
|
||||
return
|
||||
sys.exit(3) # Channel路径不存在时返回错误码3
|
||||
|
||||
# 这里可以添加更多的处理逻辑
|
||||
print(f"SDK Path: {sdk_path}")
|
||||
print(f"Channel Path: {channel_path}")
|
||||
|
||||
main()
|
||||
# 临时返回错误,中断后续流程
|
||||
sys.exit(-1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in New Issue