#372 Rework Jenkins CI
Merged 5 years ago by fivaldi. Opened 5 years ago by fivaldi.
fivaldi/freshmaker fivaldi_run_all_tox_envs  into  master

Rework Jenkins CI
Filip Valder • 5 years ago  
file modified
+24 -9
@@ -42,19 +42,24 @@ 

  

      timestamps {

  

- node('fedora-28') {

+ node('fedora-29') {

      checkout scm

      stage('Prepare') {

          sh 'sudo rm -f rpmbuild-output/*.src.rpm'

          sh 'mkdir -p rpmbuild-output'

          sh 'make -f .copr/Makefile srpm outdir=./rpmbuild-output/'

          sh 'sudo dnf -y builddep ./rpmbuild-output/freshmaker-*.src.rpm'

-         sh 'sudo dnf -y install python2-tox python3-tox'

-         /* Needed to get the latest /etc/mock/fedora-28-x86_64.cfg */

+         // TODO: some of the deps here should probably be in BuildRequires

+         sh 'sudo dnf -y install \

+             gcc \

+             krb5-devel \

+             openldap-devel \

+             python3-tox'

+         /* Needed to get the latest mock configs */

          sh 'sudo dnf -y update mock-core-configs'

      }

      stage('Run unit tests') {

-         sh 'tox -e flake8'

+         sh 'tox'

      }

      /* 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
@@ -69,16 +74,25 @@ 

                  """

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

              },

+             'F29': {

+                 sh """

+                 mkdir -p mock-result/f29

+                 flock /etc/mock/fedora-29-x86_64.cfg \

+                 /usr/bin/mock -v --enable-network --resultdir=mock-result/f29 -r fedora-29-x86_64 --clean --rebuild rpmbuild-output/*.src.rpm

+                 """

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

+             },

          )

      }

  }

+ if ("${env.JOB_NAME}" != 'freshmaker-prs') {

  node('docker') {

      checkout scm

      stage('Build Docker container') {

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

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

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

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

          def appversion = sh(returnStdout: true, script: """

-             rpm2cpio ${f28_rpm} | \

+             rpm2cpio ${f29_rpm} | \

              cpio --quiet --extract --to-stdout ./usr/lib/python\\*/site-packages/freshmaker\\*.egg-info/PKG-INFO | \

              awk '/^Version: / {print \$2}'

          """).trim()
@@ -92,7 +106,7 @@ 

              /* 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/freshmaker:internal-${appversion}", "--build-arg freshmaker_rpm=$f28_rpm --build-arg cacert_url=https://password.corp.redhat.com/RH-IT-Root-CA.crt ."

+             def image = docker.build "factory2/freshmaker:internal-${appversion}", "--build-arg freshmaker_rpm=$f29_rpm --build-arg cacert_url=https://password.corp.redhat.com/RH-IT-Root-CA.crt ."

              /* Pushes to the internal registry can sometimes randomly fail

               * with "unknown blob" due to a known issue with the registry

               * storage configuration. So we retry up to 3 times. */
@@ -104,7 +118,7 @@ 

          docker.withRegistry(

                  'https://quay.io/',

                  'quay-io-factory2-builder-sa-credentials') {

-             def image = docker.build "factory2/freshmaker:${appversion}", "--build-arg freshmaker_rpm=$f28_rpm ."

+             def image = docker.build "factory2/freshmaker:${appversion}", "--build-arg freshmaker_rpm=$f29_rpm ."

              image.push()

          }

          /* Save container version for later steps (this is ugly but I can't find anything better...) */
@@ -138,6 +152,7 @@ 

          }

      }

  }

+ }

  

      } // end timestamps

  } catch (e) {

file modified
+1
@@ -15,6 +15,7 @@ 

          -W "ignore:You do not have a working installation:UserWarning" \

          -W "ignore:inspect.getargspec:DeprecationWarning" \

          -W "ignore:This method will be removed in future versions.  Use 'parser.read_file()':DeprecationWarning" \

+         -W "ignore:Use .persist_selectable:DeprecationWarning" \

          {posargs}

  

  [testenv:flake8]

rebased onto f6b5ea0fb966052880ce7c108464e14da7721d3c

5 years ago

There is no python2-tox package on Fedora 29. I think you can remove it - it doesn't seem to be required here anyways.

rebased onto 86bc9da6d39434a87a8ad1476de797c6ba4d01b5

5 years ago

rebased onto 4020543223cca04620332cc889369221a70a6a08

5 years ago

rebased onto 3fe1f9b6620722a532cfb3e2b563eeab38b50c32

5 years ago

rebased onto 61c0a040a7f69c578bc13bb3c388d81b83f3a661

5 years ago

rebased onto c9eea2ff2a79a56ee11b6f80a939768a782abb3a

5 years ago

@lholecek I removed the dep. Thank you.

This PR should ready. Jenkins job is successful now.

Should we start using f29 in the Build Docker container step below?

Should we start using f29 in the Build Docker container step below?

:thumbsup:

rebased onto 2c7357a

5 years ago

@lucarval see git diff c9eea2f 2c7357a

pretty please pagure-ci rebuild

5 years ago

Jenkins is successful for the 2c7357a. Merging now....

Pull-Request has been merged by fivaldi

5 years ago