Skip to content

Commit

Permalink
Updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dianashevchenko committed Nov 30, 2022
1 parent a804f5d commit dacc4f7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 39 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/govulncheck.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .gitlab/govulncheck.yml
@@ -0,0 +1,60 @@
#variables:
# # This base image is created here: https://gitlab.ddbuild.io/DataDog/apm-reliability/relenv-microbenchmarking-platform
# BASE_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/relenv-microbenchmarking-platform:dd-trace-go_knusbaum_test
# INDEX_FILE: index.txt
#
govulncheck:
stage: govulncheck
image: registry.ddbuild.io/images/mirror/golang:1.18
cron:
only:
refs:
- shevchenko/govulncheck
script:
- ./.gitlab/scripts/run-govulncheck.sh
# artifacts:
# name: "reports"
# paths:
# - reports/
# expire_in: 3 months
#
#name: Nightly govulncheck
#on:
# push:
# branches:
# - 'shevchenko/govulncheck'
#on:
# push:
# branches:
# - main
# tags:
# - "**"
# schedule:
# - cron: '00 04 * * 2-6'
#jobs:
# govulncheck-tests:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# repository: 'DataDog/dd-trace-go'
# - name: Checkout Go
# uses: actions/setup-go@v3
# with:
# go-version: '1.18'
# - name: Install and run govulncheck
# run: |
# go install golang.org/x/vuln/cmd/govulncheck@latest
# govulncheck ./ddtrace/...
# - name: Comment results
# run: |
# govulncheck ./ddtrace/... >> results.txt
# num=$(cat results.txt | grep "Vulnerability #" | wc -l)
# if [ $num -gt 0 ]; then
# echo "Found ${num} vulnerabilities"
# exit 1
# fi
#



11 changes: 11 additions & 0 deletions .gitlab/scripts/run-govulncheck.sh
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
go install golang.org/x/vuln/cmd/govulncheck@latest

govulncheck ./ddtrace/... >> results.txt
num=$(cat results.txt | grep "Vulnerability #" | wc -l)
if [ $num -gt 0 ]; then
echo "Found ${num} vulnerabilities"
exit 1
fi

echo "Found ${num} vulnerabilities" | /usr/local/bin/pr-commenter --for-repo="$CI_PROJECT_NAME" --for-pr="$CI_COMMIT_REF_NAME" --header="Vulnerability report"

0 comments on commit dacc4f7

Please sign in to comment.