This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch test-build in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/test-build by this push: new 0ab15cd52 Uses pipeline to build staging version of the site 0ab15cd52 is described below commit 0ab15cd5293a36121e3222ee81a8a147affa40d0 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Thu Apr 7 07:27:31 2022 +0200 Uses pipeline to build staging version of the site --- Jenkinsfile | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..ed938cab0 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,104 @@ +#!groovy + +pipeline { + agent none + options { + buildDiscarder logRotator(numToKeepStr: '5') + timeout(40) + disableConcurrentBuilds() + skipStagesAfterUnstable() + } + stages { + stage('Build a staged websites') { + agent { + label 'git-websites' + } + steps { + sh """ + echo Generiting a new version of website + mkdir -p target/content + + export RUBY_PATH=${HOME}/.rvm + export GEM_HOME=${RUBY_PATH}/gems + + curl -sSL https://get.rvm.io | bash -s -- --path ${RUBY_PATH} + mkdir -p ${GEM_HOME}/gems + gem install --install-dir ${GEM_HOME} bundler -v '2.1.4' + + export PATH=${GEM_HOME}/bin:$PATH + bundle install --path ${GEM_HOME} + bundle + bundle exec jekyll build + """ + sh """ + echo "Pushing changes into stage site" + + if ! git config remote.asf.url > /dev/null; then + git remote add asf https://gitbox.apache.org/repos/asf/struts-site.git + fi + + git checkout asf-staging + git pull asf asf-staging + + cp -r _site/* content + cp -r _site/.htaccess content/.htaccess + + git add content/* + git add content/.htaccess + git status + + git commit -m "Updates stage by Jenkins" --allow-empty + git push asf asf-staging + git checkout master + """ + } + } + } + post { + // If this build failed, send an email to the list. + failure { + script { + emailext( + //to: "d...@struts.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']], + from: "Mr. Jenkins <jenk...@builds.apache.org>", + subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed", + body: """ +There is a build failure in ${env.JOB_NAME}. + +Build: ${env.BUILD_URL} +Logs: ${env.BUILD_URL}console +Changes: ${env.BUILD_URL}changes + +-- +Mr. Jenkins +Director of Continuous Integration +""" + ) + } + } + + // Send an email, if the last build was not successful and this one is. + fixed { + script { + emailext( + //to: "d...@struts.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']], + from: 'Mr. Jenkins <jenk...@builds.apache.org>', + subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal", + body: """ +The build for ${env.JOB_NAME} completed successfully and is back to normal. + +Build: ${env.BUILD_URL} +Logs: ${env.BUILD_URL}console +Changes: ${env.BUILD_URL}changes + +-- +Mr. Jenkins +Director of Continuous Integration +""" + ) + } + } + } +}