Add Go & Sonar jobs for servicemanager in nonrtric-plt-sme

Issue-ID: NONRTRIC-946
Change-Id: I74f37a2a8cf52330bacd63f6c8040993e539dcac
Signed-off-by: JohnKeeney <john.keeney@est.tech>
diff --git a/jjb/nonrtric-plt-sme/nonrtric-plt-sme.yaml b/jjb/nonrtric-plt-sme/nonrtric-plt-sme.yaml
index 83bd147..ff1d3d6 100644
--- a/jjb/nonrtric-plt-sme/nonrtric-plt-sme.yaml
+++ b/jjb/nonrtric-plt-sme/nonrtric-plt-sme.yaml
@@ -63,9 +63,36 @@
 
 - project:
     <<: *nonrtric_plt_sme_common
+    name: nonrtric-plt-sme-servicemanager
+    project-name: "{name}"
+    # image name
+    docker-name: "o-ran-sc/nonrtric-plt-servicemanager"
+    # get tag from YAML
+    container-tag-method: yaml-file
+    container-tag-yaml-dir: servicemanager
+    # use host network to clone from our gerrit
+    docker-build-args: "--network=host"
+    # Directory with Dockerfile
+    docker-root: "servicemanager"
+    # Limit build trigger to appropriate files
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: "servicemanager/.*"
+    # Directory where go test should be run
+    go-root: "servicemanager"
+    build-node: ubuntu1804-docker-4c-4g
+    # Includes verify and merge jobs
+    jobs:
+      - "{project-name}-gerrit-docker-jobs"
+      - gerrit-go-verify
+    stream:
+      - master:
+          branch: master
+
+- project:
+    <<: *nonrtric_plt_sme_common
     name: nonrtric-plt-sme-capifcore-sonar
-    # prescan script requires ubuntu
-    # golang is only on docker-enabled nodes
+    project-name: nonrtric-plt-sme-capifcore
     build-node: ubuntu1804-docker-4c-4g
     gerrit_trigger_file_paths:
       - compare-type: REG_EXP
@@ -73,7 +100,41 @@
     sonar-prescan-script: !include-raw-escape: prescan-capifcore-ubuntu.sh
     sonar-project-file: ""
     java-version: openjdk11
-    # use sonarcloud values from defaults.yaml
-    sonar-properties: !include-raw-escape: sonar-project.properties
+    sonar-properties: |
+      sonar.login={sonarcloud_api_token}
+      sonar.projectKey={sonarcloud_project_organization}_{project-name}
+      sonar.organization={sonarcloud_project_organization}
+      sonar.projectName={project-name}
+      sonar.build.sourceEncoding=UTF-8
+      sonar.language=go
+      sonar.projectBaseDir=capifcore
+      sonar.go.coverage.reportPaths=coverage.txt
+      sonar.inclusions=**/*.go
+      sonar.exclusions=**/*_test.go
     jobs:
       - gerrit-sonar-prescan-script
+
+- project:
+    <<: *nonrtric_plt_sme_common
+    name: nonrtric-plt-sme-servicemanager-sonar
+    project-name: nonrtric-plt-sme-servicemanager
+    build-node: ubuntu1804-docker-4c-4g
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: "servicemanager/.*"
+    sonar-prescan-script: !include-raw-escape: prescan-servicemanager-ubuntu.sh
+    sonar-project-file: ""
+    java-version: openjdk11
+    jobs:
+      - gerrit-sonar-prescan-script
+    sonar-properties: |
+      sonar.login={sonarcloud_api_token}
+      sonar.projectKey={sonarcloud_project_organization}_{project-name}
+      sonar.organization={sonarcloud_project_organization}
+      sonar.projectName={project-name}
+      sonar.build.sourceEncoding=UTF-8
+      sonar.language=go
+      sonar.projectBaseDir=servicemanager
+      sonar.go.coverage.reportPaths=coverage.txt
+      sonar.inclusions=**/*.go
+      sonar.exclusions=**/*_test.go
diff --git a/jjb/nonrtric-plt-sme/prescan-capifcore-ubuntu.sh b/jjb/nonrtric-plt-sme/prescan-capifcore-ubuntu.sh
index 78fdf8b..e696918 100644
--- a/jjb/nonrtric-plt-sme/prescan-capifcore-ubuntu.sh
+++ b/jjb/nonrtric-plt-sme/prescan-capifcore-ubuntu.sh
@@ -2,6 +2,7 @@
 ##############################################################################
 #
 #   Copyright (C) 2022: Nordix Foundation
+#   Copyright (C) 2024: OpenInfra Foundation Europe. All rights reserved.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -17,7 +18,7 @@
 #
 ##############################################################################
 
-echo "--> prescan-sme-ubuntu.sh"
+echo "--> prescan-sme-capifcore-ubuntu.sh"
 
 set -ex
 
@@ -27,4 +28,4 @@
 # build script execution
 bash capifcore/build-capifcore-ubuntu.sh
 
-echo "--> prescan-sme-ubuntu.sh ends"
+echo "--> prescan-sme-capifcore-ubuntu.sh ends"
diff --git a/jjb/nonrtric-plt-sme/prescan-servicemanager-ubuntu.sh b/jjb/nonrtric-plt-sme/prescan-servicemanager-ubuntu.sh
new file mode 100644
index 0000000..0a12f11
--- /dev/null
+++ b/jjb/nonrtric-plt-sme/prescan-servicemanager-ubuntu.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+##############################################################################
+#
+#   Copyright (C) 2024: OpenInfra Foundation Europe. All rights reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+
+echo "--> prescan-sme-servicemanager-ubuntu.sh"
+
+set -ex
+
+# Assumes ubuntu - uses apt-get
+sudo apt-get update
+
+# build script execution
+bash servicemanager/build-servicemanager-ubuntu.sh
+
+echo "--> prescan-sme-servicemanager-ubuntu.sh ends"