This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <rinku.kothiya@seagate.com>
- Loading branch information
Showing
2 changed files
with
76 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,105 @@ | ||
#!/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")) | ||
} | ||
|
||
parameters { | ||
string(name: 'MOTR_REPO', defaultValue: 'https://github.com/Seagate/cortx-motr', description: 'Repo to be used for Motr build.') | ||
string(name: 'MOTR_BRANCH', defaultValue: 'main', description: 'Branch to be used for Motr build.') | ||
} | ||
|
||
environment { | ||
NODE_PASS = "${NODE_PASS.isEmpty() ? NODE_DEFAULT_SSH_CRED_PSW : NODE_PASS}" | ||
release_tag = "last_successful_prod" | ||
REPO_NAME = 'cortx-motr' | ||
GITHUB_TOKEN = credentials('cortx-admin-github') // To clone cortx-motr repo | ||
GPR_REPO = "https://github.com/${ghprbGhRepository}" | ||
MOTR_REPO = "${ghprbGhRepository != null ? GPR_REPO : MOTR_REPO}" | ||
MOTR_BRANCH = "${sha1 != null ? sha1 : MOTR_BRANCH}" | ||
MOTR_GPR_REFSPEC = "+refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*" | ||
MOTR_BRANCH_REFSPEC = "+refs/heads/*:refs/remotes/origin/*" | ||
MOTR_PR_REFSPEC = "${ghprbPullId != null ? MOTR_GPR_REFSPEC : MOTR_BRANCH_REFSPEC}" | ||
repoURL = "${MOTR_REPO}".replace("github.com", "$GITHUB_TOKEN@github.com") | ||
} | ||
|
||
stages { | ||
stage('Checkout') { | ||
stage ('Cleanup VM') { | ||
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"]]]) | ||
checkout([$class: 'GitSCM', branches: [[name: "${MOTR_BRANCH}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: 5], [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: false, reference: '', trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cortx-admin-github', url: "${MOTR_REPO}", name: 'origin', refspec: "${MOTR_PR_REFSPEC}"]]]) | ||
script { | ||
sh label: 'Clean up VM before use', script: ''' | ||
hostname | ||
pwd | ||
cd "$WORKSPACE" | ||
#ln -s "$WORKSPACE" "$WORKSPACE/../cortx-motr" | ||
./scripts/install/usr/libexec/cortx-motr/motr-cleanup || true | ||
losetup -D | ||
make uninstall || true | ||
cd "$WORKSPACE/../cortx-hare" || true | ||
make uninstall || true | ||
cd "$WORKSPACE/.." | ||
rm -rf cortx-hare cortx-motr | ||
yum remove cortx-hare cortx-motr{,-devel} cortx-py-utils consul -y | ||
rm -rf /var/crash/* /var/log/seagate/* /var/log/hare/* /var/log/motr/* /var/lib/hare/* /var/motr/* /etc/motr/* | ||
rm -rf /root/.cache/dhall* /root/rpmbuild | ||
rm -rf /etc/yum.repos.d/motr_last_successful.repo /etc/yum.repos.d/motr_uploads.repo /etc/yum.repos.d/lustre_release.repo | ||
''' | ||
} | ||
} | ||
} | ||
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" | ||
''' | ||
script { | ||
sh label: 'Download code and install single node cluster', script: ''' | ||
rm -rf $REPO_NAME | ||
echo "MOTR_REPO: ${MOTR_REPO}" | ||
git clone "$repoURL" "$REPO_NAME" | ||
cd "${REPO_NAME}" | ||
git fetch origin "${MOTR_PR_REFSPEC}" | ||
git checkout "${MOTR_BRANCH}" | ||
git log -1 | ||
ls -la | ||
./scripts/build-prep-1node.sh -dev | ||
hctl bootstrap --mkfs ../singlenode.yaml | ||
sleep 60 | ||
hctl status -d | ||
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: """ | ||
pwd | ||
cd "$WORKSPACE" | ||
./scripts/install/usr/libexec/cortx-motr/motr-cleanup || true | ||
losetup -D | ||
make uninstall || true | ||
cd "$WORKSPACE/../cortx-hare" || true | ||
make uninstall || true | ||
cd "$WORKSPACE/.." | ||
rm -rf cortx-hare cortx-motr | ||
echo Done | ||
""" | ||
cleanWs() | ||
} | ||
} | ||
} | ||
} | ||
|