// Not required if you install the Snyk CLI on your Agentstage('Download Latest Snyk CLI') { sh """ curl -Lo ./snyk $(curl -s https://api.github.com/repos/snyk/snyk/releases/latest | grep "browser_download_url.*snyk-linux"" | cut -d ':' -f 2,3 | tr -d " | tr -d ' ') chmod +x snyk """}// Run snyk test to check for vulnerabilities and fail the build if any are found// Consider using --severity-threshold=<low|medium|high> for more granularity (see snyk help for more info).stage('Snyk Test using Snyk CLI') { sh './snyk test --all-projects'}// Run snyk monitor to create a snapshot and let it monitor by Snyk// Consider using --severity-threshold=<low|medium|high> for more granularity (see snyk help for more info).stage('Snyk Monitor using Snyk CLI') { sh './snyk monitor --all-projects'}
Circle CIを使う場合、2つの方法があります。インテグレーションのドキュメントの説明に従って、Circle CIのインスタンスでSnyk Orbを使用するよう設定できます。もう1つの方法は、JHipster ci-cdが生成したconfig.ymlに次の内容を追加し、最新バージョンのCLIでスキャンすることです。
steps:...# Dependency scanning with Snyk.# add Snyk API token as environment variable SNYK_TOKEN - run: name: install-snyk command: | curl -Lo ./snyk $(curl -s https://api.github.com/repos/snyk/snyk/releases/latest | grep "browser_download_url.*snyk-linux"" | cut -d ':' -f 2,3 | tr -d " | tr -d ' ') chmod +x snyk - run: # run snyk test name: snyk test command: './snyk test --all-projects' - run: # run snyk monitor name: snyk monitor command: './snyk monitor --all-projects'...