From 23770c02859f9c76dc70139c5edd6bc2896d6877 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Sat, 16 Jul 2022 20:01:52 +0530 Subject: [PATCH] CORTX-32897: Support default parameters for pre-merge job Since Motr-Hare-Single-Node-Cluster-Deployment-On-Rocky-Linux will be used as a pre merge job we need to remove the parameters that it accepts and run the job on dedicated machines. Signed-off-by: Rinku Kothiya --- .../usr/libexec/cortx-motr/motr-cleanup | 4 +- .../jenkins/motr-hare-1node-cluster.groovy | 57 +++++++++---------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/scripts/install/usr/libexec/cortx-motr/motr-cleanup b/scripts/install/usr/libexec/cortx-motr/motr-cleanup index 268f17faeca..3f29ed4b16f 100755 --- a/scripts/install/usr/libexec/cortx-motr/motr-cleanup +++ b/scripts/install/usr/libexec/cortx-motr/motr-cleanup @@ -43,7 +43,7 @@ for s in m0d@* m0t1fs@* motr-client motr-kernel motr-mkfs motr-mkfs@* motr-serve motr_services="$motr_services $s.service" done -systemctl list-units --all $motr_services +systemctl list-units --all $motr_services | tee m0_log 'Stopping motr-kernel with all dependencies ...' systemctl stop motr-kernel || m0_exit 'Failed to stop motr-kernel.' @@ -51,7 +51,7 @@ systemctl stop motr-kernel || m0_exit 'Failed to stop motr-kernel.' m0_log 'Stopping all Motr services ...' systemctl stop $motr_services || m0_exit 'Failed to stop Motr services.' -systemctl list-units --all $motr_services +systemctl list-units --all $motr_services | tee for s in $(systemctl list-units --failed $motr_services | awk '/failed/ {if ($4 == "failed") print $2}'); do m0_log "Resetting failed state for $s." diff --git a/scripts/jenkins/motr-hare-1node-cluster.groovy b/scripts/jenkins/motr-hare-1node-cluster.groovy index 85165daa603..a91fda63cbc 100644 --- a/scripts/jenkins/motr-hare-1node-cluster.groovy +++ b/scripts/jenkins/motr-hare-1node-cluster.groovy @@ -1,56 +1,55 @@ #!/usr/bin/env groovy -pipeline { +pipeline { agent { node { - label 'ssc-vm-g3-rhev4-1327' + label 'sncr' } } - - parameters { - string(name: 'NODE_HOST', defaultValue: '', description: 'Node 1 Host FQDN', trim: true) - string(name: 'NODE_USER', defaultValue: '', description: 'Host machine root user', trim: true) - string(name: 'NODE_PASS', defaultValue: '', description: 'Host machine root user password', trim: true) - } options { timeout(time: 180, unit: 'MINUTES') timestamps() - ansiColor('xterm') + ansiColor('xterm') buildDiscarder(logRotator(numToKeepStr: "30")) } - environment { - NODE_PASS = "${NODE_PASS.isEmpty() ? NODE_DEFAULT_SSH_CRED_PSW : NODE_PASS}" - } stages { - stage('Checkout') { - steps { - checkout([$class: 'GitSCM', branches: [[name: "main"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'PathRestriction', excludedRegions: '', includedRegions: 'scripts/third-party-rpm/.*']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cortx-admin-github', url: "https://github.com/Seagate/cortx-motr"]]]) - } - } - stage ('Build rpm packages') { + stage ('Create Single node cluster') { steps { script { build_stage = env.STAGE_NAME } - sh label: 'to build motr and hare rpm', script: ''' - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} hostname - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} git clone https://github.com/Seagate/cortx-motr - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; /root/cortx-motr/scripts/build-prep-1node.sh -dev" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "hctl bootstrap --mkfs singlenode.yaml" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "dd if=/dev/urandom of=/tmp/128M bs=1M count=128" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "/opt/seagate/cortx/hare/libexec/m0crate-io-conf > /root/crate.yaml" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "/root/cortx-motr/utils/m0crate -S /root/crate.yaml" + sh label: 'Download code and install single node cluster', script: ''' + hostname + pwd + ln -s "$WORKSPACE" ../cortx-motr + #rm -rf cortx-motr + #git clone https://github.com/Seagate/cortx-motr + #cd cortx-motr + ./scripts/install/usr/libexec/cortx-motr/motr-cleanup || true + losetup -D + ./scripts/build-prep-1node.sh -dev + hctl bootstrap --mkfs ../singlenode.yaml + dd if=/dev/urandom of=/tmp/128M bs=1M count=128 + /opt/seagate/cortx/hare/libexec/m0crate-io-conf > ./crate.yaml + ./utils/m0crate -S ./crate.yaml ''' } } } - + post { always { script { - sh label: 'download_log_files', returnStdout: true, script: """ - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} rm -rf /root/cortx-motr + sh label: 'Clean up work space', returnStdout: true, script: """ + make uninstall || true + cd ../cortx-hare + make uninstall || true + #cd "$WORKSPACE" + cd .. + rm -f cortx-hare cortx-motr + echo Done """ + cleanWs() } } }