diff --git a/Jenkinsfile b/Jenkinsfile index 02bdc9fb..579198db 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,34 +1,45 @@ -node ('xretorch-agent') { - stage ('Clone eShopContainers Project') { +pipeline { + agent { + label 'xretorch-agent' + } + environment { + ET_EUS_API = "http://selenoid:4444/wd/hub" - checkout([$class: 'GitSCM', branches: [[name: '*/retorch']], - userRemoteConfigs: [[url: 'https://github.com/augustocristian/retorch-st-eShopOnContainers.git']]]) - checkout scm - }//End git stage + } + options { + disableConcurrentBuilds() + } + stages { + stage('Clone eShopContainers Project') { + steps { + checkout scm} + } - stage('SETUP-Infrastructure') { - sh 'ls -a .' - sh 'cd ./eshopcontainers-e2etestsuite' - sh 'ls -a .' - //Change the permisions to the scripts folder the - sh 'chmod +x -R ./retorchfiles/scripts' - sh './retorchfiles/scripts/coilifecycles/coi-setup.sh' - }//EndStageSETUPInf + stage('SETUP-Infrastructure') { + steps { + sh 'ls -a $WORKSPACE' + sh 'chmod +x -R ./eshopcontainers-e2etestsuite/retorchfiles/scripts' + sh './eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-setup.sh' + } + } + stage('test') { + steps { + sh "sleep 10" + sh "mvn test" + } + } + } - stage('test') { - - sh "sleep 10" - sh "mvn test" - }// End test stage - post { - always { - archiveArtifacts artifacts: 'artifacts/*.csv', onlyIfSuccessful: true }//EndAlways - cleanup { - cleanWs() - sh """(eval \$CURRENT_DATE ; echo "Cleaning Environment ") | cat |tr '\n' ' ' """ - sh './retorchfiles/scripts/coilifecycles/coi-teardown.sh' }//EndCleanUp - }//EndPostActions -} \ No newline at end of file + post { + //always { + // archiveArtifacts artifacts: 'eshopcontainers-e2etestsuite/artifacts/*.csv', onlyIfSuccessful: true + //} + cleanup { + sh """(eval \$CURRENT_DATE ; echo "Cleaning Environment ") | cat | tr '\n' ' ' """ + sh './eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-teardown.sh' + } + } +} diff --git a/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-setup.sh b/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-setup.sh index 34aa21fe..369e1b21 100644 --- a/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-setup.sh +++ b/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-setup.sh @@ -1,12 +1,24 @@ #!/bin/bash -OUTPUTDIRCOI="./src/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" +OUTPUTDIRCOI="./eshopcontainers-e2etestsuite/src/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" COISETUPSTART=$(date +%s%3N) - +ls -la .. #Directories to store the data -mkdir -p "./src/retorchcostestimationdata/exec$BUILD_NUMBER" -mkdir -p "./artifacts" +mkdir -p "$WORKSPACE/retorchcostestimationdata/exec$BUILD_NUMBER" +mkdir -p "$WORKSPACE/artifacts" #Here goes the COI set-up +git clone "https://github.com/augustocristian/retorch-st-eShopOnContainers.git" sut +cd ./sut/src +git checkout retorch + +docker compose --env-file .env build +docker compose --env-file .env up -d + +ls . + + +cd $WORKSPACE +ls . #Here ends the COI set-up diff --git a/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-teardown.sh b/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-teardown.sh index ccbe582b..e11bc36c 100644 --- a/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-teardown.sh +++ b/eshopcontainers-e2etestsuite/retorchfiles/scripts/coilifecycles/coi-teardown.sh @@ -5,9 +5,13 @@ COITEARDOWNSTART="$(date +%s%3N)" echo 'Switch off all containers...' docker stop "$(docker ps | grep eShopContainers | awk '{print \$1}')" || echo 'All the containers are stopped!' docker rm --volumes "$(docker ps -a | grep eShopContainers | awk '{print \$1}')" || echo 'All the containers are removed!' -sh 'retorchfiles/scripts/saveTJobLifecycledata.sh' +cd "$WORKSPACE/retorch-st-eShopOnContainers/src" +docker compose --env-file .env down +cd $WORKSPACE + +sh '$WORKSPACE/eshopcontainers-e2etestsuite/retorchfiles/scripts/saveTJobLifecycledata.sh' COITEARDOWNEND="$(date +%s%3N)" -OUTPUTDIRCOI="./src/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" +OUTPUTDIRCOI="$WORKSPACE/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" echo -n ";$COITEARDOWNSTART;$COITEARDOWNEND" >>"$OUTPUTDIRCOI" diff --git a/eshopcontainers-e2etestsuite/retorchfiles/scripts/saveTJobLifecycledata.sh b/eshopcontainers-e2etestsuite/retorchfiles/scripts/saveTJobLifecycledata.sh index 5fd3a30c..a3763238 100644 --- a/eshopcontainers-e2etestsuite/retorchfiles/scripts/saveTJobLifecycledata.sh +++ b/eshopcontainers-e2etestsuite/retorchfiles/scripts/saveTJobLifecycledata.sh @@ -1,7 +1,7 @@ #!/bin/bash -PATH_FILES="./src/retorchcostestimationdata/exec${BUILD_NUMBER}/tjob*" -OUTPUT_FILE="./artifacts/lifecycletimmingsexec${BRANCH_NAME///}-${BUILD_NUMBER}.csv" -OUTPUTDIRCOI="./src/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" +PATH_FILES="$WORKSPACE/retorchcostestimationdata/exec${BUILD_NUMBER}/tjob*" +OUTPUT_FILE="$WORKSPACE/artifacts/lifecycletimmingsexec${BRANCH_NAME///}-${BUILD_NUMBER}.csv" +OUTPUTDIRCOI="$WORKSPACE/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" echo "tjobname;stage;COI-setup-start;COI-setup-end;tjob-setup-start;tjob-setup-end;tjob-testexec-start;tjob-testexec-end;tjob-teardown-start;tjob-teardown-end;coi-teardown-start;coi-teardown-end" >"$OUTPUT_FILE" for csvfile in $PATH_FILES; do { diff --git a/eshopcontainers-e2etestsuite/retorchfiles/scripts/writetime.sh b/eshopcontainers-e2etestsuite/retorchfiles/scripts/writetime.sh index 980d4b61..9a37d475 100644 --- a/eshopcontainers-e2etestsuite/retorchfiles/scripts/writetime.sh +++ b/eshopcontainers-e2etestsuite/retorchfiles/scripts/writetime.sh @@ -1,6 +1,6 @@ #!/bin/bash -OUTPUTDIR="./src/retorchcostestimationdata/exec$BUILD_NUMBER/$2.data" -OUTPUTDIRCOI="./src/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" +OUTPUTDIR="$WORKSPACE/retorchcostestimationdata/exec$BUILD_NUMBER/$2.data" +OUTPUTDIRCOI="$WORKSPACE/retorchcostestimationdata/exec$BUILD_NUMBER/COI.data" if [ -f "$OUTPUTDIR" ]; then echo -n ";$(date +%s%3N)" >>"$OUTPUTDIR"