Skip to content

Commit

Permalink
test: fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 authored Jun 25, 2024
1 parent fba488a commit c218528
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@ pipeline {
env.CI=false
env.FRONTEND_NAME = (env.GITHUB_COMMENT =~ /@eea-jenkins check bundle on (\S+).*$/)[ 0 ][ 1 ]
sh '''rm -rf ${FRONTEND_NAME}'''
sh '''git clone -b develop https://github.com/eea/${FRONTEND_NAME}.git'''
try {
sh '''git clone -b develop https://github.com/eea/${FRONTEND_NAME}.git'''
}
catch (Exception e) {
sh '''echo "Error cloning develop branch on https://github.com/eea/${FRONTEND_NAME}.git" > result.txt'''
exit 1
}
dir(env.FRONTEND_NAME) {
sh """cat mrs.developer.json | jq 'if ( has("'$GIT_NAME'") ) then .["'$GIT_NAME'"].branch = "'$CHANGE_BRANCH'" else . end' > temp"""
sh """mv temp mrs.developer.json"""
sh """cat mrs.developer.json | jq '.["'$GIT_NAME'"]' """
sh '''if [ $(grep "eea/"${GIT_NAME}".git" mrs.developer.json | wc -l) -eq 0 ]; then exit 1; fi'''
sh '''if [ $(grep "eea/"${GIT_NAME}".git" mrs.developer.json | wc -l) -eq 0 ]; then echo "Volto addon does not exist in mrs.developer.json on develop branch on https://github.com/eea/${FRONTEND_NAME}.git" > ../result.txt; exit 1; fi'''
sh """yarn"""
sh """make develop"""
sh """make install"""
Expand All @@ -63,9 +69,9 @@ pipeline {
post {
failure {
script {
sh """cat ${FRONTEND_NAME}/checkresult.txt | grep -v 'https://service.bundlewatch.io/results' > ${FRONTEND_NAME}/result.txt"""
sh """if [ -f ${FRONTEND_NAME}/checkresult.txt ] ; then cat ${FRONTEND_NAME}/checkresult.txt | grep -v 'https://service.bundlewatch.io/results' > result.txt; fi"""
publishChecks name: "Bundlewatch on ${env.FRONTEND_NAME}", title: "Bunde size check on ${env.FRONTEND_NAME}", summary: "Result of bundlewatch run on ${env.FRONTEND_NAME}",
text: readFile(file: "${env.FRONTEND_NAME}/result.txt"), conclusion: "${currentBuild.currentResult}",
text: readFile(file: "result.txt"), conclusion: "${currentBuild.currentResult}",
detailsURL: "${env.BUILD_URL}display/redirect"

pullRequest.comment("### :x: Bundlewatch check job on ${FRONTEND_NAME} FAILED\n\nCheck ${BUILD_URL} for details\n\n:fire: @${GITHUB_COMMENT_AUTHOR}")
Expand Down

0 comments on commit c218528

Please sign in to comment.