From f00c12e9548fb5eb3d9bed24402f0def3d62e13e Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Wed, 14 Sep 2022 12:55:14 +0530 Subject: [PATCH] Integrate Sonarcloud and Nancy github action (#3491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Integrate Sonarcloud and Nancy github action Integrate Sonarcloud for static code analysis and Nancy for analysing dependencies Signed-off-by: Shubham Gupta * fix: pin actions to commit sha Signed-off-by: Charles-Edouard Brétéché * fix auth for pr Signed-off-by: Charles-Edouard Brétéché Signed-off-by: Shubham Gupta Signed-off-by: Charles-Edouard Brétéché Co-authored-by: Vyankatesh Kudtarkar Co-authored-by: Prateek Pandey Co-authored-by: Jim Bugwadia Co-authored-by: Charles-Edouard Brétéché Co-authored-by: shuting --- .github/workflows/nancy.yaml | 19 +++++++++++++++++++ .github/workflows/sonarcloud.yaml | 21 +++++++++++++++++++++ sonar-project.properties | 6 ++++++ 3 files changed, 46 insertions(+) create mode 100644 .github/workflows/nancy.yaml create mode 100644 .github/workflows/sonarcloud.yaml create mode 100644 sonar-project.properties diff --git a/.github/workflows/nancy.yaml b/.github/workflows/nancy.yaml new file mode 100644 index 0000000000..3f97fe65be --- /dev/null +++ b/.github/workflows/nancy.yaml @@ -0,0 +1,19 @@ +name: Nancy + +on: + push: + branches: + - 'main' + - 'release*' + +jobs: + nancy: + runs-on: ubuntu-latest + name: Nancy + steps: + - name: Checkout + uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # pin@v2 + - name: WriteGoList + run: go list -json -m all > go.list + - name: Nancy SAST Scan + uses: sonatype-nexus-community/nancy-github-action@aae196481b961d446f4bff9012e4e3b63d7921a4 # pin@main diff --git a/.github/workflows/sonarcloud.yaml b/.github/workflows/sonarcloud.yaml new file mode 100644 index 0000000000..f1dfb792ef --- /dev/null +++ b/.github/workflows/sonarcloud.yaml @@ -0,0 +1,21 @@ +name: Sonarcloud workflow + +on: + push: + branches: + - 'main' + - 'release*' + +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # pin@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@156db6fef3e168e4972abb76de0b32bbce8ec77a # pin@master + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..4db640b18e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.organization=kyverno +sonar.projectKey=kyverno_kyverno + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=.