Skip to content

Commit

Permalink
feat: enable --create-sbom (in temurin-build) by passing new BUILD_ARGS
Browse files Browse the repository at this point in the history
	- by default it is set to "true"
	- should be able to turn it off per each groovy config file
  • Loading branch information
zdtsw committed May 12, 2022
1 parent 220a525 commit 5b95f3d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions pipelines/build/common/build_base_file.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class Builder implements Serializable {
ENABLE_TESTDYNAMICPARALLEL: enableTestDynamicParallel,
ENABLE_INSTALLERS: enableInstallers,
ENABLE_SIGNER: enableSigner,
ENABLE_SBOM: enableSBOM,
CLEAN_WORKSPACE: cleanWorkspace,
CLEAN_WORKSPACE_AFTER: cleanWsAfter,
CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER: cleanWorkspaceBuildOutputAfterBuild
Expand Down
1 change: 1 addition & 0 deletions pipelines/build/common/config_regeneration.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ class Regeneration implements Serializable {
ENABLE_TESTDYNAMICPARALLEL: DEFAULTS_JSON['testDetails']['enableTestDynamicParallel'] as Boolean,
ENABLE_INSTALLERS: true,
ENABLE_SIGNER: true,
ENABLE_SBOM: true,
CLEAN_WORKSPACE: true,
CLEAN_WORKSPACE_AFTER: true,
CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER: false
Expand Down
1 change: 1 addition & 0 deletions pipelines/build/common/create_job_from_template.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pipelineJob("$buildFolder/$JOB_NAME") {
<dt><strong>ENABLE_TESTS</strong></dt><dd>Run tests</dd>
<dt><strong>ENABLE_TESTDYNAMICPARALLEL</strong></dt><dd>Run parallel</dd>
<dt><strong>ENABLE_INSTALLERS</strong></dt><dd>Run installers</dd>
<dt><strong>ENABLE_SBOM</strong></dt><dd>Run create cyclonedxlib and generate SBOM</dd>
<dt><strong>ENABLE_SIGNER</strong></dt><dd>Run signer</dd>
<dt><strong>CLEAN_WORKSPACE</strong></dt><dd>Wipe out workspace before build</dd>
<dt><strong>CLEAN_WORKSPACE_AFTER</strong></dt><dd>Wipe out workspace after build</dd>
Expand Down
4 changes: 4 additions & 0 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,9 @@ class Build {
if (useAdoptShellScripts) {
context.println "[CHECKOUT] Checking out to adoptium/temurin-build..."
repoHandler.checkoutAdoptBuild(context)
if (enableSBOM) {
env.BUILD_ARGS += "--create-sbom"
}
if (buildConfig.TARGET_OS == "mac" && buildConfig.JAVA_TO_BUILD != "jdk8u") {
def macSignBuildArgs
if (env.BUILD_ARGS != null && !env.BUILD_ARGS.isEmpty()) {
Expand Down Expand Up @@ -1488,6 +1491,7 @@ class Build {
def enableTests = Boolean.valueOf(buildConfig.ENABLE_TESTS)
def enableInstallers = Boolean.valueOf(buildConfig.ENABLE_INSTALLERS)
def enableSigner = Boolean.valueOf(buildConfig.ENABLE_SIGNER)
def enableSBOM = Boolean.valueOf(buildConfig.ENABLE_SBOM)
def useAdoptShellScripts = Boolean.valueOf(buildConfig.USE_ADOPT_SHELL_SCRIPTS)
def cleanWorkspace = Boolean.valueOf(buildConfig.CLEAN_WORKSPACE)
def cleanWorkspaceAfter = Boolean.valueOf(buildConfig.CLEAN_WORKSPACE_AFTER)
Expand Down
3 changes: 3 additions & 0 deletions pipelines/library/src/common/IndividualBuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class IndividualBuildConfig implements Serializable {
final boolean ENABLE_TESTDYNAMICPARALLEL
final boolean ENABLE_INSTALLERS
final boolean ENABLE_SIGNER
final boolean ENABLE_SBOM
final boolean CLEAN_WORKSPACE
final boolean CLEAN_WORKSPACE_AFTER
final boolean CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER
Expand Down Expand Up @@ -103,6 +104,7 @@ class IndividualBuildConfig implements Serializable {
ENABLE_TESTDYNAMICPARALLEL = map.get("ENABLE_TESTDYNAMICPARALLEL")
ENABLE_INSTALLERS = map.get("ENABLE_INSTALLERS")
ENABLE_SIGNER = map.get("ENABLE_SIGNER")
ENABLE_SBOM = map.get("ENABLE_SBOM")
CLEAN_WORKSPACE = map.get("CLEAN_WORKSPACE")
CLEAN_WORKSPACE_AFTER = map.get("CLEAN_WORKSPACE_AFTER")
CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER = map.get("CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER")
Expand Down Expand Up @@ -159,6 +161,7 @@ class IndividualBuildConfig implements Serializable {
ENABLE_TESTDYNAMICPARALLEL: ENABLE_TESTDYNAMICPARALLEL,
ENABLE_INSTALLERS : ENABLE_INSTALLERS,
ENABLE_SIGNER : ENABLE_SIGNER,
ENABLE_SBOM : ENABLE_SBOM,
CLEAN_WORKSPACE : CLEAN_WORKSPACE,
CLEAN_WORKSPACE_AFTER : CLEAN_WORKSPACE_AFTER,
CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER : CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER
Expand Down
1 change: 1 addition & 0 deletions pipelines/src/test/groovy/IndividualBuildConfigTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class IndividualBuildConfigTest {
ENABLE_TESTS : true,
ENABLE_INSTALLERS : true,
ENABLE_SIGNER : true,
ENABLE_SBOM : true,
CLEAN_WORKSPACE : false,
CLEAN_WORKSPACE_AFTER : false,
CLEAN_WORKSPACE_BUILD_OUTPUT_ONLY_AFTER : false
Expand Down

0 comments on commit 5b95f3d

Please sign in to comment.