CI verify jobs for oransc golang projects 09/13009/1
authornauman <nauman.yaseen@est.tech>
Mon, 28 Mar 2022 15:15:19 +0000 (15:15 +0000)
committernauman <nauman.yaseen@est.tech>
Mon, 28 Mar 2022 15:15:19 +0000 (15:15 +0000)
oransc/nonrtric/plt/dmaapmediatorproducer
oransc/nonrtric/rapp/orufhrecovery
oransc/nonrtric/rapp/ransliceassurance

Change-Id: I0cfbadb8f04cce162ca35ca3f0d41e3ad4833892

jjb/oransc/global-templates-oran-go.yaml [new file with mode: 0644]
jjb/oransc/nonrtric-plt-dmaapmediatorproducer/nonrtric-plt-dmaapmediatorproducer-verify-jobs.yaml
jjb/oransc/nonrtric-rapp-orufhrecovery/nonrtric-rapp-orufhrecovery-verify-jobs.yaml
jjb/oransc/nonrtric-rapp-ransliceassurance/nonrtric-rapp-ransliceassurance-verify-jobs.yaml
jjb/oransc/verify-jobs-go.sh [new file with mode: 0644]

diff --git a/jjb/oransc/global-templates-oran-go.yaml b/jjb/oransc/global-templates-oran-go.yaml
new file mode 100644 (file)
index 0000000..5826ceb
--- /dev/null
@@ -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
index 27e201a0fde4f955606eebb1620f4414eaa425c0..d29db1c58a3452210f88dcbf238ff87cf169e58d 100644 (file)
@@ -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
index c9042620a2b05773dec6561f955d53f37e5d00ea..9b8a9c7383557ab692428600f6ad76268ce4baab 100644 (file)
@@ -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
index 367dd53f2c6c77ff30886375fef99cdbd4a2d779..0bc50b667a480a62a728fa9568d5b69927bc1346 100644 (file)
@@ -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 (file)
index 0000000..d5f70fc
--- /dev/null
@@ -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 ./...