diff --git a/Jenkinsfile b/Jenkinsfile index 1ac736f..8b6d520 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,47 +30,47 @@ pipeline { parallel{ stage('TJobC IdResource: Attenders LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobc 0' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobc 0 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#attendersRestOperations"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobc 0 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#attendersRestOperations"' + }// EndExecutionStageErrorTJobC sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobc 0' - }// EndExecutionStageErrorTJobC }// EndStepsTJobC }// EndStageTJobC stage('TJobD IdResource: Configuration LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobd 0' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobd 0 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#courseRestOperations,CourseTeacherTest#teacherEditCourseValues"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobd 0 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#courseRestOperations,CourseTeacherTest#teacherEditCourseValues"' + }// EndExecutionStageErrorTJobD sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobd 0' - }// EndExecutionStageErrorTJobD }// EndStepsTJobD }// EndStageTJobD stage('TJobE IdResource: Configuration LoginService OpenVidu ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobe 0' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobe 0 https://full-teaching- 5000 "FullTeachingEndToEndEChatTests#oneToOneChatInSessionChrome"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobe 0 https://full-teaching- 5000 "FullTeachingEndToEndEChatTests#oneToOneChatInSessionChrome"' + }// EndExecutionStageErrorTJobE sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobe 0' - }// EndExecutionStageErrorTJobE }// EndStepsTJobE }// EndStageTJobE stage('TJobF IdResource: Course LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobf 0' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobf 0 https://full-teaching- 5000 "LoggedLinksTests#spiderLoggedTest,UnLoggedLinksTests#spiderUnloggedTest,CourseTeacherTest#teacherDeleteCourseTest"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobf 0 https://full-teaching- 5000 "LoggedLinksTests#spiderLoggedTest,UnLoggedLinksTests#spiderUnloggedTest,CourseTeacherTest#teacherDeleteCourseTest"' + }// EndExecutionStageErrorTJobF sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobf 0' - }// EndExecutionStageErrorTJobF }// EndStepsTJobF }// EndStageTJobF stage('TJobG IdResource: Course LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobg 0' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobg 0 https://full-teaching- 5000 "CourseStudentTest#studentCourseMainTest,CourseTeacherTest#teacherCourseMainTest,CourseTeacherTest#teacherCreateAndDeleteCourseTest"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobg 0 https://full-teaching- 5000 "CourseStudentTest#studentCourseMainTest,CourseTeacherTest#teacherCourseMainTest,CourseTeacherTest#teacherCreateAndDeleteCourseTest"' + }// EndExecutionStageErrorTJobG sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobg 0' - }// EndExecutionStageErrorTJobG }// EndStepsTJobG }// EndStageTJobG }// End Parallel @@ -80,47 +80,47 @@ pipeline { parallel{ stage('TJobH IdResource: Information LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobh 1' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobh 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#courseInfoRestOperations"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobh 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#courseInfoRestOperations"' + }// EndExecutionStageErrorTJobH sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobh 1' - }// EndExecutionStageErrorTJobH }// EndStepsTJobH }// EndStageTJobH stage('TJobI IdResource: Files LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobi 1' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobi 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#filesRestOperations"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobi 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#filesRestOperations"' + }// EndExecutionStageErrorTJobI sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobi 1' - }// EndExecutionStageErrorTJobI }// EndStepsTJobI }// EndStageTJobI stage('TJobJ IdResource: Forum LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobj 1' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobj 1 https://full-teaching- 5000 "LoggedForumTest#forumLoadEntriesTest"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobj 1 https://full-teaching- 5000 "LoggedForumTest#forumLoadEntriesTest"' + }// EndExecutionStageErrorTJobJ sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobj 1' - }// EndExecutionStageErrorTJobJ }// EndStepsTJobJ }// EndStageTJobJ stage('TJobK IdResource: Forum LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobk 1' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobk 1 https://full-teaching- 5000 "LoggedForumTest#forumNewCommentTest,LoggedForumTest#forumNewEntryTest,LoggedForumTest#forumNewReply2CommentTest,FullTeachingEndToEndRESTTests#forumRestOperations"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobk 1 https://full-teaching- 5000 "LoggedForumTest#forumNewCommentTest,LoggedForumTest#forumNewEntryTest,LoggedForumTest#forumNewReply2CommentTest,FullTeachingEndToEndRESTTests#forumRestOperations"' + }// EndExecutionStageErrorTJobK sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobk 1' - }// EndExecutionStageErrorTJobK }// EndStepsTJobK }// EndStageTJobK stage('TJobL IdResource: LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobl 1' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobl 1 https://full-teaching- 5000 "UserTest#loginTest"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobl 1 https://full-teaching- 5000 "UserTest#loginTest"' + }// EndExecutionStageErrorTJobL sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobl 1' - }// EndExecutionStageErrorTJobL }// EndStepsTJobL }// EndStageTJobL }// End Parallel @@ -130,20 +130,20 @@ pipeline { parallel{ stage('TJobM IdResource: Session LoginService OpenVidu ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobm 2' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobm 2 https://full-teaching- 5000 "FullTeachingTestEndToEndVideoSessionTests#oneToOneVideoAudioSessionChrome,FullTeachingLoggedVideoSessionTests#sessionTest"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobm 2 https://full-teaching- 5000 "FullTeachingTestEndToEndVideoSessionTests#oneToOneVideoAudioSessionChrome,FullTeachingLoggedVideoSessionTests#sessionTest"' + }// EndExecutionStageErrorTJobM sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobm 2' - }// EndExecutionStageErrorTJobM }// EndStepsTJobM }// EndStageTJobM stage('TJobN IdResource: Session LoginService OpenViduMock ') { steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobn 2' - sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobn 2 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#sessionRestOperations"' + catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { + sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobn 2 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#sessionRestOperations"' + }// EndExecutionStageErrorTJobN sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobn 2' - }// EndExecutionStageErrorTJobN }// EndStepsTJobN }// EndStageTJobN }// End Parallel diff --git a/retorchfiles/scripts/tjoblifecycles/tjob-setup.sh b/retorchfiles/scripts/tjoblifecycles/tjob-setup.sh index d1b0cd3..4d9479c 100644 --- a/retorchfiles/scripts/tjoblifecycles/tjob-setup.sh +++ b/retorchfiles/scripts/tjoblifecycles/tjob-setup.sh @@ -7,7 +7,7 @@ set -e DOCKER_HOST_IP=$(/sbin/ip route | awk '/default/ { print $3 }') export DOCKER_HOST_IP echo "Exporting the HOST_IP: $DOCKER_HOST_IP" -echo "The HOST_IP is: $DOCKER_HOST_IP" + # Custom Set-up commands echo "Executing custom commands" diff --git a/retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh b/retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh index a60df5d..497a2fe 100644 --- a/retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh +++ b/retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh @@ -19,9 +19,9 @@ TJOB_NAME="$1" STAGE="$2" PORT="$4" TEST_NAME="$5" -if [[ $url == "https://" || $url == "http://" ]]; then +if [[ $3 == "https://" || $3 == "http://" ]]; then echo "Only http:// || https:// protocol provided, using HOST DOCKER INTERNAL IP " - SUT_URL="$3"+DOCKER_HOST_IP + SUT_URL="$3$DOCKER_HOST_IP" else echo "Using the provided URL" SUT_URL="$3" @@ -38,15 +38,19 @@ LOCALHOST="$DOCKER_HOST_IP:$PORT" # Run Maven test mvn test -Ddirtarget="$TJOBNAME" -Dtest="$TEST_NAME" -Dtjob_name="$TJOB_NAME" -DSUT_URL="$SUT_URL" -DSUT_PORT="$PORT" +# Store Test result +MVN_EXIT_CODE=$? + +# Execute the script to write timestamp again +EXECUTE_TIMESTAMP_SCRIPT "$STAGE" "$TJOB_NAME" + # Check if Maven test failed -if [ $? -ne 0 ]; then - echo "Maven test FAILED with exit code $?." +if [ $MVN_EXIT_CODE -ne 0 ]; then + echo "Maven test FAILED with exit code $MVN_EXIT_CODE." exit 1 # Return 1 if the Maven test fails fi # If the script reaches here, the Maven test succeeded echo "Maven test succeeded." -# Execute the script to write timestamp again -EXECUTE_TIMESTAMP_SCRIPT "$STAGE" "$TJOB_NAME" exit 0