Resolving GO based verify Job's issues in NORDIX 63/19163/8
authorrohithrajneesh <rohith.rajneesh@est.tech>
Thu, 24 Aug 2023 15:06:37 +0000 (16:06 +0100)
committerrohithrajneesh <rohith.rajneesh@est.tech>
Fri, 15 Sep 2023 09:43:43 +0000 (10:43 +0100)
Resolving NONRTRIC veriy job in NORDIX

Change-Id: Ib17f9c8ede0daab867a8ce9cbb5f77990a1b865c
Signed-off-by: rohithrajneesh <rohith.rajneesh@est.tech>
jjb/oransc/global-templates-oran-go.yaml
jjb/oransc/global-templates-oran-nonrtric.yaml [new file with mode: 0644]
jjb/oransc/nonrtric-plt-sme/nonrtric-plt-sme-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/nonrtric/nonrtric-verify-jobs.yaml
jjb/oransc/verify-jobs-go.sh
jjb/oransc/verify-jobs-nonrtric.sh [new file with mode: 0644]
jjb/oransc/verify-jobs.sh [changed mode: 0755->0644]

index 5826cebb9f1af3ebf7815db46263b3ca34b8eed2..478993cfc781f9ee573472d0decf03872c526df6 100644 (file)
@@ -7,6 +7,7 @@
     properties:
       - logrotate
 
+    
     parameters:
       - nordix-gerrit-parameters
       - string:
       - string:
           name: GERRIT_REFSPEC
           default: ''
+      - string:
+          name: DIRECTORY
+          default: ""
+          description: Current Project Directory
 
     scm:
       - git-scm-gerrit:
diff --git a/jjb/oransc/global-templates-oran-nonrtric.yaml b/jjb/oransc/global-templates-oran-nonrtric.yaml
new file mode 100644 (file)
index 0000000..d084dc9
--- /dev/null
@@ -0,0 +1,41 @@
+- job-template:
+    name: 'oransc-{project-name}-verify'
+    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-nonrtric.sh
index 5aa0b5087fc6feb5157fa8b6da798fce32babd3c..3c390269948088438c9883bf7f80bdbe805366d1 100644 (file)
@@ -1,6 +1,6 @@
 ---
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2022 Nordix Foundation.
+#  Copyright (C) 2023 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # nonrtric/plt/sme project on Nordix Gerrit.
 
 - project:
-    name: nonrtric-plt-sme-verify
+    name: nonrtric-plt-sme-verify-go
     project: nonrtric/plt/sme
     project-name: nonrtric-plt-sme
-    jdk-version: java-11
+    directory: capifcore
 
     jobs:
-      - 'oransc-{project-name}-verify-java'
+      - 'oransc-{project-name}-verify-go'
index 9b8a9c7383557ab692428600f6ad76268ce4baab..5582fe016ec6075481a9470921f0ba56708087ec 100644 (file)
@@ -1,6 +1,6 @@
 ---
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2022 Nordix Foundation.
+#  Copyright (C) 2023 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # nonrtric/rapp/orufhrecovery project on Nordix Gerrit.
 
 - project:
-    name: nonrtric-rapp-orufhrecovery-verify
+    name: nonrtric-rapp-orufhrecovery-verify-go
     project: nonrtric/rapp/orufhrecovery
     project-name: nonrtric-rapp-orufhrecovery
+    directory: goversion
 
     jobs:
       - 'oransc-{project-name}-verify-go'
\ No newline at end of file
index 0bc50b667a480a62a728fa9568d5b69927bc1346..1d1408137c5667b7338c891ebd5e27c2f9f893f8 100644 (file)
 # nonrtric/rapp/ransliceassurance project on Nordix Gerrit.
 
 - project:
-    name: nonrtric-rapp-ransliceassurance-verify
+    name: nonrtric-rapp-ransliceassurance-ics-verify-go
     project: nonrtric/rapp/ransliceassurance
-    project-name: nonrtric-rapp-ransliceassurance
+    project-name: nonrtric-rapp-ransliceassurance-ics
+    directory: icsversion
+
+    jobs:
+      - 'oransc-{project-name}-verify-go'
+- project:
+    name: nonrtric-rapp-ransliceassurance-smo-verify-go
+    project: nonrtric/rapp/ransliceassurance
+    project-name: nonrtric-rapp-ransliceassurance-smo
+    directory: smoversion
 
     jobs:
       - 'oransc-{project-name}-verify-go'
\ No newline at end of file
index 1541696ea4d03955eb5c3799a897c56ff1a4a541..cd0df2349c9a670aa161c48842ea04929f679e13 100644 (file)
@@ -1,6 +1,6 @@
 ---
 # ============LICENSE_START====================================================
-#  Copyright (C) 2019 Nordix Foundation.
+#  Copyright (C) 2023 Nordix Foundation.
 # =============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # ============LICENSE_END======================================================
 
 - project:
-    name: nonrtric-rebase-verify
+    name: nonrtric-verify
     project: nonrtric
     project-name: nonrtric
-    jdk-version: java-17
 
     jobs:
-      - 'oransc-{project-name}-verify-java'
+      - 'oransc-{project-name}-verify'
index 6d94734359b42249280344fcbe101b20e174a0fa..10f809cb5b8122df15340b1c911c4024c3df5a5e 100644 (file)
@@ -1,19 +1,36 @@
-#!/bin/bash
+#!/bin/bash -x
 
 set -euo pipefail
 
-cd $WORKSPACE
+DIRECTORY = $WORKSPACE"/"$DIRECTORY
+cd $DIRECTORY
 
-# read go version from go.mod file
-version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+')
+# Read desired Go version from go.mod file
+desired_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" | sudo tar -C /usr/local -zxf -
+# Check installed Go version
+installed_version=$(go version | awk '{print $3}' | sed 's/go//')
 
-export PATH=$PATH:/usr/local/go/bin
+if [ "$desired_version" != "$installed_version" ]; then
+    echo "Desired Go version: $desired_version"
+    echo "Installed Go version: $installed_version"
+
+    # Remove existing Go installation
+    sudo rm -fr /usr/local/go
+
+    echo "Download go $desired_version"
+    curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf -
+
+    export PATH=$PATH:/usr/local/go/bin
+else
+    echo "Go version is up to date: $desired_version"
+fi
 
 echo "Download project deps"
 go mod tidy
 
+echo "Force build"
+go build -a -v
+
 echo "Run tests"
-go test ./...
+go test ./... -json
diff --git a/jjb/oransc/verify-jobs-nonrtric.sh b/jjb/oransc/verify-jobs-nonrtric.sh
new file mode 100644 (file)
index 0000000..d0ad54a
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+TEST_DIRECTORY="test/auto-test"
+TEST_SCRIPT="./Suite-Verify-jobs.sh"
+DOCKER_COMPOSE_VERSION="v2.21.0"
+
+# Check if jq is installed, and install it if not
+if ! command -v jq &> /dev/null; then
+    echo "Installing jq..."
+    sudo apt-get update
+    sudo apt-get install -y jq
+fi
+
+# Function to install Docker Compose version 2
+install_docker_compose() {
+    echo "Installing Docker Compose version 2..."
+    sudo curl -L "https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_VERSION"/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+    sudo chmod +x /usr/local/bin/docker-compose
+    sudo ln -s /usr/local/bin/docker-compose /usr/libexec/docker/cli-plugins/docker-compose
+}
+
+# Function to remove Docker Compose
+remove_docker_compose() {
+    echo "Removing Docker Compose..."
+    sudo rm /usr/local/bin/docker-compose
+}
+
+# Check if docker-compose is installed, and install it if not
+if ! command -v docker-compose &> /dev/null; then
+    install_docker_compose
+fi
+
+cd "$TEST_DIRECTORY"
+sudo chmod 775 "$TEST_SCRIPT"
+"$TEST_SCRIPT" remote-remove docker release --env-file ../common/test_env-oran-h-release.sh
+
+# Remove docker-compose after tests are done
+if command -v docker-compose &> /dev/null; then
+    remove_docker_compose
+fi
+
+# Remove jq after tests are done
+if command -v jq &> /dev/null; then
+    echo "Removing jq..."
+    sudo apt-get remove -y jq
+fi
old mode 100755 (executable)
new mode 100644 (file)