Skip to content

Commit

Permalink
Improving RETORCH tool to provide Jenkinsfiles in generic projects
Browse files Browse the repository at this point in the history
  • Loading branch information
augustocristian committed Dec 10, 2023
1 parent a844667 commit 7b2f364
Show file tree
Hide file tree
Showing 41 changed files with 768 additions and 298 deletions.
226 changes: 108 additions & 118 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,174 +1,164 @@
pipeline {
agent {label 'xretorch-agent'}
environment {
ET_EUS_API = "http://selenoid:4444/wd/hub"
CURRENT_DATE = " date +\'[%m-%d-%y] %T - \'"
//Used to avoid the UnixHTTPConnectionPool(host='localhost', port=None): Read timed out and
DOCKER_CLIENT_TIMEOUT = 120
COMPOSE_HTTP_TIMEOUT = 120
}//EndEnvironment
SELENOID_PRESENT = "TRUE"
SUT_LOCATION = "$WORKSPACE"
SCRIPTS_FOLDER = "$WORKSPACE/retorchfiles/scripts"
}// EndEnvironment
options {
disableConcurrentBuilds()
}//EndPipOptions
disableConcurrentBuilds()
}// EndPipOptions
stages{
stage('Clean Workspace') {
steps{
cleanWs()
}// EndStepsCleanWS
}// EndStageCleanWS
stage('Clone Project') {
steps{
checkout scm
}// EndStepsCloneProject
}// EndStageCloneProject
stage('SETUP-Infrastructure') {
steps{
//Change the permisions to the scripts folder the
sh 'chmod +x -R ./retorchfiles/scripts'
sh './retorchfiles/scripts/coilifecycles/coi-setup.sh'
sh 'chmod +x -R $SCRIPTS_FOLDER'
sh '$SCRIPTS_FOLDER/coilifecycles/coi-setup.sh'
}// EndStepsSETUPINF
}//EndStageSETUPInf
}// EndStageSETUPInf
stage('Stage 0'){
failFast false
parallel{
stage('TJobC IdResource: Attenders LoginService OpenViduMock ') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobc 0'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobc 0 "FullTeachingEndToEndRESTTests#attendersRestOperations"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobc 0'
}//EndExecutionStageErrorTJobC
}//EndStepsTJobC
}//EndStageTJobC
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobc 0'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobc 0 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#attendersRestOperations"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobd 0'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobd 0 "FullTeachingEndToEndRESTTests#courseRestOperations,CourseTeacherTest#teacherEditCourseValues"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobd 0'
}//EndExecutionStageErrorTJobD
}//EndStepsTJobD
}//EndStageTJobD
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"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobe 0'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobe 0 "FullTeachingEndToEndEChatTests#oneToOneChatInSessionChrome"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobe 0'
}//EndExecutionStageErrorTJobE
}//EndStepsTJobE
}//EndStageTJobE
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobe 0'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobe 0 https://full-teaching- 5000 "FullTeachingEndToEndEChatTests#oneToOneChatInSessionChrome"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobf 0'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobf 0 "LoggedLinksTests#spiderLoggedTest,UnLoggedLinksTests#spiderUnloggedTest,CourseTeacherTest#teacherDeleteCourseTest"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobf 0'
}//EndExecutionStageErrorTJobF
}//EndStepsTJobF
}//EndStageTJobF
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"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobg 0'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobg 0 "CourseStudentTest#studentCourseMainTest,CourseTeacherTest#teacherCourseMainTest,CourseTeacherTest#teacherCreateAndDeleteCourseTest"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobg 0'
}//EndExecutionStageErrorTJobG
}//EndStepsTJobG
}//EndStageTJobG
}//End Parallel
}//End Stage
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"'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobg 0'
}// EndExecutionStageErrorTJobG
}// EndStepsTJobG
}// EndStageTJobG
}// End Parallel
}// End Stage
stage('Stage 1'){
failFast false
parallel{
stage('TJobH IdResource: Information LoginService OpenViduMock ') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobh 1'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobh 1 "FullTeachingEndToEndRESTTests#courseInfoRestOperations"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobh 1'
}//EndExecutionStageErrorTJobH
}//EndStepsTJobH
}//EndStageTJobH
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobh 1'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobh 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#courseInfoRestOperations"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobi 1'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobi 1 "FullTeachingEndToEndRESTTests#filesRestOperations"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobi 1'
}//EndExecutionStageErrorTJobI
}//EndStepsTJobI
}//EndStageTJobI
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobi 1'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobi 1 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#filesRestOperations"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobj 1'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobj 1 "LoggedForumTest#forumLoadEntriesTest"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobj 1'
}//EndExecutionStageErrorTJobJ
}//EndStepsTJobJ
}//EndStageTJobJ
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobj 1'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobj 1 https://full-teaching- 5000 "LoggedForumTest#forumLoadEntriesTest"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobk 1'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobk 1 "LoggedForumTest#forumNewCommentTest,LoggedForumTest#forumNewEntryTest,LoggedForumTest#forumNewReply2CommentTest,FullTeachingEndToEndRESTTests#forumRestOperations"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobk 1'
}//EndExecutionStageErrorTJobK
}//EndStepsTJobK
}//EndStageTJobK
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"'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobk 1'
}// EndExecutionStageErrorTJobK
}// EndStepsTJobK
}// EndStageTJobK
stage('TJobL IdResource: LoginService OpenViduMock ') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobl 1'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobl 1 "UserTest#loginTest"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobl 1'
}//EndExecutionStageErrorTJobL
}//EndStepsTJobL
}//EndStageTJobL
}//End Parallel
}//End Stage
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobl 1'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobl 1 https://full-teaching- 5000 "UserTest#loginTest"'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobl 1'
}// EndExecutionStageErrorTJobL
}// EndStepsTJobL
}// EndStageTJobL
}// End Parallel
}// End Stage
stage('Stage 2'){
failFast false
parallel{
stage('TJobM IdResource: Session LoginService OpenVidu ') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobm 2'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobm 2 "FullTeachingTestEndToEndVideoSessionTests#oneToOneVideoAudioSessionChrome,FullTeachingLoggedVideoSessionTests#sessionTest"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobm 2'
}//EndExecutionStageErrorTJobM
}//EndStepsTJobM
}//EndStageTJobM
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"'
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 'retorchfiles/scripts/tjoblifecycles/tjob-setup.sh tjobn 2'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-testexecution.sh tjobn 2 "FullTeachingEndToEndRESTTests#sessionRestOperations"'
sh 'retorchfiles/scripts/tjoblifecycles/tjob-teardown.sh tjobn 2'
}//EndExecutionStageErrorTJobN
}//EndStepsTJobN
}//EndStageTJobN
}//End Parallel
}//End Stage
stage('TEARDOWN-Infrastructure'){
stages{
stage('PublishReports'){
steps{
sh 'retorchfiles/scripts/coilifecycles/coi-teardown.sh'
sh 'retorchfiles/scripts/saveTJobLifecycledata.sh'
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'target/site/',
reportFiles: 'surefire-report.html',
reportName: 'Test Execution Report'])

}//EndStepsPublishReports
}//EndStagePublishReports
}//EndStagesINFTearDown

}//EndStageTearDown
}//EndStagesPipeline
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-setup.sh tjobn 2'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-testexecution.sh tjobn 2 https://full-teaching- 5000 "FullTeachingEndToEndRESTTests#sessionRestOperations"'
sh '$SCRIPTS_FOLDER/tjoblifecycles/tjob-teardown.sh tjobn 2'
}// EndExecutionStageErrorTJobN
}// EndStepsTJobN
}// EndStageTJobN
}// End Parallel
}// End Stage
stage('TEARDOWN-Infrastructure') {
steps {
sh '$SCRIPTS_FOLDER/coilifecycles/coi-teardown.sh'
}// EndStepsTearDownInf
}// EndStageTearDown
}// EndStagesPipeline
post {
always {
archiveArtifacts artifacts: 'artifacts/*.csv', onlyIfSuccessful: true }//EndAlways
cleanup {
cleanWs()
sh """(eval \$CURRENT_DATE ; echo "Cleaning Environment ") | cat |tr '\n' ' ' """
echo 'Switch off all containers...'
sh """docker stop \$(docker ps | grep tjob | awk '{print \$1}') || echo 'All the containers are stopped!'"""
sh """docker rm --volumes \$(docker ps -a | grep tjob | awk '{print \$1}') || echo 'All the containers are removed!'"""
}//EndCleanUp
archiveArtifacts artifacts: 'artifacts/*.csv', onlyIfSuccessful: true
//archiveArtifacts artifacts: 'target/testlogs/**/*.*', onlyIfSuccessful: false //COMMENTED UNTIL LOGS IMPROVED
archiveArtifacts artifacts: 'target/containerlogs/**/*.*', onlyIfSuccessful: false
}//EndAlways
}//EndPostActions
}//EndPipeline
}// EndPipeline
10 changes: 10 additions & 0 deletions retorchfiles/configurations/retorch-ciinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"agentCIName": "xretorch-agent",
"sut-wait-html": "<title>FullTeaching</title>",
"sut-location": "$WORKSPACE",
"docker-frontend-name": "https://full-teaching-",
"docker-frontend-port": "5000",
"external-binded-port": "",
"external-frontend-url": ""

}
28 changes: 28 additions & 0 deletions retorchfiles/configurations/retorch-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"OpenViduMock": {
"dockerImageResource": [
{
"placeHolderId": "OpenViduImage",
"imageName": "eexit/mirror-http-server"
},
{
"placeHolderId": "mysqlImage",
"imageName": "mysql:5.7.21"
}
],
"testsBasePath": "./"
},
"generic": {
"dockerImageResource": [
{
"placeHolderId": "OpenViduImage",
"imageName": "openvidu/openvidu-server-kms:1.7.0"
},
{
"placeHolderId": "mysqlImage",
"imageName": "mysql:5.7.21"
}
],
"testsBasePath": "./"
}
}
17 changes: 17 additions & 0 deletions retorchfiles/envfiles/tjobc.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
testsBasePath=./
tjobname=tjobc
frontend_port=5000
retorchportj=5009
retorchportk=5010
retorchporth=5007
mysqlImage=mysql:5.7.21
retorchporti=5008
retorchportf=5005
retorchportg=5006
retorchportd=5003
retorchporte=5004
retorchportb=5001
retorchportc=5002
retorchporta=5000
OpenViduImage=eexit/mirror-http-server

17 changes: 17 additions & 0 deletions retorchfiles/envfiles/tjobd.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
testsBasePath=./
tjobname=tjobd
frontend_port=5000
retorchportj=5020
retorchportk=5021
retorchporth=5018
mysqlImage=mysql:5.7.21
retorchporti=5019
retorchportf=5016
retorchportg=5017
retorchportd=5014
retorchporte=5015
retorchportb=5012
retorchportc=5013
retorchporta=5011
OpenViduImage=eexit/mirror-http-server

17 changes: 17 additions & 0 deletions retorchfiles/envfiles/tjobe.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
testsBasePath=./
tjobname=tjobe
frontend_port=5000
retorchportj=5031
retorchportk=5032
retorchporth=5029
mysqlImage=mysql:5.7.21
retorchporti=5030
retorchportf=5027
retorchportg=5028
retorchportd=5025
retorchporte=5026
retorchportb=5023
retorchportc=5024
retorchporta=5022
OpenViduImage=openvidu/openvidu-server-kms:1.7.0

17 changes: 17 additions & 0 deletions retorchfiles/envfiles/tjobf.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
testsBasePath=./
tjobname=tjobf
frontend_port=5000
retorchportj=5042
retorchportk=5043
retorchporth=5040
mysqlImage=mysql:5.7.21
retorchporti=5041
retorchportf=5038
retorchportg=5039
retorchportd=5036
retorchporte=5037
retorchportb=5034
retorchportc=5035
retorchporta=5033
OpenViduImage=eexit/mirror-http-server

Loading

0 comments on commit 7b2f364

Please sign in to comment.