From 322a452d01ce79772c9f5c7f0b7823427e110dd9 Mon Sep 17 00:00:00 2001 From: valentinab25 <30239069+valentinab25@users.noreply.github.com> Date: Tue, 15 Jun 2021 17:24:39 +0300 Subject: [PATCH] add integration tests --- Jenkinsfile | 55 +++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88bd772a..a620bc77 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,36 @@ pipeline { } stages { + + stage('Integration tests') { + steps { + node(label: 'docker') { + script { + try { + sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg''' + sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/volto-project-ci cypress''' + } finally { + try { + sh '''rm -rf cypress-reports cypress-results''' + sh '''mkdir -p cypress-reports cypress-results''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/videos cypress-reports/''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/reports cypress-results/''' + archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true + } + finally { + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true + } + sh script: "docker stop $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true + } + } + } + } + } + } + stage('Build & Push') { steps{ node(label: 'docker-host') { @@ -49,31 +79,6 @@ pipeline { } } - // stage('Integration tests') { - // steps { - // parallel( - - // "Cypress": { - // node(label: 'docker') { - // script { - // try { - // sh '''docker pull eeacms/plonesaas; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg''' - // sh '''docker pull eeacms/eprtr-frontend; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e TIMEOUT=600000 -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/eprtr-frontend cypress''' - // } finally { - // sh '''mkdir -p cypress-reports''' - // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/cypress/videos cypress-reports/''' - // stash name: "cypress-reports", includes: "cypress-reports/**/*" - // archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true - // sh '''echo "$(docker stop $BUILD_TAG-plone; docker rm -v $BUILD_TAG-plone; docker rm -v $BUILD_TAG-cypress)" ''' - // } - // } - // } - // } - - // ) - // } - // } - stage('Upgrade demo') { when { buildingTag()