Unit tests in Fedora’s Jenkins

We’re using CentOS’s Jenkins infrastructure for automatically running unit tests for new commits in master branch.

Pagure triggers tests for any new pull request. It can be also triggered manually by pressing “Rerun CI” button in PR.

Currently we run tests on Fedora 33/34/rawhide and CentOS 7/8 platforms.

Usage

If you need any change in jenkins setup, please file a pagure issue. As part of solving issue, this documentation must be updated to reflect current state in jenkins.

Configuration

  • Public access is for everyone with no need to log in to jenkins.

  • Admin access is via same interface and currently tkopecek have

    access there. If you need access for yourself (you’re probably part of brew/koji team) create ticket in https://pagure.io/centos-infra requesting this. Prerequisite for this is CentOS account.

  • Setup - Following items are set-up via

    https://jenkins-fedora-infra.apps.ocp.ci.centos.org/job/koji/configure

  • Job notifications - when jenkins job finishes, it will send some info to

    pagure. Such call will add a comment to PR. For this REST hook needs to be configured:

    • Format: JSON

    • Protocol: HTTP

    • Event: Job Finalized

    • URL: <url taken from koji pagure settings which will look similar to https://pagure.io/api/0/ci/jenkins//koji/<hash>/build-finished

    • Timeout: 30000

    • Log: 0

  • This build is parametrized (checkbox set to true) - it allows jenkins

    to use other branches than master (especially for PRs). Three parameters are defined there:

    • REPO - The repository for the pull request.

    • BRANCH - The branch for the pull request.

    • BRANCH_TO - A branch into which the pull request should be merged.

  • Discard Old Builds

    • Strategy: Rotation

    • Days to keep build: 20

    • Max # of builds to keep: empty

  • Disable build - it could be used if a lot of failing build happens with

    no vision of early recovery - temporarily suspend jenkins jobs

  • Restrict where this project can be run - F33 is the only used agent now.

    Basically we need an agent which supports podman as all the tests are run in docker images managed by podman.

  • Source Code Management

  • Build triggers

    • Trigger builds remotely: true

      • Authentication tokens: <token from koji pagure settings>

    • Poll SCM:

      • Schedule: H/5 * * * *

  • Build - most important part - script which runs tests itself. Basically we run tests in containers, last one also run flake8 and is used for coverage report.

  • Post-build actions

    • Publish Cobertura Coverage report: coverage.xml - this will create coverage report accessible via jenkins web ui

    • Report Violations - pep8: flake8_report.txt

    • E-mail notification:

  • Send messages to fedmsg