#40 fix the flake8 error in wsgi.py
Merged 6 years ago by mjia. Opened 6 years ago by mjia.
mjia/waiverdb upstream  into  master

file modified
+59 -40
@@ -11,48 +11,67 @@ 

   */

  

  node('rcm-tools-jslave-rhel-7') {

-     checkout scm

-     stage('Invoke Flake8') {

-         sh 'flake8'

-     }

-     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

-                 rpmlint -f rpmlint-config.py mock-result/el7/*.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

-                 rpmlint -f rpmlint-config.py mock-result/f25/*.rpm

-                 """

-                 archiveArtifacts artifacts: 'mock-result/f25/**'

-             },

-         )

+     try {

+         checkout scm

+         stage('Invoke Flake8') {

+             sh 'flake8'

+         }

+         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

+                     rpmlint -f rpmlint-config.py mock-result/el7/*.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

+                     rpmlint -f rpmlint-config.py mock-result/f25/*.rpm

+                     """

+                     archiveArtifacts artifacts: 'mock-result/f25/**'

+                 },

+             )

+         }

+     } 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'])

+         }

+         throw e

      }

  }

  node('rcm-tools-jslave-rhel-7-docker') {

-     checkout scm

-     stage('Build Docker container') {

-         unarchive mapping: ['mock-result/el7/': '.']

-         def el7_rpm = findFiles(glob: 'mock-result/el7/**/*.noarch.rpm')[0]

-         /* 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 'waiverdb', "--build-arg waiverdb_rpm=$el7_rpm ."

+     try {

+         checkout scm

+         stage('Build Docker container') {

+             unarchive mapping: ['mock-result/el7/': '.']

+             def el7_rpm = findFiles(glob: 'mock-result/el7/**/*.noarch.rpm')[0]

+             /* 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 'waiverdb', "--build-arg waiverdb_rpm=$el7_rpm ."

+         }

+     } 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'])

+         }

+         throw e

      }

  }

file modified
-1
@@ -13,4 +13,3 @@ 

  from waiverdb.app import create_app, init_db

  app = create_app()

  init_db(app)

- 

This PR fixes an error in wsgi.py reported by flake8. It also turns on the email notifications in Jenkins for that.

1 new commit added

  • Jenkinsfile: send email notifications
6 years ago

2 new commits added

  • Jenkinsfile: send email notifications
  • fix the flake8 error in wsgi.py
6 years ago

I think it kinda sucks how the mail notification makes a mess of the Jenkinsfile, with the huge big try { } catch() { } wrapper... but oh well. Seems like that's just how it's done in Pipeline.

:+1:

Pull-Request has been merged by mjia

6 years ago
Metadata