Skip to content

Commit

Permalink
Merge pull request #283 from axonivy/dtrack
Browse files Browse the repository at this point in the history
Create sbom and analyze it with dtrack
  • Loading branch information
alexsuter authored Nov 21, 2024
2 parents 0440dc2 + 10907ed commit a9800c8
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions build/sbom/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pipeline {
agent any

options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '20'))
}

triggers {
cron '@midnight'
}

stages {
stage('build') {
steps {
script {
if (isReleaseOrMasterBranch()) {
docker.build('maven').inside() {
maven cmd: "org.cyclonedx:cyclonedx-maven-plugin:makeBom -DincludeLicenseText=true -DoutputFormat=json"
withCredentials([string(credentialsId: 'dependency-track', variable: 'API_KEY')]) {
def components = ["unit-tester", "primeui-tester", "web-tester"]
for (component in components) {
def version = sh (script: "mvn -f ${component}/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout", returnStdout: true)
sh 'curl -v --fail -X POST https://api.dependency-track.ivyteam.io/api/v1/bom \
-H "Content-Type: multipart/form-data" \
-H "X-API-Key: ' + API_KEY + '" \
-F "autoCreate=true" \
-F "projectName=' + component + '" \
-F "projectVersion=' + version + '" \
-F "bom=@unit-tester/target/bom.json"'
}
}
}
}
}
}
}
}
}

def isReleaseOrMasterBranch() {
return env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('release/')
}

0 comments on commit a9800c8

Please sign in to comment.