diff --git a/tools/code-tools/Jenkinsfile b/tools/code-tools/Jenkinsfile index 8856c461b..89e5b8b07 100644 --- a/tools/code-tools/Jenkinsfile +++ b/tools/code-tools/Jenkinsfile @@ -26,6 +26,14 @@ pipeline { build('jtreg') } } + stage('temurin-sbom') { + agent { + label NODE_LABEL + } + steps { + build('temurin-sbom') + } + } } } } @@ -36,9 +44,15 @@ def build(stageName) { docker.image('adoptopenjdk/centos7_build_image').inside { try { checkout scm - checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${stageName}"]], submoduleCfg: [], userRemoteConfigs: [[url: "https://github.com/openjdk/${stageName}"]]]) + script { + def toolsUrl = "https://github.com/openjdk/${stageName}" + if ( stageName == 'temurin-sbom' ) { + toolsUrl = "https://github.com/adoptium/temurin-build.git" + } + checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${stageName}"]], submoduleCfg: [], userRemoteConfigs: [[url: toolsUrl]]]) + } sh label: "${stageName}", script: "./tools/code-tools/${stageName}.sh" - archiveArtifacts artifacts: "${stageName}/*.tar.gz, ${stageName}/${stageName}*.jar, ${stageName}/${stageName}*.jar.*.txt, ${stageName}/*.tar.gz.*sum*.txt, ${stageName}/${stageName}*.jar.html, ${stageName}/${stageName}*.jar.md", followSymlinks: false + archiveArtifacts artifacts: "**/temurin-*-sbom.jar, ${stageName}/*.tar.gz, ${stageName}/${stageName}*.jar, ${stageName}/${stageName}*.jar.*.txt, ${stageName}/*.tar.gz.*sum*.txt, ${stageName}/${stageName}*.jar.html, ${stageName}/${stageName}*.jar.md", followSymlinks: false } catch (Exception e) { slackSend channel: 'jenkins', color: 'danger', message: "${env.JOB_NAME} : #${env.BUILD_NUMBER} : ${stageName}() FAILED with following error message:\n${e}", teamDomain: 'adoptium' throw new Exception("[ERROR] ${stageName} FAILED\n${e}") diff --git a/tools/code-tools/temurin-sbom.sh b/tools/code-tools/temurin-sbom.sh new file mode 100755 index 000000000..94ef0c9ce --- /dev/null +++ b/tools/code-tools/temurin-sbom.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eu + +echo 'Starting build process...' +export WORKSPACE="$WORKSPACE/temurin-sbom/cyclonedx-lib" +cd "$WORKSPACE" +export JAVA_HOME=/usr/lib/jvm/jdk-17 +ant -f build.xml clean +ant -f build.xml build-sign-sbom +ant -f build.xml build