mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:36:30 +00:00
zip update
This commit is contained in:
+40
-7
@@ -134,21 +134,54 @@ pipeline {
|
|||||||
exit 0
|
exit 0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
// Extract the zip filename from the PowerShell output by looking for "ZIPFILENAME=" prefix
|
// Debug: Print raw PowerShell output to see what we're getting
|
||||||
def outputLines = zipFilenameOutput.split('\n')
|
echo "Raw PowerShell output: ${zipFilenameOutput}"
|
||||||
|
|
||||||
|
// The output may have Windows line endings, split by any common line ending
|
||||||
|
def outputLines = zipFilenameOutput.split('(?:\\r\\n|\\n|\\r)')
|
||||||
|
echo "Found ${outputLines.size()} lines in output"
|
||||||
|
|
||||||
def zipFilename = null
|
def zipFilename = null
|
||||||
for (line in outputLines) {
|
// Debug: Print each line of output
|
||||||
if (line.trim().startsWith("ZIPFILENAME=")) {
|
for (int i = 0; i < outputLines.size(); i++) {
|
||||||
zipFilename = line.trim() - "ZIPFILENAME="
|
echo "Line ${i}: ${outputLines[i]}"
|
||||||
|
if (outputLines[i].trim().contains("ZIPFILENAME=")) {
|
||||||
|
zipFilename = outputLines[i].trim().substring(outputLines[i].trim().indexOf("ZIPFILENAME=") + 11)
|
||||||
|
echo "Found zip filename in line ${i}: ${zipFilename}"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zipFilename) {
|
if (zipFilename) {
|
||||||
env.CREATED_ZIP_FILENAME = zipFilename.trim()
|
env.CREATED_ZIP_FILENAME = zipFilename.trim()
|
||||||
echo "Found zip filename: ${env.CREATED_ZIP_FILENAME}"
|
echo "Setting CREATED_ZIP_FILENAME to: ${env.CREATED_ZIP_FILENAME}"
|
||||||
} else {
|
} else {
|
||||||
error "Failed to extract zip filename from PowerShell output. Check PowerShell script."
|
// If we can't find the ZIPFILENAME marker, try a fallback approach
|
||||||
|
// Look for the line containing "Using newest existing zip file:" or "Zip archive created successfully:"
|
||||||
|
for (int i = 0; i < outputLines.size(); i++) {
|
||||||
|
def line = outputLines[i].trim()
|
||||||
|
if (line.contains("Using newest existing zip file: '") && line.contains(".zip'")) {
|
||||||
|
def start = line.indexOf("'") + 1
|
||||||
|
def end = line.lastIndexOf("'")
|
||||||
|
if (start > 0 && end > start) {
|
||||||
|
zipFilename = line.substring(start, end)
|
||||||
|
echo "Extracted zip filename from 'Using newest' line: ${zipFilename}"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if (line.contains("Zip archive created successfully: ") && line.contains(".zip")) {
|
||||||
|
def start = line.indexOf("Zip archive created successfully: ") + 30
|
||||||
|
zipFilename = line.substring(start).trim()
|
||||||
|
echo "Extracted zip filename from 'created successfully' line: ${zipFilename}"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipFilename) {
|
||||||
|
env.CREATED_ZIP_FILENAME = zipFilename.trim()
|
||||||
|
echo "Setting CREATED_ZIP_FILENAME using fallback to: ${env.CREATED_ZIP_FILENAME}"
|
||||||
|
} else {
|
||||||
|
error "Failed to extract zip filename from PowerShell output after multiple attempts. Check PowerShell script."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user