Skip to content

Commit

Permalink
Update the 'detector'
Browse files Browse the repository at this point in the history
  • Loading branch information
rudsberg committed Jan 6, 2025
1 parent 0c1be07 commit 0088c3a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/features/sbom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const INPUT_NI_SBOM = 'native-image-enable-sbom'
const SBOM_FILE_SUFFIX = '.sbom.json'
const MIN_JAVA_VERSION = '24.0.0'

let javaVersionOrLatestEA: string | null = null

interface SBOM {
components: Component[]
dependencies: Dependency[]
Expand Down Expand Up @@ -74,7 +76,8 @@ export function setUpSBOMSupport(
}

validateJavaVersionAndDistribution(javaVersionOrDev, distribution)
setNativeImageOption(javaVersionOrDev, '--enable-sbom=export')
javaVersionOrLatestEA = javaVersionOrDev
setNativeImageOption(javaVersionOrLatestEA, '--enable-sbom=export')
core.info('Enabled SBOM generation for Native Image build')
}

Expand Down Expand Up @@ -111,6 +114,10 @@ export async function processSBOM(): Promise<void> {
return
}

if (javaVersionOrLatestEA === null) {
throw new Error('setUpSBOMSupport must be called before processSBOM')
}

const sbomPath = await findSBOMFilePath()
try {
const sbomContent = fs.readFileSync(sbomPath, 'utf8')
Expand Down Expand Up @@ -217,9 +224,9 @@ function convertSBOMToSnapshot(
html_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
},
detector: {
name: 'setup-graalvm',
version: c.ACTION_VERSION,
url: 'https://github.com/graalvm/setup-graalvm'
name: 'Oracle GraalVM',
version: javaVersionOrLatestEA ?? '',
url: 'https://www.graalvm.org/'
},
scanned: new Date().toISOString(),
manifests: {
Expand Down

0 comments on commit 0088c3a

Please sign in to comment.