mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 01:56:31 +00:00
updated zip pipeline to use parameters from Azaion pipeline.
This commit is contained in:
+11
-10
@@ -1,6 +1,10 @@
|
||||
pipeline {
|
||||
agent { label 'Win10-BuildMachine' }
|
||||
|
||||
parameters {
|
||||
string(name: 'buildPath', defaultValue: 'C:/Jenkins/workspace/AzaionSuite/suite', description: 'Build directory to zip from')
|
||||
}
|
||||
|
||||
tools {
|
||||
git 'Default'
|
||||
}
|
||||
@@ -9,7 +13,6 @@ pipeline {
|
||||
SEVEN_ZIP_PATH = "C:/Program Files/7-Zip"
|
||||
PATH = "${SEVEN_ZIP_PATH};${env.PATH}"
|
||||
GOOGLE_DRIVE_UPLOAD_JOB_NAME = 'GDrive Upload'
|
||||
MAIN_BUILD_ARTIFACTS_DIR = 'C:/Jenkins/workspace/AzaionSuite/suite'
|
||||
}
|
||||
|
||||
stages {
|
||||
@@ -17,11 +20,11 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
echo "Starting 'Detect or Create Zip' stage."
|
||||
dir("${env.MAIN_BUILD_ARTIFACTS_DIR}") {
|
||||
echo "Using build path: ${params.buildPath}"
|
||||
dir("${params.buildPath}") {
|
||||
powershell '''
|
||||
$ErrorActionPreference = "Stop"
|
||||
$sevenZipExe = "$env:SEVEN_ZIP_PATH\\7z.exe"
|
||||
$defaultVersion = "1.0.0"
|
||||
$exePattern = "AzaionSuite*.exe"
|
||||
$binPattern = "AzaionSuite*.bin"
|
||||
$zipPattern = "AzaionSuite*.zip"
|
||||
@@ -66,18 +69,16 @@ pipeline {
|
||||
Write-Host "Created new zip file: $zipFilename"
|
||||
}
|
||||
|
||||
# Save outputs without BOM
|
||||
Set-Content -Path "zipfilename.txt" -Value $zipFilename -Encoding ASCII
|
||||
Set-Content -Path "zip_created.txt" -Value $wasCreated -Encoding ASCII
|
||||
Set-Content -Path "zip_was_created.txt" -Value $wasCreated -Encoding ASCII
|
||||
'''
|
||||
|
||||
def zipFilename = readFile('zipfilename.txt').trim()
|
||||
def zipCreated = readFile('zip_created.txt').trim().toBoolean()
|
||||
def zipCreated = readFile('zip_was_created.txt').trim().toBoolean()
|
||||
|
||||
echo "Zip filename: ${zipFilename}"
|
||||
echo "Was zip created this run? ${zipCreated}"
|
||||
|
||||
// Save results for next stages
|
||||
writeFile file: 'created_zip.txt', text: zipFilename
|
||||
writeFile file: 'zip_was_created.txt', text: zipCreated.toString()
|
||||
}
|
||||
@@ -88,14 +89,14 @@ pipeline {
|
||||
stage('Archive Zip File (if new)') {
|
||||
when {
|
||||
expression {
|
||||
def zipCreated = readFile("${env.MAIN_BUILD_ARTIFACTS_DIR}/zip_was_created.txt").trim().toBoolean()
|
||||
def zipCreated = readFile("${params.buildPath}/zip_was_created.txt").trim().toBoolean()
|
||||
return zipCreated
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
echo "Archiving newly created zip file..."
|
||||
dir("${env.MAIN_BUILD_ARTIFACTS_DIR}") {
|
||||
dir("${params.buildPath}") {
|
||||
def zipFilename = readFile('created_zip.txt').trim()
|
||||
if (!fileExists(zipFilename)) {
|
||||
error "Zip file '${zipFilename}' not found!"
|
||||
@@ -119,7 +120,7 @@ pipeline {
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
def zipFilename = readFile("${env.MAIN_BUILD_ARTIFACTS_DIR}/created_zip.txt").trim()
|
||||
def zipFilename = readFile("${params.buildPath}/created_zip.txt").trim()
|
||||
echo "Pipeline completed successfully. Final zip: ${zipFilename}"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user