Skip to content

Instantly share code, notes, and snippets.

@colinbut
Created February 6, 2022 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinbut/32743c10c8a641b5f70b0054d09397e6 to your computer and use it in GitHub Desktop.
Save colinbut/32743c10c8a641b5f70b0054d09397e6 to your computer and use it in GitHub Desktop.
pipeline{
agent any
stages{
stage("Build Jar"){
steps{
sh 'cd syft-grype && ./mvnw clean install -Dcheckstyle.skip=true -Dmaven.test.skip=true'
}
}
stage("Build Container"){
steps{
sh 'docker build --build-arg JAR_FILE=syft-grype/target/syft-grype-0.0.1-SNAPSHOT.jar -t app:${BUILD_NUMBER} .'
}
}
stage("Generate Software Bill of Materials (sbom) with Syft"){
steps{
sh '''
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
syft app:${BUILD_NUMBER} --scope all-layers -o json > sbom-${BUILD_NUMBER}.json
syft app:${BUILD_NUMBER} --scope all-layers -o table > sbom-${BUILD_NUMBER}.txt
'''
}
}
stage("Cleanup") {
steps {
archiveArtifacts allowEmptyArchive: true, artifacts: 'sbom*', fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
sh '''
rm -rf sbom*
'''
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment