Skip to content

Commit 5e3df5b

Browse files
committed
Minor update
Signed-off-by: Sophia Guo <[email protected]>
1 parent d39bbf4 commit 5e3df5b

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

tools/post-build/Jenkinsfile

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// Build once a day
2-
CRON_SETTINGS = '''H H * * *'''
3-
NODE_LABEL = 'dockerBuild&&linux&&x64'
1+
NODE_LABEL = 'dockerBuild&&linux&&x64&&gpgsign'
42

53
pipeline {
64
agent none
75
parameters {
8-
string(name: 'UPSTREAM_JOB_NAME', defaultValue: '', description: 'Pipeline job with sbom filesCompared nightly build job name')
6+
string(name: 'UPSTREAM_JOB_NAME', defaultValue: '', description: 'Pipeline job with sbom files')
97
string(name: 'UPSTREAM_JOB_NUMBER', defaultValue: '', description: 'Pipeline job number')
108

119
}
@@ -37,25 +35,28 @@ def sbomSign() {
3735
projectName: "${params.UPSTREAM_JOB_NAME}",
3836
target: 'sbom/',
3937
selector: specific("${params.UPSTREAM_JOB_NUMBER}")
40-
script {
41-
dir("sbomSign/cyclonedx-lib") {
42-
sh label: 'build-sign-sbom', script: '''
43-
JAVA_HOME=/usr/lib/jvm/jdk-17 ant clean
44-
JAVA_HOME=/usr/lib/jvm/jdk-17 ant build-sign-sbom
45-
openssl genpkey -algorithm RSA -pass pass:test -outform PEM -out testPrivateFile -pkeyopt rsa_keygen_bits:2048
46-
openssl rsa -in testPrivateFile -passin pass:test -pubout -out publicPemFile
47-
'''
48-
}
49-
def sbomFiles = findFiles(glob: "**/OpenJDK*-sbom*.json")
50-
for (def sbomFile: sbomFiles) {
51-
def sbomFileName = sbomFile.path
52-
def classPath = "sbomSign/cyclonedx-lib/build/jar/*"
53-
sh label: 'sign-sbom', script: """
54-
/usr/lib/jvm/jdk-17/bin/java -cp "${classPath}" temurin.sbom.TemurinSignSBOM --signSBOM --jsonFile ${sbomFileName} --privateKeyFile ./sbomSign/cyclonedx-lib/testPrivateFile
55-
/usr/lib/jvm/jdk-17/bin/java -cp "${classPath}" temurin.sbom.TemurinSignSBOM --verifySignature --jsonFile ${sbomFileName} --publicKeyFile ./sbomSign/cyclonedx-lib/publicPemFile
56-
"""
57-
}
38+
withCredentials([file(credentialsId: 'adoptium-artifactory-gpg-key', variable: 'PRIVATE_GPG_KEY')]) {
39+
withEnv(['PRIVATE_GPG_KEY='+${PRIVATE_GPG_KEY}]) {
40+
script {
41+
dir("sbomSign/cyclonedx-lib") {
42+
sh label: 'build-sign-sbom', script: '''
43+
JAVA_HOME=/usr/lib/jvm/jdk-17 ant clean
44+
JAVA_HOME=/usr/lib/jvm/jdk-17 ant build-sign-sbom
45+
'''
46+
}
47+
def sbomFiles = findFiles(glob: "**/OpenJDK*-sbom*.json")
48+
for (def sbomFile: sbomFiles) {
49+
def sbomFileName = sbomFile.path
50+
def classPath = "sbomSign/cyclonedx-lib/build/jar/*"
51+
sh label: 'sign-sbom', script: """
52+
/usr/lib/jvm/jdk-17/bin/java -cp "${classPath}" temurin.sbom.TemurinSignSBOM --signSBOM --jsonFile ${sbomFileName} --privateKeyFile ./sbomSign/cyclonedx-lib/testPrivateFile
53+
/usr/lib/jvm/jdk-17/bin/java -cp "${classPath}" temurin.sbom.TemurinSignSBOM --verifySignature --jsonFile ${sbomFileName} --publicKeyFile ./sbomSign/cyclonedx-lib/publicPemFile
54+
"""
55+
}
56+
}
57+
}// some block
5858
}
59+
5960
archiveArtifacts artifacts: "**/OpenJDK*-sbom*.json"
6061
}
6162
}

0 commit comments

Comments
 (0)