#44 Jenkins all the things!
Merged 6 years ago by dcallagh. Opened 6 years ago by dcallagh.
dcallagh/waiverdb jenkins  into  master

Jenkinsfile: run rpmdeplint
Dan Callaghan • 6 years ago  
Jenkinsfile: build docs
Dan Callaghan • 6 years ago  
Jenkinsfile: run pylint
Dan Callaghan • 6 years ago  
file modified
+58 -7
@@ -10,12 +10,21 @@ 

   * GNU General Public License for more details.

   */

  

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

+ 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'
mjia commented 6 years ago

Missing rpmdeplint here?

I put all the "standard" build tools (including mock, rpmlint, rpmdeplint, etc) into the Jenkins slave disk image. I guess I could also list it here for completeness... shrug.

          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/**'
@@ -30,7 +39,6 @@ 

                      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/**'

                  },
@@ -39,12 +47,45 @@ 

                      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/**'

                  },

              )

          }

+         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'

+                 },

+             )

+         }

+         stage('Invoke Rpmdeplint') {

+             parallel (

+                 'EPEL7': {

+                     sh """

+                     rpmdeplint check \

+                         --repo rhel7,http://pulp.dist.prod.ext.phx2.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/ \

+                         --repo rhel7-optional,http://pulp.dist.prod.ext.phx2.redhat.com/content/dist/rhel/server/7/7Server/x86_64/optional/os/ \

+                         --repo rhel7-extras,http://pulp.dist.prod.ext.phx2.redhat.com/content/dist/rhel/server/7/7Server/x86_64/extras/os/ \

+                         --repo epel7,http://dl.fedoraproject.org/pub/epel/7/x86_64/ \

+                         --arch x86_64 \

+                         mock-result/el7/*.noarch.rpm

+                     """

+                 },

+                 'F25': {

+                     sh """

+                     rpmdeplint check \

+                         --repo fedora,http://dl.fedoraproject.org/pub/fedora/linux/releases/25/Everything/x86_64/os/ \

+                         --repo updates,http://dl.fedoraproject.org/pub/fedora/linux/updates/25/x86_64/ \

+                         --arch x86_64 \

+                         mock-result/f25/*.noarch.rpm

+                     """

+                 },

+             )

+         }

      } catch (e) {

          currentBuild.result = "FAILED"

          /* Can't use GIT_BRANCH because of this issue https://issues.jenkins-ci.org/browse/JENKINS-35230 */
@@ -61,10 +102,20 @@ 

          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 ."

+             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()

+             }

          }

      } catch (e) {

          currentBuild.result = "FAILED"

file modified
+1 -1
@@ -2,7 +2,7 @@ 

  #

  

  # You can set these variables from the command line.

- SPHINXOPTS    =

+ SPHINXOPTS    = -W

  SPHINXBUILD   = sphinx-build

  SPHINXPROJ    = WaiverDB

  SOURCEDIR     = .

file modified
+1 -1
@@ -104,7 +104,7 @@ 

  # Add any paths that contain custom static files (such as style sheets) here,

  # relative to this directory. They are copied after the builtin static files,

  # so a file named "default.css" will overwrite the builtin "default.css".

- html_static_path = ['_static']

+ html_static_path = []

  

  

  # -- Options for HTMLHelp output ------------------------------------------

file added
+2
@@ -0,0 +1,2 @@ 

+ [MESSAGES CONTROL]

+ disable=R,C,no-member,fixme

Adds a bunch more testing into the Jenkins pipeline. Next step, deploy a test environment into OpenShift and run integration tests against it...

+1 Looks pretty slick!

Missing rpmdeplint here?

I put all the "standard" build tools (including mock, rpmlint, rpmdeplint, etc) into the Jenkins slave disk image. I guess I could also list it here for completeness... shrug.

Pull-Request has been merged by dcallagh

6 years ago