feat(hicn.yaml): add project and job-template for sonar scanner. 61/36861/4
authorMauro Sardara <msardara@cisco.com>
Wed, 10 Aug 2022 17:08:42 +0000 (19:08 +0200)
committerMauro Sardara <msardara@cisco.com>
Wed, 10 Aug 2022 17:15:12 +0000 (19:15 +0200)
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: I86c9baa94b6df0e2ec722e47e660d1d70fb71d39
Signed-off-by: Mauro Sardara <msardara@cisco.com>
jjb/hicn/hicn.yaml
jjb/scripts/hicn/sonar.sh [new file with mode: 0644]

index 2667a8a..82bef0d 100644 (file)
       - project-view
     project-name: hicn
 
+- project:
+    name: hicn-sonar
+    jobs:
+      - hicn-sonar-scanner
+    project: hicn
+    sonarcloud: true
+    sonarcloud-project-organization: "{sonarcloud_project_organization}"
+    sonarcloud-api-token: "{sonarcloud_api_token}"
+    sonarcloud-project-key: "{sonarcloud_project_organization}-{project}"
+    stream:
+      - hicn:
+          branch: "master"
+
+- job-template:
+    name: hicn-sonar-scanner
+
+    project-type: freestyle
+    node: centos7-docker-4c-4g
+    concurrent: true
+
+    scm:
+      - gerrit-trigger-scm:
+          credentials-id: "jenkins-gerrit-credentials"
+          refspec: ""
+          choosing-strategy: "default"
+
+    wrappers:
+      - fdio-infra-wrappers:
+          build-timeout: "{build-timeout}"
+
+    triggers:
+      - gerrit-trigger-patch-merged:
+          name: "{project}"
+          branch: "{branch}"
+
+    builders:
+      - inject:
+          properties-content: |
+            SONAR_HOST_URL=https://sonarcloud.io
+            PROJECT_KEY={sonarcloud-project-key}
+            PROJECT_ORGANIZATION={sonarcloud-project-organization}
+            API_TOKEN={sonarcloud-api-token}
+      - shell: !include-raw-escape:
+          - ../scripts/hicn/sonar.sh
+
 - job-template:
     name: "hicn-checkstyle-verify-{stream}-{os}-{executor-arch}"
 
     publishers:
       - fdio-infra-publish
 
-- project:
-    name: hicn-sonar
-    project: hicn
-    project-name: hicn
-    mvn-settings: hicn-settings
-    sonarcloud: true
-    sonarcloud-project-organization: "{sonarcloud_project_organization}"
-    sonarcloud-api-token: "{sonarcloud_api_token}"
-    sonarcloud-project-key: "{sonarcloud_project_organization}_{project-name}"
-    branch: master
-    build-node: centos7-docker-2c-2g
-    jobs:
-      - gerrit-maven-sonar
-
 - job-template:
     name: "hicn-extras-verify-{stream}-{os}-{executor-arch}"
 
diff --git a/jjb/scripts/hicn/sonar.sh b/jjb/scripts/hicn/sonar.sh
new file mode 100644 (file)
index 0000000..2f2060c
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -euxo pipefail
+
+echo "---> jjb/scripts/hicn/sonar.sh"
+
+pushd scripts
+bash ./build-sonar.sh
+popd