Repository navigation
Description
The gist of this is that due to some encoding change made in the SCM API 2.0 release, conventional URIs
This was originally noticed by the Blue Ocean team in this pull request discussing integrating SCM API 2.0 changes. See also JENKINS-40299">JENKINS-40299.
The blog post discusses some of the data migrations which are supposed to take place, however the URI changing issue results in two bad behaviors:
* URIs change for Multibranch-based Pipelines which use "special characters" in their names, such as improvement/JENKINS-41047">JENKINS-41047 would previously be located at: https://ci.blueocean.io/job/blueocean/job/improvement%2FJENKINS-41047/. After these changes it would be found at JENKINS-41047.d61e72/" class="external-link" target="_blank" rel="nofollow noopener">https://ci.blueocean.io/job/blueocean/job/improvement-JENKINS-41047.d61e72/
* Post-upgrade, rebooting the Jenkins installation results in *every* Multibranch Pipeline being retriggered. Such as JENKINS-39625-part1/" class="external-link" target="_blank" rel="nofollow noopener">this Pipeline despite no new changes being made.
Because the upgrade to SCM API 2.0 is a one-direction-only change, I propose we blacklist the updated versions of the plugins referenced in this post before too many people upgrade a non-reversible upgrade.
Incorrect analysis with lots of FUD.
The renaming of jobs has nothing to do here.
The issue here is that GitHub Branch Source 1.x passes a null id to the constructor of it's SCMSource: https://github.com/jenkinsci/github-branch-source-plugin/blob/1.10-stable/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java#L312
This means that every time you perform a scan of the organization folder, all the SCMSource instances get a new ID.
When the branch changes SCMSource instance (i.e. the ID is different) then the Branch API is supposed to trigger a rebuild (because the branch is from a different source, never mind that it may be the same revision, we have no way of knowing)
In 2.x we have a consistent ID: https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java#L446
The issue here is that GitHub Branch Source did not correctly ensure that the SCMSource from a Organization Folder had a consistent ID.
Thus, every time you do a scan of an organization folder, with the old logic it should have been re-triggering a build... It wasn't because of other bugs... this leads to things like "I cannot re-trigger PRs", etc
In fixing the problems in GitHub Branch Source, we get to a point where everything is behaving correctly, but the data for the previous branch origins is not current and thus the PRs have not been built from their current source.
Originally reported by
rtyler, imported from: GitHub Branch Source upgrade can cause a lot of rebuilds
- assignee:
stephenconnolly
- status: Closed
- priority: Critical
- component(s): scm-api-plugin
- resolution: Fixed
- resolved: 2017-01-23T21:09:51+00:00
- votes: 4
- watchers: 31
- imported: 20251223-222157
Raw content of original issue
The gist of this is that due to some encoding change made in the SCM API 2.0 release, conventional URIs This was originally noticed by the Blue Ocean team in this pull request discussing integrating SCM API 2.0 changes. See also
JENKINS-40299. The blog post discusses some of the data migrations which are supposed to take place, however the URI changing issue results in two bad behaviors: * URIs change for Multibranch-based Pipelines which use "special characters" in their names, such as improvement/JENKINS-41047would previously be located at: https://ci.blueocean.io/job/blueocean/job/improvement%2FJENKINS-41047/. After these changes it would be found at https://ci.blueocean.io/job/blueocean/job/improvement-JENKINS-41047.d61e72/ * Post-upgrade, rebooting the Jenkins installation results in *every* Multibranch Pipeline being retriggered. Such as this Pipeline despite no new changes being made. Because the upgrade to SCM API 2.0 is a one-direction-only change, I propose we blacklist the updated versions of the plugins referenced in this post before too many people upgrade a non-reversible upgrade.Incorrect analysis with lots of FUD.
The renaming of jobs has nothing to do here.
The issue here is that GitHub Branch Source 1.x passes a null id to the constructor of it's SCMSource: https://github.com/jenkinsci/github-branch-source-plugin/blob/1.10-stable/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java#L312
This means that every time you perform a scan of the organization folder, all the SCMSource instances get a new ID.
When the branch changes SCMSource instance (i.e. the ID is different) then the Branch API is supposed to trigger a rebuild (because the branch is from a different source, never mind that it may be the same revision, we have no way of knowing)
In 2.x we have a consistent ID: https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java#L446
The issue here is that GitHub Branch Source did not correctly ensure that the SCMSource from a Organization Folder had a consistent ID.
Thus, every time you do a scan of an organization folder, with the old logic it should have been re-triggering a build... It wasn't because of other bugs... this leads to things like "I cannot re-trigger PRs", etc
In fixing the problems in GitHub Branch Source, we get to a point where everything is behaving correctly, but the data for the previous branch origins is not current and thus the PRs have not been built from their current source.
Activity
jenkins-infra-bot commentedon Jan 17, 2017
Remote links associated with this issue:
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Code changed in jenkins
User: R. Tyler Croy
Path:
src/main/resources/artifact-ignores.properties
http://jenkins-ci.org/commit/backend-update-center2/b52d4f68547e2d09d50cc4127d37a153622b6c85
Log:
Ignore SCM API 2.0 related changes until the cause of JENKINS-41121">
JENKINS-41121The basic idea of this is that the upgrades are sufficiently dangerous and *one
direction* (i.e. no rollback except for restoring from a pre-upgrade backup of
JENKINS_HOME) that it's best for Jenkins users to hide these versions until this
is figured out and made more safe.
See https://jenkins.io/blog/2017/01/17/scm-api-2/ for the list of affected
plugins.
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Based on michaelneale/'s comment here, webhook triggering is broken for any branch with a "weird" character in it.
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Code changed in jenkins
User: R. Tyler Croy
Path:
content/blog/2017/2017-01-17-scm-api-2.0-release.adoc
http://jenkins-ci.org/commit/jenkins.io/cceffabdd93994ec1d9f974e67fb927fb50ae496
Log:
Advise against upgrading plugins until JENKINS-41121">
JENKINS-41121is resolvedThis commit should be reverted when the fixes hit the update center
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Code changed in jenkins
User: R. Tyler Croy
Path:
content/blog/2017/2017-01-17-scm-api-2.0-release.adoc
http://jenkins-ci.org/commit/jenkins.io/beac68e9fb301b1b3a6993ae066f44c16d5486a8
Log:
Merge pull request #550 from rtyler/41121
Advise against upgrading plugins until JENKINS-41121">
JENKINS-41121is resolvedCompare: jenkins-infra/jenkins.io@7dfbc44...beac68e
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Root Cause
The previous Branch API plugin didn't record sufficient information for us to migrate the state of the historical PR's. Stephen estimates that 5-10% of historical builds were built using incorrect data. We don't know if the last build reflects reality.
Possible fixes
Stephen and I have been discussing this. Here are my notes from the discussion:
Impact
Root Cause
The previous Branch API plugin didn't record sufficient information for us to migrate the state of the historical PR's. Stephen estimates that 5-10% of historical builds were built using incorrect data. We don't know if the last build reflects reality.
Possible fixes
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
What incorrect data would that be? Can you give some concrete examples to help evaluate whether other fixes might be possible?
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
So there are a number of cases, the easiest to understand is the case of the merge commit PR.
You can edit the target branch of a PR on GitHub.
The old way that pull requests were tracked persisted the original target branch as part of the SCMHead but did not include that information in the equality contract for the SCMHead
Thus depending on the code path followed through Jenkins, you can either get a build result on the PR commit of success or failure that corresponds to a merge commit against the wrong target branch.
There are other cases, but they get more complex to follow and analyse
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
I triggered a rescan of a single multibranch project and it triggered a rebuild storm (not just org folder).
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Mic's comments: an alternative experience is that things won't work and you have to trigger a rescan by hand. Result is a build storm either way.
Michael cancelled all the queued items and all the commit statuses are broken due to cancelled builds. The history of the PR is otherwise retained.
Mic says he saw this happen on a plain old multibranch project, not an org folder. As a branch source folder user, Mic had to do a reindex and this caused a build storm. If branch source is expected to be fine and that is not related to this issue, we may have seperate issue.
We need to clarify if this is addresses what Michael saw with his multi-branch project or if this is a separate issue.
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Hmmm so that may be a separate issue with PRs only. Were any of the branches affected or was it just PRs
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
The current fix I have is jenkinsci/branch-api-plugin#71 which will fix the build storm in org folders.
It is possible that there could be a partial build storm in multi-branch, that would be for PRs only if I'm interpreting the code paths correctly... not sure if I can dissect that out as we have a slightly different requirements to fix that
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
src/main/resources/artifact-ignores.properties
http://jenkins-ci.org/commit/backend-update-center2/80b552055b220f045c554a0de81f83159bebbdb5
Log:
Merge pull request #100 from jenkinsci/JENKINS-41121">
JENKINS-41121Ignore SCM API 2.0 related changes until JENKINS-41121">
JENKINS-41121is addressedCompare: jenkins-infra/update-center2@a6431a9...80b5520
jenkins-infra-bot commentedon Jan 17, 2017
Raw content of original comment:
Current status: new metadata got generated, and waiting for mirrors to pick them up
jenkins-infra-bot commentedon Jan 18, 2017
Raw content of original comment:
To clarify KK's comments above, this release has been removed from update centers until we can address this issue and others.
21 remaining items
jenkins-infra-bot commentedon Feb 3, 2017
Raw content of original comment:
morgan_goose
Manually downloading plugins from https://repo.jenkins-ci.org/public/org/jenkins-ci/plugins/ is neither the normal way to install plugins nor the recommended way.
When you manually download plugins you have to take responsibility to manually download the required dependencies.
For the SCM API and Blue Ocean related updates that is potentially a list of updates that could grow to 72 plugins depending on what plugins and versions you have installed prior to upgrading... though an otherwise up to date system might only need 24 plugins... and if you do not have Blue Ocean installed that number could drop to somewhere between 7 and 9.
Given that you have manually installed more than one of the plugins, my recommendation is that you download the ZIP file that I gave a link to in https://issues.jenkins-ci.org/browse/JENKINS-41661 and use the plugins in that ZIP file to update your instance.
For future reference, the recommended path for installing plugins is via the update center. There are safety checks that the update center applies to help prevent issues. While we can agree that there are more additional safety checks needed, the limited checks it does have are better than no checks which is the net effect of manual downloading.
jenkins-infra-bot commentedon Feb 5, 2017
Raw content of original comment:
I can tell you that I did not download any plugins by hand, and only used the update center. And still wound up reading this issue.
Echo everything that Morgan Goose said. I downgraded some plugins because that appeared to be the recommended path, and I only narrowly avoided deleting my settings after reading the same warnings that you saw about old data. Maybe I caught the upgrade moments before you blacklisted the 2.0.1 update? Not sure. The timing is about right though.
Thanks for reposting the ZIP link. I see that you're planning a Monday release, I will wait for that, thanks for providing a clear(ish) path in the issue documentation. FWIW none of the plugins that complained at me about bad dependency versions, actually appeared to be malfunctioning, but I am not using Blue Ocean or advanced GitHub API plugins yet.
jenkins-infra-bot commentedon Feb 5, 2017
Raw content of original comment:
kingdonb you have a different case from Morgan.
Morgan said:
Whereas you downloaded the plugins via the recommended path (and were just bit by the issues described in JENKINS-41661">
JENKINS-41661which is where I am complaining that the UC does not do enough validation. The UC method does at least try to upgrade all the required dependencies... it should grey out plugins that cannot be installed IMHO)Kingdon, I recommend reading JENKINS-41661+Post-Mortem" class="external-link" target="_blank" rel="nofollow noopener">https://wiki.jenkins-ci.org/display/JENKINS/JENKINS-41661+Post-Mortem for more details on the JENKINS-41661">
JENKINS-41661issue that affected you.The plugins will all be released on Monday.
Sorry for any inconvenience caused.
jenkins-infra-bot commentedon Feb 5, 2017
Raw content of original comment:
Yeah, sounds like you're on top of things. Lesson learned: full backups immediately before every upgrade!
No trouble at all, thanks for your contribution!
jenkins-infra-bot commentedon Feb 5, 2017
Raw content of original comment:
kingdonb
This was a particularly troublesome set of upgrades. Due to the mistakes made in GHBS and BBBS (because of lack of documentation) we had to break data compatibility in a particularly complicated way that prevented the normal evolution mode in Jenkins.
Hopefully we will not be doing that again any time in the near future
jenkins-infra-bot commentedon Feb 6, 2017
morgan_goose:
Raw content of original comment:
stephenconnolly I'd like to clarify, that I only installed those two plugins manually after multiple plugins failed to load saying that these versions were required. All of those complaining plugins were shown as having updates available and were updated in the suggested way (via the plugin update center web UI).
jenkins-infra-bot commentedon Dec 23, 2025
[Original
relates_tofrom Jira: JENKINS-40299]