GHA: new workflow to submit scan to Coverity Scan service
PATCH 1/1 GHA: new workflow to submit scan to Coverity Scan service
Not on every push due to submit limits.
--- .github/workflows/coverity-scan.yml | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/coverity-scan.yml
.github/workflows/coverity-scan.yml new file +45 -0
@@ -0,0 +1,45 @@ +name: coverity-scan +on: + schedule: + - cron: '0 20 * * *' # Daily at 20:00 UTC + workflow_dispatch: + +jobs: + latest: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf libssl-dev libpkcs11-helper1-dev softhsm2 gnutls-bin + - name: Checkout OpenVPN + uses: actions/[email protected]... + + - name: Download Coverity Build Tool + run: | + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=OpenVPN%2Fopenvpn" -O cov-analysis-linux64.tar.gz + mkdir cov-analysis-linux64 + tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + + - name: autoconf + run: autoreconf -fvi + - name: configure + run: ./configure --enable-pkcs11 + + - name: Build with cov-build + run: | + PATH=`pwd`/cov-analysis-linux64/bin:$PATH + cov-build --dir cov-int make + + - name: Submit the result to Coverity Scan + run: | + tar czvf openvpn.tgz cov-int + curl --form token=$TOKEN \ + --form email=$EMAIL \ + --form [email protected] \ + --form version="$GITHUB_SHA" \ + --form description="master" \ + https://scan.coverity.com/builds?project=OpenVPN%2Fopenvpn + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
Signature · 1 line
2.34.1
Hi,
generally good, but...
.github/workflows/coverity-scan.yml line 5
Quoted 9 lines · Frank Lichtenheld
index 00000000..0620f638
.github/workflows/coverity-scan.yml new file +5
-0@@ -0,0 +1,45 @@ +name: coverity-scan +on: + schedule: + - cron: '0 20 * * *' # Daily at 20:00 UTC + workflow_dispatch:
... not sure this is the best way to approach the run limit, as we can have many days with no commits at all, so we'd waste credits.
Maybe cache the last commit ID and only run coverity if this has changed? Or run it "on commit", but cache the current day, and only run it again on the next commit that's not on the same day?
(My typical workflow is "you folks queue up patches, and then I find half a day of free time, and go merge&push as many as I can make sense of")
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Am 11.08.23 um 17:12 schrieb Gert Doering:
Quoted 18 lines
Hi,
generally good, but...
.github/workflows/coverity-scan.yml line 5
Quoted 9 lines · Frank Lichtenheld
index 00000000..0620f638
.github/workflows/coverity-scan.yml new file +5
-0@@ -0,0 +1,45 @@ +name: coverity-scan +on: + schedule: + - cron: '0 20 * * *' # Daily at 20:00 UTC + workflow_dispatch:... not sure this is the best way to approach the run limit, as we can have many days with no commits at all, so we'd waste credits.
Quoted 6 lines
Maybe cache the last commit ID and only run coverity if this has changed? Or run it "on commit", but cache the current day, and only run it again on the next commit that's not on the same day?
(My typical workflow is "you folks queue up patches, and then I find half a day of free time, and go merge&push as many as I can make sense of")
You can get that behaviour but it is tricky. You have to resort tricks like this: https://github.com/orgs/community/discussions/26519 of saving something to a cache and then reading the cache on the next run and check if something changed. We can probably implement like that and then trigger on push too?
Arne
PATCH v2 1/1 GHA: new workflow to submit scan to Coverity Scan service
In reply to Frank LichtenheldNot on every push due to submit limits.
Use caching to not submit a scan for the same git commit twice. Since we have many days without pushes to master this saves a lot of Github and Coverity resources.
v2:
- add caching to not submit redundant scans
--- .github/workflows/coverity-scan.yml | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/coverity-scan.yml
.github/workflows/coverity-scan.yml new file +69 -0
@@ -0,0 +1,69 @@ +name: coverity-scan +on: + schedule: + - cron: '0 20 * * *' # Daily at 20:00 UTC + workflow_dispatch: + +jobs: + latest: + runs-on: ubuntu-latest + steps: + - name: Check submission cache + id: check_submit + uses: actions/cache/[email protected]... + with: + path: | + cov-int + key: check-submit-${{ github.sha }} + + - name: Install dependencies + if: steps.check_submit.outputs.cache-hit != 'true' + run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf libssl-dev libpkcs11-helper1-dev softhsm2 gnutls-bin + + - name: Checkout OpenVPN + if: steps.check_submit.outputs.cache-hit != 'true' + uses: actions/[email protected]... + + - name: Download Coverity Build Tool + if: steps.check_submit.outputs.cache-hit != 'true' + run: | + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=OpenVPN%2Fopenvpn" -O cov-analysis-linux64.tar.gz + mkdir cov-analysis-linux64 + tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + + - name: autoconf + if: steps.check_submit.outputs.cache-hit != 'true' + run: autoreconf -fvi + - name: configure + if: steps.check_submit.outputs.cache-hit != 'true' + run: ./configure --enable-pkcs11 + + - name: Build with cov-build + if: steps.check_submit.outputs.cache-hit != 'true' + run: | + PATH=`pwd`/cov-analysis-linux64/bin:$PATH + cov-build --dir cov-int make + + - name: Submit the result to Coverity Scan + if: steps.check_submit.outputs.cache-hit != 'true' + run: | + tar czvf openvpn.tgz cov-int + curl --form token=$TOKEN \ + --form email=$EMAIL \ + --form [email protected] \ + --form version="$GITHUB_SHA" \ + --form description="master" \ + https://scan.coverity.com/builds?project=OpenVPN%2Fopenvpn + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }} + + - name: Cache submission + if: steps.check_submit.outputs.cache-hit != 'true' + uses: actions/cache/[email protected]... + with: + path: | + cov-int + key: ${{ steps.check_submit.outputs.cache-primary-key }}
Signature · 1 line
2.34.1
Quoted 23 lines · Arne Schwabe
Am 11.08.23 um 17:12 schrieb Gert Doering:
Quoted 22 lines
Hi,
generally good, but...
.github/workflows/coverity-scan.yml line 5
Quoted 9 lines · Frank Lichtenheld
index 00000000..0620f638
.github/workflows/coverity-scan.yml new file +5
-0@@ -0,0 +1,45 @@ +name: coverity-scan +on: + schedule: + - cron: '0 20 * * *' # Daily at 20:00 UTC + workflow_dispatch:... not sure this is the best way to approach the run limit, as we can have many days with no commits at all, so we'd waste credits.
Maybe cache the last commit ID and only run coverity if this has changed? Or run it "on commit", but cache the current day, and only run it again on the next commit that's not on the same day?
Quoted 8 lines
Quoted 2 lines
(My typical workflow is "you folks queue up patches, and then I find half a day of free time, and go merge&push as many as I can make sense of")
You can get that behaviour but it is tricky. You have to resort tricks like
this: https://github.com/orgs/community/discussions/26519 of saving something to a cache and then reading the cache on the next run and check if something changed. We can probably implement like that and then trigger on push too?
I've basically implemented this now in v2 of the patch (just updated to v3 of cache action). This should address the resource waste concern and also remove unnecessary noise.
I've still left the action to trigger on schedule instead of push. I think implementing rate limiting based on push is not worth the effort. Especially since it would often mean that if you have multiple pushes per day the end-result is actually likely to be scanned later since the first pushes eat your rate limit.
If some changes should be scanned immediately you can always trigger the workflow manually. Otherwise once per day should be fine.
Regards,
Signature · 1 line
Frank Lichtenheld
I'm not sure how that works, and how to test it - but the description matches what we agreed as being useful ("run the test each night, but only if something new was pushed this day").
Your patch has been applied to the master and release/2.6 branch.
commit 607ae9b821665dadb6bd0a3ceb6288bda10d5e67 (master) commit 36605648a8974f1f7151a5842e94c75d08410fd0 (release/2.6)
Author: Frank Lichtenheld Date: Mon Sep 11 13:07:35 2023 +0200
GHA: new workflow to submit scan to Coverity Scan service
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27001.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering