Skip to content

Commit

Permalink
[JENKINSFILE] Add failure comment, no jenkins fail
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 committed May 5, 2022
1 parent 63181be commit c325bf1
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,24 @@ pipeline {
sh '''sed -i "s#url:.*#url: 'https://ci.eionet.europa.eu/',#" website/docusaurus.config.js'''
sh '''BASEURL="$(echo $BUILD_URL | sed 's#https://ci.eionet.europa.eu##')${GIT_NAME}/"; sed -i "s#baseUrl:.*#baseUrl: '$BASEURL',#" website/docusaurus.config.js'''
sh '''cat website/docusaurus.config.js'''
sh '''cd website; yarn;yarn build;cd ..'''
publishHTML (target : [allowMissing: false,
def RETURN_STATUS = sh(script: '''cd website; yarn;yarn build;cd ..''', returnStatus: true)

if ( RETURN_STATUS == 0 ) {
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'docs',
reportFiles: 'docs/intro/index.html',
reportName: "${GIT_NAME}",
reportTitles: 'Docusaurus'])

pullRequest.comment("Docusaurus: ${BUILD_URL}${GIT_NAME}/")
pullRequest.comment("Docusaurus: ${BUILD_URL}${GIT_NAME}/")
}
else {
pullRequest.comment("Docusaurus build failed, check ${BUILD_URL} for details")

}

}
}
}
Expand All @@ -272,9 +280,15 @@ pipeline {
sh '''git clone --branch develop https://github.com/eea/volto-kitkat-frontend.git'''

withCredentials([string(credentialsId: 'volto-kitkat-frontend-chromatica', variable: 'CHROMATICA_TOKEN')]) {
sh '''cd volto-kitkat-frontend; npm install -g mrs-developer chromatic; yarn develop; cd src/addons/$GIT_NAME; git fetch origin pull/${CHANGE_ID}/head:PR-${CHANGE_ID}; git checkout PR-${CHANGE_ID}; cd ../../..; yarn install; yarn build-storybook; npx chromatic --no-interactive --force-rebuild --project-token=$CHROMATICA_TOKEN | tee chromatic.log; cd ..'''
def RETURN_STATUS = sh(script: '''cd volto-kitkat-frontend; npm install -g mrs-developer chromatic; yarn develop; cd src/addons/$GIT_NAME; git fetch origin pull/${CHANGE_ID}/head:PR-${CHANGE_ID}; git checkout PR-${CHANGE_ID}; cd ../../..; yarn install; yarn build-storybook; npx chromatic --no-interactive --force-rebuild --project-token=$CHROMATICA_TOKEN | tee chromatic.log; cd ..''', returnStatus: true)
if ( RETURN_STATUS == 0 ) {
def STORY_URL = sh(script: '''grep "View your Storybook" volto-kitkat-frontend/chromatic.log | sed "s/.*https/https/" ''', returnStdout: true).trim()
pullRequest.comment("StoryBook: ${STORY_URL}")
}
else {
pullRequest.comment("StoryBook build failed, check ${BUILD_URL} for details")

}
}
sh '''rm -rf volto-kitkat-frontend'''
}
Expand Down

0 comments on commit c325bf1

Please sign in to comment.