Skip to content

Commit

Permalink
De-bat listArchives as it seems always called from non-Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Stewart X Addison <[email protected]>
  • Loading branch information
sxa committed Sep 9, 2024
1 parent 607e149 commit 03a9906
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ class Build {
target: 'workspace/target/',
flatten: true)
// Check if JRE exists, if so, build another installer for it
if (listArchives(true).any { it =~ /-jre/ } ) { buildWindowsInstaller(versionData, '**/OpenJDK*jre_*_windows*.zip', 'jre') }
if (listArchives().any { it =~ /-jre/ } ) { buildWindowsInstaller(versionData, '**/OpenJDK*jre_*_windows*.zip', 'jre') }
break
default:
break
Expand Down Expand Up @@ -1056,26 +1056,15 @@ class Build {
/*
Lists and returns any compressed archived or sbom file contents of the top directory of the build node
*/
List<String> listArchives(Boolean forceShell) {
context.println "SXA: battable and batted 1060 - windbld#273 - forceShell = ${forceShell}"
List<String> listArchives() {
context.println "SXA: unbattable as this is always invoked away from the build machine"

def files
if ( forceShell ) { context.println("listArchives() invoked with forceShell = true") }
if ( !forceShell ) { context.println("listArchives() invoked with forceShell = false") }
if ( buildConfig.TARGET_OS == 'windows' && buildConfig.DOCKER_IMAGE && !forceShell ) {
// The grep here removes anything that still contains "*" because nothing matched
files = context.bat(
script: 'dir/b/s workspace\\target\\*.zip workspace\\target\\*.msi workspace\\target\\*.-sbom_* workspace\\target\\*.json',
returnStdout: true,
returnStatus: false
).trim().replaceAll('\\\\','/').replaceAll('\\r','').split('\n').toList().grep( ~/^[^\*]*$/ ) // grep needed extra script approval
} else {
files = context.sh(
script: '''find workspace/target/ | egrep -e '(\\.tar\\.gz|\\.zip|\\.msi|\\.pkg|\\.deb|\\.rpm|-sbom_.*\\.json)$' ''',
returnStdout: true,
returnStatus: false
).trim().split('\n').toList()
}
files = context.sh(
script: '''find workspace/target/ | egrep -e '(\\.tar\\.gz|\\.zip|\\.msi|\\.pkg|\\.deb|\\.rpm|-sbom_.*\\.json)$' ''',
returnStdout: true,
returnStatus: false
).trim().split('\n').toList()
context.println "listArchives: ${files}"
return files
}
Expand Down Expand Up @@ -1326,7 +1315,7 @@ class Build {

MetaData data = formMetadata(version, initialWrite)
Boolean metaWrittenOut = false
listArchives(false).each({ file ->
listArchives().each({ file ->
def type = 'jdk'
if (file.contains('-jre')) {
type = 'jre'
Expand All @@ -1345,7 +1334,7 @@ class Build {

String hash
if ( buildConfig.TARGET_OS == 'windows' && buildConfig.DOCKER_IMAGE ) {
hash = context.sh(script: "sha256sum ${file} | cut -f1 -d' '") // .replaceAll('\n', '')
hash = context.bat(script: "sha256sum ${file} | cut -f1 -d' '") // .replaceAll('\n', '')
} else {
hash = context.sh(script: """\
if [ -x "\$(command -v shasum)" ]; then
Expand Down Expand Up @@ -2255,7 +2244,7 @@ class Build {
try {
// Installer job timeout managed by Jenkins job config
buildInstaller(versionInfo)
if ( enableSigning) {
if ( enableSigner) {
signInstaller(versionInfo)
}
} catch (FlowInterruptedException e) {
Expand Down

0 comments on commit 03a9906

Please sign in to comment.