jenkins uploadapk
This commit is contained in:
parent
8fe8e1ff9f
commit
50082c52aa
@ -46,7 +46,7 @@ def call(Map config)
|
||||
writeFile file: scriptRelativePath, text: libraryResource('uploadApk.py')
|
||||
|
||||
def pythonArgs = [
|
||||
"python \"${scriptRelativePath}\"",
|
||||
"\"${scriptRelativePath}\"",
|
||||
" --upload-url \"${uploadUrl}\"",
|
||||
" --apk-path \"${apkPath}\"",
|
||||
" --env \"${uploadEnv}\"",
|
||||
@ -61,14 +61,14 @@ def call(Map config)
|
||||
pythonArgs << " --token \"${uploadToken}\""
|
||||
bat(
|
||||
label: 'Upload APK to server',
|
||||
script: "@echo off\r\n" + pythonArgs.join(" ^\r\n")
|
||||
script: buildPythonExecutionScript(pythonArgs.join(" ^\r\n"))
|
||||
)
|
||||
} else if (uploadTokenCredentialsId) {
|
||||
withCredentials([string(credentialsId: uploadTokenCredentialsId, variable: 'APK_UPLOAD_TOKEN')]) {
|
||||
pythonArgs << " --token \"%APK_UPLOAD_TOKEN%\""
|
||||
bat(
|
||||
label: 'Upload APK to server',
|
||||
script: "@echo off\r\n" + pythonArgs.join(" ^\r\n")
|
||||
script: buildPythonExecutionScript(pythonArgs.join(" ^\r\n"))
|
||||
)
|
||||
}
|
||||
} else {
|
||||
@ -93,3 +93,28 @@ def extractVersionFromFileName(String fileName)
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
def buildPythonExecutionScript(String scriptArgs)
|
||||
{
|
||||
return """@echo off
|
||||
where python >nul 2>nul
|
||||
if not errorlevel 1 goto use_python
|
||||
where py >nul 2>nul
|
||||
if not errorlevel 1 goto use_py_launcher
|
||||
if exist \"C:\\Python314\\python.exe\" goto use_known_python
|
||||
echo Python executable not found. Checked: python, py -3, C:\\Python314\\python.exe
|
||||
exit /b 9009
|
||||
|
||||
:use_python
|
||||
python ${scriptArgs}
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:use_py_launcher
|
||||
py -3 ${scriptArgs}
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:use_known_python
|
||||
\"C:\\Python314\\python.exe\" ${scriptArgs}
|
||||
exit /b %ERRORLEVEL%
|
||||
"""
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user