@@ -111,62 +111,62 @@ pipeline {
111
111
}
112
112
}
113
113
114
- // stage('Integration tests') {
115
- // when {
116
- // allOf {
117
- // environment name: 'CHANGE_ID', value: ''
118
- // anyOf {
119
- // not { changelog '.*^Automated release [0-9\\.]+$' }
120
- // branch 'master'
121
- // }
122
- // }
123
- // }
124
- // steps {
125
- // parallel(
126
-
127
- // "Cypress": {
128
- // node(label: 'docker') {
129
- // script {
130
- // try {
131
- // sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
132
- // sh '''docker pull plone/volto-addon-ci:15.x; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e VOLTO=$VOLTO -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci:15.x cypress'''
133
- // } finally {
134
- // try {
135
- // sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
136
- // sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
137
- // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
138
- // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
139
- // coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
140
- // if ( coverage == 0 ) {
141
- // publishHTML (target : [allowMissing: false,
142
- // alwaysLinkToLastBuild: true,
143
- // keepAll: true,
144
- // reportDir: 'cypress-coverage/coverage/lcov-report',
145
- // reportFiles: 'index.html',
146
- // reportName: 'CypressCoverage',
147
- // reportTitles: 'Integration Tests Code Coverage'])
148
- // }
149
- // sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
150
- // archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
151
- // stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
152
- // }
153
- // finally {
154
- // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
155
- // junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
156
- // }
157
- // sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
158
- // sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
159
- // sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
160
-
161
- // }
162
- // }
163
- // }
164
- // }
165
- // }
166
-
167
- // )
168
- // }
169
- // }
114
+ stage(' Integration tests' ) {
115
+ when {
116
+ allOf {
117
+ environment name : ' CHANGE_ID' , value : ' '
118
+ anyOf {
119
+ not { changelog ' .*^Automated release [0-9\\ .]+$' }
120
+ branch ' master'
121
+ }
122
+ }
123
+ }
124
+ steps {
125
+ parallel(
126
+
127
+ " Cypress" : {
128
+ node(label : ' docker' ) {
129
+ script {
130
+ try {
131
+ sh ''' docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
132
+ sh ''' docker pull plone/volto-addon-ci:15.x; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e VOLTO=$VOLTO -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci:15.x cypress'''
133
+ } finally {
134
+ try {
135
+ sh ''' rm -rf cypress-reports cypress-results cypress-coverage'''
136
+ sh ''' mkdir -p cypress-reports cypress-results cypress-coverage'''
137
+ sh ''' docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
138
+ sh ''' docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
139
+ coverage = sh script : ''' docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''' , returnStatus : true
140
+ if ( coverage == 0 ) {
141
+ publishHTML (target : [allowMissing : false ,
142
+ alwaysLinkToLastBuild : true ,
143
+ keepAll : true ,
144
+ reportDir : ' cypress-coverage/coverage/lcov-report' ,
145
+ reportFiles : ' index.html' ,
146
+ reportName : ' CypressCoverage' ,
147
+ reportTitles : ' Integration Tests Code Coverage' ])
148
+ }
149
+ sh ''' touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\ (.*\\ )" time.*/\\ 1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
150
+ archiveArtifacts artifacts : ' cypress-reports/**/*.mp4' , fingerprint : true , allowEmptyArchive : true
151
+ stash name : " cypress-coverage" , includes : " cypress-coverage/**" , allowEmpty : true
152
+ }
153
+ finally {
154
+ catchError(buildResult : ' SUCCESS' , stageResult : ' SUCCESS' ) {
155
+ junit testResults : ' cypress-results/**/*.xml' , allowEmptyResults : true
156
+ }
157
+ sh script : " docker stop $BUILD_TAG -plone" , returnStatus : true
158
+ sh script : " docker rm -v $BUILD_TAG -plone" , returnStatus : true
159
+ sh script : " docker rm -v $BUILD_TAG -cypress" , returnStatus : true
160
+
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ )
168
+ }
169
+ }
170
170
171
171
stage(' Report to SonarQube' ) {
172
172
when {
0 commit comments