Skip to content

Commit b9072bd

Browse files
Yakov FeldmanMarkLogic Builder
authored andcommitted
DEVO-240: Investigate connection issues in nightly regressions
1 parent 0cf2e3b commit b9072bd

File tree

1 file changed

+101
-71
lines changed

1 file changed

+101
-71
lines changed

Jenkinsfile

Lines changed: 101 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,61 @@ void cypressE2EOnPremWinTests(String type,String mlVersion){
617617

618618
}
619619

620+
void mergePR(){
621+
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
622+
script{
623+
props = readProperties file:'data-hub/pipeline.properties';
624+
JIRA_ID=env.CHANGE_TITLE.split(':')[0]
625+
def response = sh (returnStdout: true, script:'''curl -u $Credentials --header "application/vnd.github.merge-info-preview+json" "'''+githubAPIUrl+'''/pulls/$CHANGE_ID" | grep '"mergeable_state":' | cut -d ':' -f2 | cut -d ',' -f1 | tr -d '"' ''')
626+
response=response.trim();
627+
println(response)
628+
if(response.equals("clean")){
629+
println("merging can be done")
630+
sh "curl -o - -s -w \"\n%{http_code}\n\" -X PUT -d '{\"commit_title\": \"$JIRA_ID: merging PR\", \"merge_method\": \"rebase\"}' -u $Credentials "+ githubAPIUrl+"/pulls/$CHANGE_ID/merge | tail -2 > mergeResult.txt"
631+
def mergeResult = readFile('mergeResult.txt').trim()
632+
if(mergeResult=="200"){
633+
println("Merge successful")
634+
}else{
635+
println("Merge Failed")
636+
sh 'exit 123'
637+
}
638+
}else if(response.equals("blocked")){
639+
println("retry blocked");
640+
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
641+
def reviewersList = sh (returnStdout: true, script:'''
642+
curl -u $Credentials -X GET '''+githubAPIUrl+'''/pulls/$CHANGE_ID/requested_reviewers
643+
''')
644+
def slurper = new JsonSlurperClassic().parseText(reviewersList.toString().trim())
645+
def emailList="";
646+
for(def user:slurper.users){
647+
email=getEmailFromGITUser user.login;
648+
emailList+=email+',';
649+
}
650+
sendMail emailList,'Check the Pipeline View Here: ${JENKINS_URL}/blue/organizations/jenkins/Datahub_CI/detail/$JOB_BASE_NAME/$BUILD_ID \n\n\n Check Console Output Here: ${BUILD_URL}/console \n\n\n $BRANCH_NAME is waiting for the code-review to complete. Please click on proceed button if all the reviewers approved the code here. \n\n ${BUILD_URL}input ',false,'Waiting for code review $BRANCH_NAME '
651+
652+
}
653+
sleep time: 30, unit: 'MINUTES'
654+
throw new Exception("Waiting for all the status checks to pass");
655+
}else if(response.equals("unstable")){
656+
println("retry unstable")
657+
sh "curl -o - -s -w \"\n%{http_code}\n\" -X PUT -d '{\"commit_title\": \"$JIRA_ID: merging PR\", \"merge_method\": \"rebase\"}' -u $Credentials "+githubAPIUrl+"/pulls/$CHANGE_ID/merge | tail -2 > mergeResult.txt"
658+
def mergeResult = readFile('mergeResult.txt').trim()
659+
if(mergeResult=="200"){
660+
println("Merge successful")
661+
}else{
662+
println("Merge Failed")
663+
sh 'exit 123'
664+
}
665+
println("Result is"+ mergeResult)
666+
}else{
667+
println("merging not possible")
668+
currentBuild.result = "FAILURE"
669+
sh 'exit 1';
670+
}
671+
}
672+
}
673+
}
674+
620675
pipeline{
621676
agent none;
622677
options {
@@ -794,6 +849,7 @@ pipeline{
794849
if(!params.regressions) error("Pre merge tests Failed");
795850
}}
796851
}}
852+
797853
stage('code-review'){
798854
when {
799855
expression {return env.TESTS_PASSED && env.UNIT_TESTS_PASSED && env.CYPRESSE2E_TESTS_PASSED && env.TESTS_PASSED.toBoolean() && env.UNIT_TESTS_PASSED.toBoolean() && env.CYPRESSE2E_TESTS_PASSED.toBoolean()}
@@ -811,63 +867,8 @@ pipeline{
811867
beforeAgent true
812868
}
813869
agent {label 'dhmaster'};
814-
steps{
815-
retry(5){
816-
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
817-
script{
818-
props = readProperties file:'data-hub/pipeline.properties';
819-
JIRA_ID=env.CHANGE_TITLE.split(':')[0]
820-
def response = sh (returnStdout: true, script:'''curl -u $Credentials --header "application/vnd.github.merge-info-preview+json" "'''+githubAPIUrl+'''/pulls/$CHANGE_ID" | grep '"mergeable_state":' | cut -d ':' -f2 | cut -d ',' -f1 | tr -d '"' ''')
821-
response=response.trim();
822-
println(response)
823-
if(response.equals("clean")){
824-
println("merging can be done")
825-
sh "curl -o - -s -w \"\n%{http_code}\n\" -X PUT -d '{\"commit_title\": \"$JIRA_ID: merging PR\", \"merge_method\": \"rebase\"}' -u $Credentials "+ githubAPIUrl+"/pulls/$CHANGE_ID/merge | tail -2 > mergeResult.txt"
826-
def mergeResult = readFile('mergeResult.txt').trim()
827-
if(mergeResult=="200"){
828-
println("Merge successful")
829-
}else{
830-
println("Merge Failed")
831-
sh 'exit 123'
832-
}
833-
}else if(response.equals("blocked")){
834-
println("retry blocked");
835-
withCredentials([usernameColonPassword(credentialsId: '550650ab-ee92-4d31-a3f4-91a11d5388a3', variable: 'Credentials')]) {
836-
def reviewersList = sh (returnStdout: true, script:'''
837-
curl -u $Credentials -X GET '''+githubAPIUrl+'''/pulls/$CHANGE_ID/requested_reviewers
838-
''')
839-
def slurper = new JsonSlurperClassic().parseText(reviewersList.toString().trim())
840-
def emailList="";
841-
for(def user:slurper.users){
842-
email=getEmailFromGITUser user.login;
843-
emailList+=email+',';
844-
}
845-
sendMail emailList,'Check the Pipeline View Here: ${JENKINS_URL}/blue/organizations/jenkins/Datahub_CI/detail/$JOB_BASE_NAME/$BUILD_ID \n\n\n Check Console Output Here: ${BUILD_URL}/console \n\n\n $BRANCH_NAME is waiting for the code-review to complete. Please click on proceed button if all the reviewers approved the code here. \n\n ${BUILD_URL}input ',false,'Waiting for code review $BRANCH_NAME '
846-
847-
}
848-
sleep time: 30, unit: 'MINUTES'
849-
throw new Exception("Waiting for all the status checks to pass");
850-
}else if(response.equals("unstable")){
851-
println("retry unstable")
852-
sh "curl -o - -s -w \"\n%{http_code}\n\" -X PUT -d '{\"commit_title\": \"$JIRA_ID: merging PR\", \"merge_method\": \"rebase\"}' -u $Credentials "+githubAPIUrl+"/pulls/$CHANGE_ID/merge | tail -2 > mergeResult.txt"
853-
def mergeResult = readFile('mergeResult.txt').trim()
854-
if(mergeResult=="200"){
855-
println("Merge successful")
856-
}else{
857-
println("Merge Failed")
858-
sh 'exit 123'
859-
}
860-
println("Result is"+ mergeResult)
861-
}else{
862-
println("merging not possible")
863-
currentBuild.result = "FAILURE"
864-
sh 'exit 1';
865-
}
866-
}
867-
}
868-
}
869-
}
870-
post{
870+
steps{retry(5){mergePR()}}
871+
post{
871872
success {
872873
println("Merge Successful")
873874
script{
@@ -884,8 +885,7 @@ pipeline{
884885
sendMail email,'<h3>Could not rebase and merge the <a href=${CHANGE_URL}>$BRANCH_NAME</a></h3><h3>Please check if there are any conflicts due to rebase and merge and resolve them</h3><h4><a href=${RUN_DISPLAY_URL}>Check the Pipeline View</a></h4><h4> <a href=${BUILD_URL}/console> Check Console Output Here</a></h4>',false,'Merging Failed on $BRANCH_NAME'
885886
}
886887
}
887-
}
888-
}
888+
}}
889889

890890
stage('publishing'){
891891
when {
@@ -913,17 +913,24 @@ pipeline{
913913
}
914914
}
915915

916-
stage('rh7-singlenode-9.0-11'){
916+
stage('rh7-singlenode'){
917+
when { expression {return params.regressions} }
918+
parallel {
919+
stage('rh7-singlenode-9.0-11') {
917920
when { expression {return params.regressions} }
918921
agent { label 'dhfLinuxAgent'}
919-
steps{
920-
timeout(time: 3, unit: 'HOURS'){
922+
environment{
923+
JAVA_HOME="$JAVA_HOME_DIR"
924+
PATH="$JAVA_HOME:$PATH"
925+
}
926+
steps{timeout(time: 3, unit: 'HOURS'){
921927
catchError(buildResult: 'SUCCESS', catchInterruptions: true, stageResult: 'FAILURE') {
922928
script{
929+
cleanWs()
923930
props = readProperties file:'data-hub/pipeline.properties';
924931
copyRPM 'Release','9.0-11'
925932
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
926-
sh 'export JAVA_HOME=`eval echo "$JAVA_HOME_DIR"`;export GRADLE_USER_HOME=$WORKSPACE$GRADLE_DIR;export M2_HOME=$MAVEN_HOME/bin;export PATH=$JAVA_HOME/bin:$GRADLE_USER_HOME:$PATH:$MAVEN_HOME/bin;cd $WORKSPACE/data-hub;rm -rf $GRADLE_USER_HOME/caches;./gradlew clean;set +e;./gradlew marklogic-data-hub:bootstrapAndTest -Dorg.gradle.jvmargs=-Xmx1g -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew ml-data-hub:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew web:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew marklogic-data-hub-central:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/ |& tee console.log;sleep 10s;./gradlew marklogic-data-hub-spark-connector:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew ml-data-hub:testFullCycle -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/ ;sleep 10s;./gradlew marklogic-data-hub-spark-connector:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;'
933+
sh 'cd $WORKSPACE/data-hub;./gradlew -g ./cache-build clean;set +e;./gradlew -g ./cache-build marklogic-data-hub:bootstrapAndTest -Dorg.gradle.jvmargs=-Xmx1g -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew -g ./cache-build ml-data-hub:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew -g ./cache-build web:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew -g ./cache-build marklogic-data-hub-central:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/ |& tee console.log;sleep 10s;./gradlew -g ./cache-build marklogic-data-hub-spark-connector:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;sleep 10s;./gradlew -g ./cache-build marklogic-data-hub-spark-connector:test -i --stacktrace -PnodeDistributionBaseUrl=http://node-mirror.eng.marklogic.com:8080/;'
927934
junit '**/TEST-*.xml'
928935
def output=readFile 'data-hub/console.log'
929936
def result=false;
@@ -936,22 +943,45 @@ pipeline{
936943
}}}
937944
}
938945
post{
939-
always{
940-
sh 'rm -rf $WORKSPACE/xdmp'
941-
}
942-
success {
946+
success {
943947
println("End-End Tests Completed")
944948
sendMail Email,'<h3>Tests Passed on Released 9.0 ML Server Single Node </h3><h4><a href=${RUN_DISPLAY_URL}>Check the Pipeline View</a></h4><h4> <a href=${BUILD_URL}/console> Check Console Output Here</a></h4>',false,'$BRANCH_NAME branch | Linux RH7 | ML-9.0-11 | Single Node | Passed'
945949

946-
}
947-
unstable {
950+
}
951+
unstable {
948952
println("End-End Tests Failed")
949953
sh 'mkdir -p MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/MLLogs/'
950954
archiveArtifacts artifacts: 'MLLogs/**/*'
951955
sendMail Email,'<h3>Some Tests Failed on Released 9.0 ML Server Single Node </h3><h4><a href=${JENKINS_URL}/blue/organizations/jenkins/Datahub_CI/detail/$JOB_BASE_NAME/$BUILD_ID/tests><font color=red>Check the Test Report</font></a></h4><h4><a href=${RUN_DISPLAY_URL}>Check the Pipeline View</a></h4><h4> <a href=${BUILD_URL}/console> Check Console Output Here</a></h4><h4>Please create bugs for the failed regressions and fix them</h4>',false,'$BRANCH_NAME branch | Linux RH7 | ML-9.0-11 | Single Node | Failed'
952-
}
953-
}
956+
}}
954957
}
958+
stage('fullCycle-rh7-singlenode-9.0-11') {
959+
agent { label 'dhfLinuxAgent' }
960+
environment{
961+
JAVA_HOME="$JAVA_HOME_DIR"
962+
PATH="$JAVA_HOME:$PATH"
963+
}
964+
steps {timeout(time: 3, unit: 'HOURS') {
965+
catchError(buildResult: 'SUCCESS', catchInterruptions: true, stageResult: 'FAILURE') {
966+
cleanWs()
967+
copyRPM 'Release', '9.0-11'
968+
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
969+
sh 'cd $WORKSPACE/data-hub;./gradlew -g ./cache-build clean ml-data-hub:testFullCycle -i --stacktrace'
970+
junit '**/TEST-*.xml'
971+
}
972+
}}
973+
post {
974+
success {
975+
println("End-End Tests Completed")
976+
sendMail Email, '<h3>Tests Passed on Released 9.0 ML Server Single Node </h3><h4><a href=${RUN_DISPLAY_URL}>Check the Pipeline View</a></h4><h4> <a href=${BUILD_URL}/console> Check Console Output Here</a></h4>', false, '$BRANCH_NAME branch | Linux RH7 | ML-9.0-11 | Single Node | Passed'
977+
}
978+
unstable {
979+
println("End-End Tests Failed")
980+
sh 'mkdir -p MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/MLLogs/'
981+
archiveArtifacts artifacts: 'MLLogs/**/*'
982+
sendMail Email, '<h3>Some Tests Failed on Released 9.0 ML Server Single Node </h3><h4><a href=${JENKINS_URL}/blue/organizations/jenkins/Datahub_CI/detail/$JOB_BASE_NAME/$BUILD_ID/tests><font color=red>Check the Test Report</font></a></h4><h4><a href=${RUN_DISPLAY_URL}>Check the Pipeline View</a></h4><h4> <a href=${BUILD_URL}/console> Check Console Output Here</a></h4><h4>Please create bugs for the failed regressions and fix them</h4>', false, '$BRANCH_NAME branch | Linux RH7 | ML-9.0-11 | Single Node | Failed'
983+
}}}
984+
}}
955985

956986
stage('Linux Core Parallel Execution'){
957987
when { expression {return params.regressions} }

0 commit comments

Comments
 (0)