Skip to content

Commit

Permalink
Escape '-' literals in patterns
Browse files Browse the repository at this point in the history
Signed-off-by: Keith W. Campbell <[email protected]>
  • Loading branch information
keithc-ca committed Jan 12, 2024
1 parent 3a97fad commit cd25819
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pipelines/build/common/build_base_file.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ class Builder implements Serializable {

/*
Returns the jenkins folder of where we assume the downstream build jobs have been regenerated
e.g:
e.g:
nightly: build-scripts/jobs/jdk11u/jdk11u-linux-aarch64-temurin
evaluation: build-scripts/jobs/evaluation/jobs/jdk17u/jdk17u-evaluation-mac-x64-openj9
release: build-scripts/jobs/release/jobs/jdk21/jdk21-release-aix-ppc64-temurin
Expand Down Expand Up @@ -906,9 +906,9 @@ class Builder implements Serializable {
//Remove the previous artifacts
try {
context.timeout(time: pipelineTimeouts.REMOVE_ARTIFACTS_TIMEOUT, unit: 'HOURS') {
if ( ! ( "${config.TARGET_OS}" ==~ /^[A-Za-z0-9\/\.-_]*$/ ) ||
! ( "${config.ARCHITECTURE}" ==~ /^[A-Za-z0-9\/\.-_]*$/ ) ||
! ( "${config.VARIANT}" ==~ /^[A-Za-z0-9\/\.-_]*$/ ) ) {
if ( ! ( "${config.TARGET_OS}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ||
! ( "${config.ARCHITECTURE}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ||
! ( "${config.VARIANT}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ) {
throw new Exception("[ERROR] Dubious character in TARGET_OS, ARCHITECTURE or VARIANT - aborting");
}
context.sh "rm -rf target/${config.TARGET_OS}/${config.ARCHITECTURE}/${config.VARIANT}/"
Expand Down
5 changes: 2 additions & 3 deletions pipelines/build/openjdk_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ node('worker') {
if (params.jdkVersion == '8' && params.targetConfigurations.contains('arm32Linux')) {
propertyFile = 'testenv_arm32.properties'
}
if ( ! ( "${params.aqareference}" ==~ /^[A-Za-z0-9\/\.-_]*$/ ) ) {
if ( ! ( "${params.aqareference}" ==~ /^[A-Za-z0-9\/\.\-_]*$/ ) ) {
throw new Exception("[ERROR] Dubious characters in aqa reference - aborting");
}
sh("curl -Os https://raw.githubusercontent.com/adoptium/aqa-tests/${params.aqaReference}/testenv/${propertyFile}")
Expand All @@ -41,15 +41,14 @@ node('worker') {
if (params.scmReference.contains('_adopt')) {
buildTag = params.scmReference.substring(0, params.scmReference.length() - 6) // remove _adopt suffix
}

def list = readFile("${propertyFile}").readLines()
def jdkBranch = ""
def jdkOpenj9Branch = ""
for (item in list) {
if (item.contains("JDK${params.jdkVersion}_BRANCH")) {
def branchInfo = item.split('=')
jdkBranch = branchInfo[1]

} else if (item.contains("JDK${params.jdkVersion}_OPENJ9_BRANCH")) {
def branchInfo = item.split('=')
jdkOpenj9Branch = branchInfo[1]
Expand Down

0 comments on commit cd25819

Please sign in to comment.