Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57411

Upgrade github-branch-source-plugin to use okhttp3

      The latest OkHttp (v2.7.5) is over three years old. The web has come a long way. There are a significant number of Jenkins JIRA and Zendesk issues related to using this ancient library in key plugins.

      We should upgrade Jenkins to use OkHttp3.

      NOTES:

      • OkHttp 2.x and 3.x exist in separate packages and can run side-by-side without conflict. However, different versions of 3.x (and okhttp3 4.x) may be incompatible if clients are using obsolete classes/methods.
      • OkHttp 3.12.2 is the last version that is reasonably compatible with 2.7.5. Upgrading will require some changes but not huge ones.
      • OkHttp 3.13.1 has some notable incompatibilities with 2.7.5, but also some better defaults.
      • OkHttp 3.14.1 removes OkHttpUrlFactory which is a serious version-incompatible API change for several plugins. The github-api library pulled in a shim that provides a workaround OkHttpUrlFactory.

      Early exploration of this upgrade was started to test whether it would address issues such as JENKINS-54126.

      Finding so far while using 3.12.2:

      • okio v2.2.x is needed for okhttp3.
      • Some special class loading settings are needed to get the right versions okhttp3 and okio to be loaded.

      (Last updated May 4, 2020):
      The rebuilt incremental can be found at:
      https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/github-branch-source/2.7.2-rc1149.0f9fd89495cc/

      This version uses okhttp3 and is compatible with github-api-plugin 1.110+.

          [JENKINS-57411] Upgrade github-branch-source-plugin to use okhttp3

          Liam Newman added a comment -

          jsoref

          we are seeing that the periodic scans don't seem to be running periodically, and a branch whose name has been recycled (but for whom we'd expect github to send a notification) isn't being noticed automatically.

          We are able to use "Scan Repository Now" to pick up those branches, which feels like progress.

          Yeah, that's better than nothing.

          Take a look at the Events log for the org/repo to see if there are errors. Otherwise, errors might only show in the Jenkins Master's console log output.

          Liam Newman added a comment - jsoref we are seeing that the periodic scans don't seem to be running periodically, and a branch whose name has been recycled (but for whom we'd expect github to send a notification) isn't being noticed automatically. We are able to use "Scan Repository Now" to pick up those branches, which feels like progress. Yeah, that's better than nothing. Take a look at the Events log for the org/repo to see if there are errors. Otherwise, errors might only show in the Jenkins Master's console log output.

          Josh Soref added a comment -

          There wasn't anything obvious in the scan repository logs. I'll check the master log…

          Josh Soref added a comment - There wasn't anything obvious in the scan repository logs. I'll check the master log…

          Liam Newman added a comment -

          jsoref
          Cool thanks.

          I'm really not sure what would the periodic scans to not run.

          Liam Newman added a comment - jsoref Cool thanks. I'm really not sure what would the periodic scans to not run.

          Liam Newman added a comment -

          jsoref
          I'm pretty sure the periodic scans not running are unrelated. I've updated the patched plugin to include the latest fixes (see the description).

          Liam Newman added a comment - jsoref I'm pretty sure the periodic scans not running are unrelated. I've updated the patched plugin to include the latest fixes (see the description).

          Liam Newman added a comment - - edited

          The rebuilt incremental can be found at:
          https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/github-branch-source/2.7.2-rc1149.0f9fd89495cc/

          This version uses okhttp3 v4.4.1 and is compatible with github-api-plugin 1.110+.

          IMPORTANT: It seems that the OkHttp3 version must match exactly. OkHttp3 uses some reflection features the mean if the github-api library is built with v4.4.1, the exact same version must be used at runtime or things go badly. This means okhttp3 is poor match the Jenkins (and much of Java) loose-dependency versioning.

          Liam Newman added a comment - - edited The rebuilt incremental can be found at: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/github-branch-source/2.7.2-rc1149.0f9fd89495cc/ This version uses okhttp3 v4.4.1 and is compatible with github-api-plugin 1.110+. IMPORTANT: It seems that the OkHttp3 version must match exactly. OkHttp3 uses some reflection features the mean if the github-api library is built with v4.4.1, the exact same version must be used at runtime or things go badly. This means okhttp3 is poor match the Jenkins (and much of Java) loose-dependency versioning.

            Unassigned Unassigned
            bitwiseman Liam Newman
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: