Skip to content

Commit 832f7dd

Browse files
authored
add SBOM generation script (#41)
1 parent e87e9de commit 832f7dd

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

sbom_generation.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
3+
# This OCI DevOps build specification file [1] generates a Software Bill of Materials (SBOM) of the repository.
4+
# The file is needed to run checks for third-party vulnerabilities and business approval according to Oracle’s GitHub policies.
5+
# [1] https://docs.oracle.com/en-us/iaas/Content/devops/using/build_specs.htm
6+
7+
version: 0.1
8+
component: build
9+
timeoutInSeconds: 1000
10+
shell: bash
11+
env:
12+
variables:
13+
"JAVA_HOME": "/usr/lib64/graalvm/graalvm22-ee-java17"
14+
steps:
15+
- type: Command
16+
name: "Update graalvm version"
17+
command: |
18+
yum -y install graalvm22-ee-17-jdk
19+
export PATH=$JAVA_HOME/bin:$PATH
20+
21+
- type: Command
22+
name: "Run Gradle cyclonedxBom command"
23+
command: |
24+
# For more details, visit https://github.com/CycloneDX/cyclonedx-gradle-plugin/blob/master/README.md
25+
cat <<EOF >> init.gradle
26+
initscript {
27+
repositories {
28+
maven {
29+
url "https://plugins.gradle.org/m2/"
30+
}
31+
}
32+
dependencies {
33+
classpath "org.cyclonedx:cyclonedx-gradle-plugin:1.7.4"
34+
}
35+
}
36+
gradle.rootProject {
37+
group= "gdk"
38+
}
39+
allprojects {
40+
apply plugin:org.cyclonedx.gradle.CycloneDxPlugin
41+
cyclonedxBom {
42+
includeConfigs = ["runtimeClasspath", "compileClasspath"]
43+
skipConfigs = ["testCompileClasspath"]
44+
projectType = "application"
45+
destination = file(".")
46+
outputName = "artifactSBOM"
47+
outputFormat = "json"
48+
schemaVersion = "1.4"
49+
}
50+
}
51+
EOF
52+
./gradlew --init-script init.gradle cyclonedxBom -info
53+
outputArtifacts:
54+
- name: artifactSBOM
55+
type: BINARY
56+
location: ${OCI_PRIMARY_SOURCE_DIR}/artifactSBOM.json

0 commit comments

Comments
 (0)