diff --git a/pipelines/build/common/openjdk_build_pipeline.groovy b/pipelines/build/common/openjdk_build_pipeline.groovy index 29243995e..385aafa55 100644 --- a/pipelines/build/common/openjdk_build_pipeline.groovy +++ b/pipelines/build/common/openjdk_build_pipeline.groovy @@ -899,7 +899,7 @@ class Build { target: 'workspace/target/', flatten: true) // Check if JRE exists, if so, build another installer for it - if (listArchives().any { it =~ /-jre/ } ) { buildWindowsInstaller(versionData, '**/OpenJDK*jre_*_windows*.zip', 'jre') } + if (listArchives(true).any { it =~ /-jre/ } ) { buildWindowsInstaller(versionData, '**/OpenJDK*jre_*_windows*.zip', 'jre') } break default: break @@ -1056,15 +1056,26 @@ class Build { /* Lists and returns any compressed archived or sbom file contents of the top directory of the build node */ - List listArchives() { - context.println "SXA: unbattable as this is always invoked away from the build machine" + List listArchives(Boolean forceShell) { + context.println "SXA: battable and batted 1060 - windbld#273" def files - 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() + 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() + } context.println "listArchives: ${files}" return files } @@ -1315,7 +1326,7 @@ class Build { MetaData data = formMetadata(version, initialWrite) Boolean metaWrittenOut = false - listArchives().each({ file -> + listArchives(false).each({ file -> def type = 'jdk' if (file.contains('-jre')) { type = 'jre'