Fix: Call Sonar action directly 47/12647/1
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Thu, 4 Apr 2024 01:52:16 +0000 (18:52 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Thu, 4 Apr 2024 01:52:16 +0000 (18:52 -0700)
This workflow will require less calls and simpler code

Change-Id: Ice0a05fb50dbb470e38ac7f4d25936febd81160d
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
.github/workflows/gerrit-novote-merge.yaml

index 04736db..5bd6982 100644 (file)
@@ -41,14 +41,16 @@ on:
         description: "Gerrit refspec of change"
         required: true
         type: string
+    secrets:
+      SONAR_TOKEN:
+        description: "Sonar Cloud access token"
+        required: true
 
 concurrency:
   # yamllint disable-line rule:line-length
   group: gerrit-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
   cancel-in-progress: true
 
-permissions: read-all
-
 jobs:
   notify:
     runs-on: ubuntu-latest
@@ -68,29 +70,43 @@ jobs:
       - name: Allow replication
         run: sleep 10s
 
-  call-gerrit-tox-sonarcloud:
+  call-gerrit-tox-and-sonarcloud:
+    runs-on: ubuntu-latest
     needs: notify
-    # yamllint disable-line rule:line-length
-    uses: lfit/releng-reusable-workflows/.github/workflows/composed-tox-sonar-cloud.yaml@main
-    with:
-      GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
-      GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
-      GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
-      GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
-      GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
-      GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
-      GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
-      GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
-      GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
-      TOX_ENVS: '["py3"]'
-      SONAR_PROJECT_KEY: "o-ran-sc_com-pylog"
-      SONAR_ORG: "o-ran-sc"
-      SONAR_ARGS: >
-        -Dsonar.sources=mdclogpy
-        -Dsonar.python.coverage.reportPaths=./coverage.xm
-        -Dsonar.verbose=true
-    secrets:
-      SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+    steps:
+      - name: Run Tox verify
+        # yamllint disable-line rule:line-length
+        uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-tox-verify.yaml@main
+        with:
+          GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
+          GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
+          GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
+          GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
+          GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
+          GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
+          GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
+          GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
+          GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
+          TOX_ENVS: '["py3"]'
+      - name: Run SonarCloud Scan
+        uses: sonarsource/sonarcloud-github-action@master
+        env:
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        with:
+          args:
+          SONAR_PROJECT_KEY: "o-ran-sc_com-pylog"
+          SONAR_ORG: "o-ran-sc"
+          SONAR_ARGS: >
+            -Dsonar.build.sourceEncoding=UTF-8
+            -Dsonar.organization=o-ran-sc
+            -Dsonar.projectBaseDir=.
+            -Dsonar.projectKey=o-ran-sc_com-pylog
+            -Dsonar.projectName=com-pylog
+            -Dsonar.python.coverage.reportPaths=./coverage.xm
+            -Dsonar.sources=mdclogpy
+            -Dsonar.verbose=true
+        secrets:
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
 
   report-status:
     if: ${{ always() }}