jenkinsci / plasticscm-plugin

A plugin for Jenkins to be able to use Plastic SCM
MIT License
16 stars 31 forks source link

FATAL: Multibranch scan crashes when there are multiple branches #56

Closed Tommigun1980 closed 2 years ago

Tommigun1980 commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.360 OS: Mac OS X - 12.4 --- ace-editor:1.1 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 bootstrap5-api:5.1.3-7 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-monitor-plugin:1.13+build.202205140447 build-timeout:1.21 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.4 cloudbees-folder:6.729.v2b_9d1a_74d673 command-launcher:84.v4a_97f2027398 credentials:1139.veb_9579fca_33b_ credentials-binding:523.vd859a_4b_122e6 display-url-api:2.3.6 durable-task:496.va67c6f9eefa7 echarts-api:5.3.3-1 email-ext:2.91 external-monitor-job:191.v363d0d1efdf8 font-awesome-api:6.1.1-1 git:4.11.3 git-client:3.11.0 github:1.34.4 github-api:1.303-400.v35c2d8258028 github-branch-source:1677.v731f745ea_0cf gradle:1.39.4 handlebars:3.0.8 instance-identity:116.vf8f487400980 jackson2-api:2.13.3-285.vc03c0256d517 jakarta-activation-api:2.0.0-3 jakarta-mail-api:2.0.0-6 javax-activation-api:1.2.0-4 javax-mail-api:1.6.2-7 jaxb:2.3.6-1 jdk-tool:1.5 jjwt-api:0.11.5-77.v646c772fddb_0 job-restrictions:0.8 jquery3-api:3.6.0-4 jsch:0.1.55.2 junit:1119.1121.vc43d0fc45561 ldap:2.10 mailer:438.v02c7f0a_12fa_4 matrix-auth:3.1.5 matrix-project:785.v06b_7f47b_c631 mina-sshd-api-common:2.8.0-30.vf9df64641cb_d mina-sshd-api-core:2.8.0-30.vf9df64641cb_d momentjs:1.1.1 okhttp-api:4.9.3-105.vb96869f8ac3a pam-auth:1.8 pipeline-build-step:2.18 pipeline-github-lib:38.v445716ea_edda_ pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-groovy-lib:598.vcd66b_a_336510 pipeline-input-step:449.v77f0e8b_845c4 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2114.v2654ca_721309 pipeline-model-definition:2.2114.v2654ca_721309 pipeline-model-extensions:2.2114.v2654ca_721309 pipeline-rest-api:2.24 pipeline-stage-step:293.v200037eefcd5 pipeline-stage-tags-metadata:2.2114.v2654ca_721309 pipeline-stage-view:2.24 plain-credentials:1.8 plasticscm-mergebot:0.15 plasticscm-plugin:4.2 plugin-util-api:2.17.0 popper2-api:2.11.5-2 resource-disposer:0.19 role-strategy:546.ve16648865996 scm-api:616.ve67136f6c77d script-security:1175.v4b_d517d6db_f0 snakeyaml-api:1.30.2-76.vc104f7ce9870 ssh-agent:295.v9ca_a_1c7cc3a_a_ ssh-credentials:291.v8211e4f8efb_c ssh-slaves:1.834.v622da_57f702c sshd:3.242.va_db_9da_b_26a_c3 structs:324.va_f5d6774f3a_d throttle-concurrents:2.8 timestamper:1.18 token-macro:293.v283932a_0a_b_49 trilead-api:1.67.vc3938a_35172f variant:1.4 windows-slaves:1.8.1 workflow-aggregator:590.v6a_d052e5a_a_b_5 workflow-api:1188.v0016b_4f29881 workflow-basic-steps:980.v82219a_ed188e workflow-cps:2759.v87459c4eea_ca_ workflow-durable-task-step:1199.v02b_9244f8064 workflow-job:1226.v44f718dcfe1f workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:833.va_1c71061486b_ ws-cleanup:0.42 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Mac OS X - 12.4

Reproduction steps

  1. Turn on Git support in the Plastic SCM server
  2. Add a new multibranch Jenkins job for a specific repo
  3. Let it scan the logs or trigger a scan manually -- this works as long as there's only one branch (/main)
  4. Now create a second branch in your repo (I created a sub-branch, don't know if the error happens also with top-level branches)
  5. Run the multibranch job again
  6. It now crashes with
    ERROR: [Sun Jul 24 18:41:38 EEST 2022] Could not fetch branches from source XXX
    [Sun Jul 24 18:41:38 EEST 2022] Finished branch indexing. Indexing took 0,14 sec
    FATAL: Failed to recompute children of JobName
    hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
    stdout: 
    stderr: fetch-pack: protocol error: bad band #65
    fatal: protocol error: bad pack header

Expected Results

Multibranch jobs should work when there are multiple branches

Actual Results

Multibranch jobs stop working when there's branches other than /main in the repo. I think that this is probably an issue in the server itself and not the Jenkins plugin but I am reporting it here also.

The error message is:

ERROR: [Sun Jul 24 18:41:38 EEST 2022] Could not fetch branches from source XXX
[Sun Jul 24 18:41:38 EEST 2022] Finished branch indexing. Indexing took 0,14 sec
FATAL: Failed to recompute children of JobName
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fetch-pack: protocol error: bad band #65
fatal: protocol error: bad pack header

And the full log is:

Started by user XXX
[Sun Jul 24 18:41:38 EEST 2022] Starting branch indexing...
 > /usr/bin/git --version # timeout=10
 > git --version # 'git version 2.32.1 (Apple Git-133)'
using GIT_ASKPASS to set credentials 
 > /usr/bin/git ls-remote --symref -- git://XXX:9418/RepoName # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/bin/git ls-remote -- git://XXX:9418/RepoName # timeout=10
 > /usr/bin/git rev-parse --resolve-git-dir /Users/username/.jenkins/caches/git-ffc87a3a7cb515e94a9438d58253b28b/.git # timeout=10
Setting origin to git://XXX:9418/RepoName
 > /usr/bin/git config remote.origin.url git://XXX:9418/RepoName # timeout=10
Fetching & pruning origin...
Listing remote references...
 > /usr/bin/git config --get remote.origin.url # timeout=10
 > /usr/bin/git --version # timeout=10
 > git --version # 'git version 2.32.1 (Apple Git-133)'
using GIT_ASKPASS to set credentials 
 > /usr/bin/git ls-remote -h -- git://XXX:9418/RepoName # timeout=10
Fetching upstream changes from origin
 > /usr/bin/git config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: [Sun Jul 24 18:41:38 EEST 2022] Could not fetch branches from source 32170157-c4d5-4de6-ad38-5e7e5cf245cc
[Sun Jul 24 18:41:38 EEST 2022] Finished branch indexing. Indexing took 0,14 sec
FATAL: Failed to recompute children of JobName
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fetch-pack: protocol error: bad band #65
fatal: protocol error: bad pack header

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
    at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:602)
    at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:588)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:394)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:350)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:588)
    at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:166)
    at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE

Anything else?

Here's the Branch Sources setup for the multibranch job (with login information redacted):

Screenshot 2022-07-24 at 19 33 00
Tommigun1980 commented 2 years ago

UPDATE: This seems to start happening at random even when only one branch is involved, as I have another repo without any branches (other than /main) and the same error happens there. It works for a few hours until the aforementioned error starts to happen.

mig42 commented 2 years ago

Hi @Tommigun1980,

Unfortunately you're having issues with the GitServer feature in a Plastic SCM server, interacting with the Git plugin for Jenkins. The scope of this repo only includes the Plastic plugin for Jenkins, not the GitServer features of the Plastic SCM server nor interactions with other Jenkins plugins. You can report Plastic SCM issues at support@plasticscm.com.

I'm closing this issue, sorry for the inconvenience.