CI verify jobs for oransc golang projects
oransc/nonrtric/plt/dmaapmediatorproducer
oransc/nonrtric/rapp/orufhrecovery
oransc/nonrtric/rapp/ransliceassurance
Change-Id: I0cfbadb8f04cce162ca35ca3f0d41e3ad4833892
diff --git a/jjb/oransc/global-templates-oran-go.yaml b/jjb/oransc/global-templates-oran-go.yaml
new file mode 100644
index 0000000..5826ceb
--- /dev/null
+++ b/jjb/oransc/global-templates-oran-go.yaml
@@ -0,0 +1,40 @@
+- job-template:
+ name: 'oransc-{project-name}-verify-go'
+ node: oransc-ubuntu2004
+ disabled: false
+ concurrent: true
+
+ properties:
+ - logrotate
+
+ parameters:
+ - nordix-gerrit-parameters
+ - string:
+ name: PROJECT
+ default: 'oransc/{project}'
+ description: JJB configured PROJECT parameter to identify a Nordix Gerrit project
+ - string:
+ name: GERRIT_REFSPEC
+ default: ''
+
+ scm:
+ - git-scm-gerrit:
+ ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+ branch: $GERRIT_BRANCH
+ refspec: $GERRIT_REFSPEC
+ wipe_workspace: true
+ clean_before: false
+
+ triggers:
+ - nordix-gerrit-trigger-patchset-created:
+ project: 'oransc/{project}'
+ branch: '**'
+ files: '**'
+
+ wrappers:
+ - build-timeout:
+ timeout: 45
+
+ builders:
+ - shell:
+ !include-raw-escape: ./verify-jobs-go.sh
diff --git a/jjb/oransc/nonrtric-plt-dmaapmediatorproducer/nonrtric-plt-dmaapmediatorproducer-verify-jobs.yaml b/jjb/oransc/nonrtric-plt-dmaapmediatorproducer/nonrtric-plt-dmaapmediatorproducer-verify-jobs.yaml
index 27e201a..d29db1c 100644
--- a/jjb/oransc/nonrtric-plt-dmaapmediatorproducer/nonrtric-plt-dmaapmediatorproducer-verify-jobs.yaml
+++ b/jjb/oransc/nonrtric-plt-dmaapmediatorproducer/nonrtric-plt-dmaapmediatorproducer-verify-jobs.yaml
@@ -24,7 +24,6 @@
name: nonrtric-plt-dmaapmediatorproducer-verify
project: nonrtric/plt/dmaapmediatorproducer
project-name: nonrtric-plt-dmaapmediatorproducer
- jdk-version: java-11
jobs:
- - 'oransc-{project-name}-verify-java'
\ No newline at end of file
+ - 'oransc-{project-name}-verify-go'
\ No newline at end of file
diff --git a/jjb/oransc/nonrtric-rapp-orufhrecovery/nonrtric-rapp-orufhrecovery-verify-jobs.yaml b/jjb/oransc/nonrtric-rapp-orufhrecovery/nonrtric-rapp-orufhrecovery-verify-jobs.yaml
index c904262..9b8a9c7 100644
--- a/jjb/oransc/nonrtric-rapp-orufhrecovery/nonrtric-rapp-orufhrecovery-verify-jobs.yaml
+++ b/jjb/oransc/nonrtric-rapp-orufhrecovery/nonrtric-rapp-orufhrecovery-verify-jobs.yaml
@@ -24,7 +24,6 @@
name: nonrtric-rapp-orufhrecovery-verify
project: nonrtric/rapp/orufhrecovery
project-name: nonrtric-rapp-orufhrecovery
- jdk-version: java-11
jobs:
- - 'oransc-{project-name}-verify-java'
\ No newline at end of file
+ - 'oransc-{project-name}-verify-go'
\ No newline at end of file
diff --git a/jjb/oransc/nonrtric-rapp-ransliceassurance/nonrtric-rapp-ransliceassurance-verify-jobs.yaml b/jjb/oransc/nonrtric-rapp-ransliceassurance/nonrtric-rapp-ransliceassurance-verify-jobs.yaml
index 367dd53..0bc50b6 100644
--- a/jjb/oransc/nonrtric-rapp-ransliceassurance/nonrtric-rapp-ransliceassurance-verify-jobs.yaml
+++ b/jjb/oransc/nonrtric-rapp-ransliceassurance/nonrtric-rapp-ransliceassurance-verify-jobs.yaml
@@ -24,7 +24,6 @@
name: nonrtric-rapp-ransliceassurance-verify
project: nonrtric/rapp/ransliceassurance
project-name: nonrtric-rapp-ransliceassurance
- jdk-version: java-11
jobs:
- - 'oransc-{project-name}-verify-java'
\ No newline at end of file
+ - 'oransc-{project-name}-verify-go'
\ No newline at end of file
diff --git a/jjb/oransc/verify-jobs-go.sh b/jjb/oransc/verify-jobs-go.sh
new file mode 100644
index 0000000..d5f70fc
--- /dev/null
+++ b/jjb/oransc/verify-jobs-go.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd $WORKSPACE
+
+# read go version from go.mod file
+version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+')
+
+echo "Download go $version"
+curl -L "https://go.dev/dl/go$version.linux-amd64.tar.gz" | tar -C /usr/local -zxf -
+
+export PATH=$PATH:/usr/local/go/bin
+export CGO_ENABLED=0
+
+echo "Download project deps"
+go mod tidy
+
+echo "Run tests"
+go test ./...