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

Support Shelved Jenkinsfile (mainly for Swarm reviews)

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin

      We are introducing Jenkinsfile into an existing Perforce-hosted project.

      We have set it up as a Swarm project, which is correctly showing branches and Reviews.

      We have created a Multibranch Pipeline project, with the Helix Swarm Branch Source, as we want to have our Swarm Reviews run CI in a similar manner to Merge Requests in our GitLab installation.

      This project is configured for mode "by Jenkinsfile", with Script Path "Jenkinsfile".

      We have no Jenkinsfiles in our codebase yet, and one open review which is introducing the Jenkinsfile.

      However, the multibranch scan is providing the wrong reference to fetch the Jenkinsfile from the review.

      Our Scan Multibranch Pipeline Log looks like:

      Started by user Paul Hampson
      [Thu Jan 21 13:19:54 AEDT 2021] Starting branch indexing...
      ... p4 login -s +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 client -i +
      ...   View: +
      ... p4 counter change +
      ... p4 counter change +
      ... p4 changes -m1 -ssubmitted //jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123/...@7___ +
      ... p4 changes -m1 //ps/unreal/trunk/...@733645,734645 +
      Scanning for //ps/unreal/trunk/Jenkinsfile
      ... p4 files -e //ps/unreal/trunk/Jenkinsfile +
            ‘Jenkinsfile’ not found
      ... p4 login -s +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 client -i +
      ...   View: +
      ... p4 counter change +
      ... p4 counter change +
      ... p4 changes -m1 -ssubmitted //jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123/...@7___ +
      ... p4 changes -m1 //ps/unreal/project-shooter-game/...@733645,734645 +
      Scanning for //ps/unreal/project-shooter-game/Jenkinsfile
      ... p4 files -e //ps/unreal/project-shooter-game/Jenkinsfile +
            ‘Jenkinsfile’ not found
      ... p4 login -s +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 client -i +
      ...   View: +
      ... p4 counter change +
      ... p4 counter change +
      ... p4 changes -m1 -ssubmitted //jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123/...@7___ +
      ... p4 changes -m1 //ps/unreal/unreal-shooter-game/...@733645,734645 +
      Scanning for //ps/unreal/unreal-shooter-game/Jenkinsfile
      ... p4 files -e //ps/unreal/unreal-shooter-game/Jenkinsfile +
            ‘Jenkinsfile’ not found
      ... p4 login -s +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      ... p4 client -i +
      ...   View: +
      Scanning for //ps/unreal/trunk/Jenkinsfile@734627
      ... p4 files -e //ps/unreal/trunk/Jenkinsfile@734627 +
            ‘Jenkinsfile’ not found
      ... p4 client -d jenkinsTemp-194b52ab-489f-473b-9fa2-b48aedce7123 +
      [Thu Jan 21 13:19:54 AEDT 2021] Finished branch indexing. Indexing took 0.47 sec
      Finished: SUCCESS
      

      i.e. for Review 734267, it is attempting to fetch //ps/unreal/trunk/Jenkinsfile@734627 but being a Review (and hence a Shelf) it should be fetching //ps/unreal/trunk/Jenkinsfile@=734627

      I have confirmed through our Swarm instance that https://swarm.bigworldtech.com/files/ps/unreal/trunk/Jenkinsfile@=734627 exists, but https://swarm.bigworldtech.com/files/ps/unreal/trunk/Jenkinsfile@734627 does not.

      A log capture for org.jeninsci.plugins.p4 shows

      Jan 21, 2021 1:19:54 PM FINE org.jenkinsci.plugins.p4.scm.AbstractP4ScmSource
      SCM: retrieve Head: P4SCMHead: 734627 (//ps/unreal/trunk@734627)
      

      and I'm reasonably sure that this is the issue, and that it should simply be //ps/unreal/trunk@=734627.

      However, I acknowledge that perhaps this is more than just a missing =, if it turns out the workflow we need for Swarm Reviews is "checkout base and then unshelve"?

      Based on other reports in this JIRA, e.g., JENKINS-60220, I'm assuming that this problem is localised to the "by Jenkinsfile" part of the flow, and that once a Jenkinsfile is found, the actual workspace would correctly contain the Review's shelved state.

      It'd be good to know of any workarounds that might help here.

            Unassigned Unassigned
            p_hampson Paul "TBBle" Hampson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: