Created
February 6, 2022 10:27
-
-
Save colinbut/32743c10c8a641b5f70b0054d09397e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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