Skip to content

Commit 31893fc

Browse files
committed
comment cypress
1 parent c2664bf commit 31893fc

File tree

1 file changed

+87
-87
lines changed

1 file changed

+87
-87
lines changed

Jenkinsfile

+87-87
Original file line numberDiff line numberDiff line change
@@ -111,93 +111,93 @@ pipeline {
111111
}
112112
}
113113

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-
171-
stage('Report to SonarQube') {
172-
when {
173-
allOf {
174-
environment name: 'CHANGE_ID', value: ''
175-
anyOf {
176-
branch 'master'
177-
allOf {
178-
branch 'develop'
179-
not { changelog '.*^Automated release [0-9\\.]+$' }
180-
}
181-
}
182-
}
183-
}
184-
steps {
185-
node(label: 'swarm') {
186-
script{
187-
checkout scm
188-
unstash "xunit-reports"
189-
unstash "cypress-coverage"
190-
def scannerHome = tool 'SonarQubeScanner';
191-
def nodeJS = tool 'NodeJS';
192-
withSonarQubeEnv('Sonarqube') {
193-
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
194-
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
195-
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
196-
}
197-
}
198-
}
199-
}
200-
}
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+
171+
// stage('Report to SonarQube') {
172+
// when {
173+
// allOf {
174+
// environment name: 'CHANGE_ID', value: ''
175+
// anyOf {
176+
// branch 'master'
177+
// allOf {
178+
// branch 'develop'
179+
// not { changelog '.*^Automated release [0-9\\.]+$' }
180+
// }
181+
// }
182+
// }
183+
// }
184+
// steps {
185+
// node(label: 'swarm') {
186+
// script{
187+
// checkout scm
188+
// unstash "xunit-reports"
189+
// unstash "cypress-coverage"
190+
// def scannerHome = tool 'SonarQubeScanner';
191+
// def nodeJS = tool 'NodeJS';
192+
// withSonarQubeEnv('Sonarqube') {
193+
// sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
194+
// sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
195+
// sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
196+
// }
197+
// }
198+
// }
199+
// }
200+
// }
201201

202202
stage('Pull Request') {
203203
when {

0 commit comments

Comments
 (0)