mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:36:29 +00:00
zip update
This commit is contained in:
+9
-4
@@ -1,3 +1,5 @@
|
|||||||
|
&1)">
|
||||||
|
```groovy
|
||||||
// This pipeline job is triggered by the main AzaionSuite build pipeline.
|
// This pipeline job is triggered by the main AzaionSuite build pipeline.
|
||||||
// It operates directly within the main build job's artifact directory,
|
// It operates directly within the main build job's artifact directory,
|
||||||
// zips the artifacts using PowerShell and 7-Zip, and then triggers the Google Drive upload pipeline.
|
// zips the artifacts using PowerShell and 7-Zip, and then triggers the Google Drive upload pipeline.
|
||||||
@@ -54,7 +56,7 @@ pipeline {
|
|||||||
|
|
||||||
|
|
||||||
// Use a powershell step to check for existing zip, or create a new one, then output the filename
|
// Use a powershell step to check for existing zip, or create a new one, then output the filename
|
||||||
// Capture the output of the powershell script, redirecting stderr to stdout
|
// Capture the output of the powershell script
|
||||||
def zipFilenameOutput = powershell returnStdout: true, script: '''
|
def zipFilenameOutput = powershell returnStdout: true, script: '''
|
||||||
$ErrorActionPreference = "Stop" # Stop the script on any error
|
$ErrorActionPreference = "Stop" # Stop the script on any error
|
||||||
|
|
||||||
@@ -163,20 +165,22 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Output the zip filename to standard output for the Groovy script to capture
|
# Output the zip filename to standard output for the Groovy script to capture
|
||||||
|
# Ensure this is the very last thing written to the standard output stream
|
||||||
Write-Output $zipFilename
|
Write-Output $zipFilename
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
''' 2>&1 // End powershell script and redirect stderr to stdout
|
''' // End powershell script
|
||||||
|
|
||||||
// Capture the output and set the environment variable
|
// Capture the output and set the environment variable
|
||||||
// The PowerShell script outputs the zip filename as the last line
|
// The PowerShell script outputs the zip filename as the last line
|
||||||
// Use readLines() to handle multi-line output and get the last line
|
// Use readLines() to handle multi-line output and get the last line
|
||||||
def outputLines = zipFilenameOutput.readLines()
|
def outputLines = zipFilenameOutput.readLines().findAll { it.trim() != '' } // Filter out empty lines
|
||||||
if (!outputLines.isEmpty()) {
|
if (!outputLines.isEmpty()) {
|
||||||
env.CREATED_ZIP_FILENAME = outputLines.last().trim()
|
env.CREATED_ZIP_FILENAME = outputLines.last().trim()
|
||||||
echo "Set CREATED_ZIP_FILENAME environment variable to: ${env.CREATED_ZIP_FILENAME}"
|
echo "Set CREATED_ZIP_FILENAME environment variable to: ${env.CREATED_ZIP_FILENAME}"
|
||||||
} else {
|
} else {
|
||||||
error "PowerShell script did not produce any output to capture the zip filename."
|
// This error should now be more informative if no output is captured
|
||||||
|
error "PowerShell script did not produce any non-empty output lines to capture the zip filename."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -228,3 +232,4 @@ pipeline {
|
|||||||
} // End stage block
|
} // End stage block
|
||||||
} // End of stages block
|
} // End of stages block
|
||||||
} // End of pipeline block
|
} // End of pipeline block
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user