| |
@@ -10,99 +10,103 @@
|
| |
* GNU General Public License for more details.
|
| |
*/
|
| |
|
| |
+ try { // massive try{} catch{} around the entire build for failure notifications
|
| |
+
|
| |
node('fedora') {
|
| |
- try {
|
| |
- checkout scm
|
| |
- sh 'sudo dnf -y builddep waiverdb.spec'
|
| |
- sh 'sudo dnf -y install python2-flake8 pylint python2-sphinx python-sphinxcontrib-httpdomain'
|
| |
- stage('Invoke Flake8') {
|
| |
- sh 'flake8'
|
| |
- }
|
| |
- stage('Invoke Pylint') {
|
| |
- sh 'pylint --reports=n waiverdb'
|
| |
- }
|
| |
- stage('Build Docs') {
|
| |
- sh 'make -C docs html'
|
| |
- archiveArtifacts artifacts: 'docs/_build/html/**'
|
| |
- }
|
| |
- stage('Build SRPM') {
|
| |
- sh './rpmbuild.sh -bs'
|
| |
- archiveArtifacts artifacts: 'rpmbuild-output/**'
|
| |
- }
|
| |
- /* We take a flock on the mock configs, to avoid multiple unrelated jobs on
|
| |
- * the same Jenkins slave trying to use the same mock root at the same
|
| |
- * time, which will error out. */
|
| |
- stage('Build RPM') {
|
| |
- parallel (
|
| |
- 'EPEL7': {
|
| |
- sh """
|
| |
- mkdir -p mock-result/el7
|
| |
- flock /etc/mock/epel-7-x86_64.cfg \
|
| |
- /usr/bin/mock --resultdir=mock-result/el7 -r epel-7-x86_64 --clean --rebuild rpmbuild-output/*.src.rpm
|
| |
- """
|
| |
- archiveArtifacts artifacts: 'mock-result/el7/**'
|
| |
- },
|
| |
- 'F25': {
|
| |
- sh """
|
| |
- mkdir -p mock-result/f25
|
| |
- flock /etc/mock/fedora-25-x86_64.cfg \
|
| |
- /usr/bin/mock --resultdir=mock-result/f25 -r fedora-25-x86_64 --clean --rebuild rpmbuild-output/*.src.rpm
|
| |
- """
|
| |
- archiveArtifacts artifacts: 'mock-result/f25/**'
|
| |
- },
|
| |
- )
|
| |
- }
|
| |
- stage('Invoke Rpmlint') {
|
| |
- parallel (
|
| |
- 'EPEL7': {
|
| |
- sh 'rpmlint -f rpmlint-config.py mock-result/el7/*.rpm'
|
| |
- },
|
| |
- 'F25': {
|
| |
- sh 'rpmlint -f rpmlint-config.py mock-result/f25/*.rpm'
|
| |
- },
|
| |
- )
|
| |
- }
|
| |
- } catch (e) {
|
| |
- currentBuild.result = "FAILED"
|
| |
- /* Can't use GIT_BRANCH because of this issue https://issues.jenkins-ci.org/browse/JENKINS-35230 */
|
| |
- def git_branch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
|
| |
- if (git_branch == 'master') {
|
| |
- step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'pnt-factory2-devel@redhat.com'])
|
| |
+ checkout scm
|
| |
+ sh 'sudo dnf -y builddep waiverdb.spec'
|
| |
+ sh 'sudo dnf -y install python2-flake8 pylint python2-sphinx python-sphinxcontrib-httpdomain'
|
| |
+ stage('Invoke Flake8') {
|
| |
+ sh 'flake8'
|
| |
+ }
|
| |
+ stage('Invoke Pylint') {
|
| |
+ sh 'pylint --reports=n waiverdb'
|
| |
+ }
|
| |
+ stage('Build Docs') {
|
| |
+ sh 'make -C docs html'
|
| |
+ archiveArtifacts artifacts: 'docs/_build/html/**'
|
| |
+ }
|
| |
+ /* Can't use GIT_BRANCH because of this issue https://issues.jenkins-ci.org/browse/JENKINS-35230 */
|
| |
+ def git_branch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
|
| |
+ if (git_branch == 'master') {
|
| |
+ stage('Publish Docs') {
|
| |
+ sshagent (credentials: ['pagure-waiverdb-deploy-key']) {
|
| |
+ sh """
|
| |
+ mkdir -p ~/.ssh/
|
| |
+ touch ~/.ssh/known_hosts
|
| |
+ ssh-keygen -R pagure.io
|
| |
+ echo 'pagure.io,140.211.169.204 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC198DWs0SQ3DX0ptu+8Wq6wnZMrXUCufN+wdSCtlyhHUeQ3q5B4Hgto1n2FMj752vToCfNTn9mWO7l2rNTrKeBsELpubl2jECHu4LqxkRVihu5UEzejfjiWNDN2jdXbYFY27GW9zymD7Gq3u+T/Mkp4lIcQKRoJaLobBmcVxrLPEEJMKI4AJY31jgxMTnxi7KcR+U5udQrZ3dzCn2BqUdiN5dMgckr4yNPjhl3emJeVJ/uhAJrEsgjzqxAb60smMO5/1By+yF85Wih4TnFtF4LwYYuxgqiNv72Xy4D/MGxCqkO/nH5eRNfcJ+AJFE7727F7Tnbo4xmAjilvRria/+l' >>~/.ssh/known_hosts
|
| |
+ git clone ssh://git@pagure.io/docs/waiverdb.git docs-on-pagure
|
| |
+ rm -r docs-on-pagure/*
|
| |
+ cp -r docs/_build/html/* docs-on-pagure/
|
| |
+ cd docs-on-pagure
|
| |
+ git add -A .
|
| |
+ git commit -m 'Automatic commit of docs built by Jenkins job ${env.JOB_NAME} #${env.BUILD_NUMBER}'
|
| |
+ git push origin master
|
| |
+ """
|
| |
+ }
|
| |
}
|
| |
- throw e
|
| |
+ }
|
| |
+ stage('Build SRPM') {
|
| |
+ sh './rpmbuild.sh -bs'
|
| |
+ archiveArtifacts artifacts: 'rpmbuild-output/**'
|
| |
+ }
|
| |
+ /* We take a flock on the mock configs, to avoid multiple unrelated jobs on
|
| |
+ * the same Jenkins slave trying to use the same mock root at the same
|
| |
+ * time, which will error out. */
|
| |
+ stage('Build RPM') {
|
| |
+ parallel (
|
| |
+ 'EPEL7': {
|
| |
+ sh """
|
| |
+ mkdir -p mock-result/el7
|
| |
+ flock /etc/mock/epel-7-x86_64.cfg \
|
| |
+ /usr/bin/mock --resultdir=mock-result/el7 -r epel-7-x86_64 --clean --rebuild rpmbuild-output/*.src.rpm
|
| |
+ """
|
| |
+ archiveArtifacts artifacts: 'mock-result/el7/**'
|
| |
+ },
|
| |
+ 'F25': {
|
| |
+ sh """
|
| |
+ mkdir -p mock-result/f25
|
| |
+ flock /etc/mock/fedora-25-x86_64.cfg \
|
| |
+ /usr/bin/mock --resultdir=mock-result/f25 -r fedora-25-x86_64 --clean --rebuild rpmbuild-output/*.src.rpm
|
| |
+ """
|
| |
+ archiveArtifacts artifacts: 'mock-result/f25/**'
|
| |
+ },
|
| |
+ )
|
| |
+ }
|
| |
+ stage('Invoke Rpmlint') {
|
| |
+ parallel (
|
| |
+ 'EPEL7': {
|
| |
+ sh 'rpmlint -f rpmlint-config.py mock-result/el7/*.rpm'
|
| |
+ },
|
| |
+ 'F25': {
|
| |
+ sh 'rpmlint -f rpmlint-config.py mock-result/f25/*.rpm'
|
| |
+ },
|
| |
+ )
|
| |
}
|
| |
}
|
| |
node('docker') {
|
| |
- try {
|
| |
- checkout scm
|
| |
- stage('Build Docker container') {
|
| |
- unarchive mapping: ['mock-result/el7/': '.']
|
| |
- def el7_rpm = findFiles(glob: 'mock-result/el7/**/*.noarch.rpm')[0]
|
| |
- def appversion = sh(returnStdout: true, script: """
|
| |
- rpm2cpio ${el7_rpm} | \
|
| |
- cpio --quiet --extract --to-stdout ./usr/lib/python2.7/site-packages/waiverdb\\*.egg-info/PKG-INFO | \
|
| |
- awk '/^Version: / {print \$2}'
|
| |
- """).trim()
|
| |
- docker.withRegistry(
|
| |
- 'https://docker-registry.engineering.redhat.com/',
|
| |
- 'docker-registry-factory2-builder-sa-credentials') {
|
| |
- /* Note that the docker.build step has some magic to guess the
|
| |
- * Dockerfile used, which will break if the build directory (here ".")
|
| |
- * is not the final argument in the string. */
|
| |
- def image = docker.build "factory2/waiverdb:${appversion}", "--build-arg waiverdb_rpm=$el7_rpm ."
|
| |
- image.push()
|
| |
- }
|
| |
- /* Save container version for later steps (this is ugly but I can't find anything better...) */
|
| |
- writeFile file: 'appversion', text: appversion
|
| |
- archiveArtifacts artifacts: 'appversion'
|
| |
- }
|
| |
- } catch (e) {
|
| |
- currentBuild.result = "FAILED"
|
| |
- def git_branch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
|
| |
- if (git_branch == 'master') {
|
| |
- step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'pnt-factory2-devel@redhat.com'])
|
| |
+ checkout scm
|
| |
+ stage('Build Docker container') {
|
| |
+ unarchive mapping: ['mock-result/el7/': '.']
|
| |
+ def el7_rpm = findFiles(glob: 'mock-result/el7/**/*.noarch.rpm')[0]
|
| |
+ def appversion = sh(returnStdout: true, script: """
|
| |
+ rpm2cpio ${el7_rpm} | \
|
| |
+ cpio --quiet --extract --to-stdout ./usr/lib/python2.7/site-packages/waiverdb\\*.egg-info/PKG-INFO | \
|
| |
+ awk '/^Version: / {print \$2}'
|
| |
+ """).trim()
|
| |
+ docker.withRegistry(
|
| |
+ 'https://docker-registry.engineering.redhat.com/',
|
| |
+ 'docker-registry-factory2-builder-sa-credentials') {
|
| |
+ /* Note that the docker.build step has some magic to guess the
|
| |
+ * Dockerfile used, which will break if the build directory (here ".")
|
| |
+ * is not the final argument in the string. */
|
| |
+ def image = docker.build "factory2/waiverdb:${appversion}", "--build-arg waiverdb_rpm=$el7_rpm ."
|
| |
+ image.push()
|
| |
}
|
| |
- throw e
|
| |
+ /* Save container version for later steps (this is ugly but I can't find anything better...) */
|
| |
+ writeFile file: 'appversion', text: appversion
|
| |
+ archiveArtifacts artifacts: 'appversion'
|
| |
}
|
| |
}
|
| |
node('fedora') {
|
| |
@@ -149,3 +153,13 @@
|
| |
}
|
| |
}
|
| |
}
|
| |
+
|
| |
+ } catch (e) {
|
| |
+ if (ownership.job.ownershipEnabled) {
|
| |
+ mail to: ownership.job.primaryOwnerEmail,
|
| |
+ cc: ownership.job.secondaryOwnerEmails.join(';'),
|
| |
+ subject: "Jenkins job ${env.JOB_NAME} #${env.BUILD_NUMBER} failed",
|
| |
+ body: "${env.BUILD_URL}\n\n${e}"
|
| |
+ }
|
| |
+ throw e
|
| |
+ }
|
| |