Documente Academic
Documente Profesional
Documente Cultură
/*
* This method is used to clone branch jenkins-imran to the C:\GIT folder
* The branch name is hard coded but it is possible to make it dynamic
* */
def checkOutLatestCodeInGIT(def nodeName){
timeout(20){
}
}
/*
* This method is used to copy the zip folder with the war files and all the
plugins in
* the C:\Artifacts folder.
* */
def copyArtifact(nodeName){
node(nodeName){
timeout(30){
println("Copy Artificat for the node :"+nodeName);
step([$class: 'CopyArtifact',filter: '*', fingerprintArtifacts: true,
projectName: "${ORIGINAL_PROJECT_NAME}", selector: [$class:
'SpecificBuildSelector',
buildNumber: "${ORIGINAL_PROJECT_BUILD_NUMBER}"], target:
'C:\\Artifacts'])
println("Copying Artifact was successful for :"+nodeName);
}
}
}
/*
* This method cleans all the files before deploying new war file and the plugins
* */
def preDeployementScript(nodeName){
node(nodeName){
timeout(20){
println("Running the PSS Predeployement Script "+nodeName);
dir("C:\\GIT\\ci\\pss_ci"){
bat 'python pss_pre_deployment.py'
}
}
}
}
/*
* This method is used to copy the war file and the plugins to the dedicated
folders
* The plugin ins are hard coded, as we deploy the same plugins each time we deploy
a build
* */
def deployTheWarFilesAndPlugins(nodeName){
node(nodeName){
timeout(30){
plugins = " \"HealthPortal.jar\" \"HL7Handler.jar\" \"Interior
Health Lab Importer.jar\" \"NEON Importer.jar\" \"Rad-Logic
Importer.jar\" \"ReportManagerImporter.jar\" \"SJH Importer.jar\" \"SMHTO
Importer.jar\" \"Sunnybrook Importer.jar\" \"TWH Importer.jar\" \"WCH
Importer.jar\"";
command = "python pss_deployment.py"+plugins
println("Started Copying War Files and PSS Plugins on "+nodeName);
println("Sending the following command"+command);
dir("C:\\GIT\\ci\\pss_ci"){
bat command;
}
}
}
}
/*
* This method restores Database
* */
def restoreDatabase(nodeName){
node(nodeName){
timeout(30){
println("Restoring Database on "+nodeName);
dir("C:\\GIT\\ci\\pss_ci"){
bat 'python oracle_db_restore.py'
}
}
}
}
/*
* This method is used to turn on the tomcat and keeping on waiting until the
server is ready
* to be used, so it will running until the server is up and take the interrupt off
when the server if on
* */
def turnOnTomCat(nodeName){
node(nodeName){
timeout(70){
println("Restoring Database on "+nodeName);
dir("C:\\GIT\\ci\\pss_ci"){
bat 'python pss_post_deployment.py'
}
}
}
}
/*
* This method is for client side of the Jenkins, It runs the whole UI test
* */
def run_ci_tests(nodeName){
node(nodeName){
timeout(350){
println("Restoring Database on "+nodeName);
dir("C:\\GIT\\Ui"){
bat 'python run_ui_tests_jenkins.py'
}
}
}
}
/*
* This method copies file to a central repository
* */
def copyFilesToACentralRepository(nodeName){
node(nodeName){
timeout(20){
println("Copying Files to a central repository "+nodeName);
dir("C:\\GIT\\ci\\pss_ci"){
bat 'python file_synchronization.py'
}
}
}
}
/*
* This method is used to get rid of files which are in the repository for more
than 10 days
* */
def getRidOfOldFiles(nodeName){
node(nodeName){
timeout(20){
println("Cleaning up the repository "+nodeName);
dir("C:\\GIT\\ci\\pss_ci"){
bat 'python cleanup_repository.py'
}
}
}
}
stage('Regression Test'){
parallel one:{
node(serverName1) {
println("Checking out the Latest GIT Code in the Node1 ");
// Deploy Snapshot
//deploySnapshot(serverName1);
//deploySnapshot(clientName1);
//GIT Fetch
//checkOutLatestCodeInGIT(serverName1);
// Running the pre-deployement script
//preDeployementScript(serverName1);
// Database Restore
//restoreDatabase(serverName1);
//Copy Artifact from Jenkins to the local folder
//copyArtifact(serverName1);
// Putting the War Files and Plugins in places
//deployTheWarFilesAndPlugins(serverName1);
// Turn on the Tomcat Server
//turnOnTomCat(serverName1);
node(clientName1) {
//checkOutLatestCodeInGIT(clientName1);
// Turn on the CI Tests in the client side
run_ci_tests(clientName1);
}
}
},
two: {
node(serverName2)
{
println("Checking out the Latest GIT Code in the Node 2");
// Deploy Snapshot
//deploySnapshot(serverName2);
//deploySnapshot(clientName2);
//GIT Fetch
//checkOutLatestCodeInGIT(serverName2);
// Running the pre-deployement script
//preDeployementScript(serverName2);
// Database Restore
//restoreDatabase(serverName2);
//Copy Artifact from Jenkins to the local folder
//copyArtifact(serverName2);
// Putting the War Files and Plugins in places
//deployTheWarFilesAndPlugins(serverName2);
//Turn on the Tomcat Server
//turnOnTomCat(serverName2);
node(clientName2) {
//checkOutLatestCodeInGIT(clientName2);
// Turn on the CI Tests in the client side
run_ci_tests(clientName2);
}
}
},
three: {
node(serverName3)
{
println("Checking out the Latest GIT Code in the Node 3");
// Deploy Snapshot
//deploySnapshot(serverName3);
//deploySnapshot(clientName3);
//GIT Fetch
//checkOutLatestCodeInGIT(serverName3);
// Running the pre-deployement script
//preDeployementScript(serverName3);
// Database Restore
//restoreDatabase(serverName3);
//Copy Artifact from Jenkins to the local folder
//copyArtifact(serverName3);
// Putting the War Files and Plugins in places
//deployTheWarFilesAndPlugins(serverName3);
// Turn on the Tomcat Server
//turnOnTomCat(serverName3);
node(clientName3) {
//checkOutLatestCodeInGIT(clientName3);
// Turn on the CI Tests in the client side
run_ci_tests(clientName3);
}
def deploySnapshot(nodeName){
node(nodeName){
def giveExactComputerName(nodeName){