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

Lightweight checkout of Jenkinsfile does not work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      Jenkins 2.285
    • Similar Issues:

      Description

      I created a pipeline job and configured it to use a Jenkinsfile from a Git repository using Lightweight Checkout.
      The branch to use is specified as "ref/heads/master" so there is no message "Lightweight checkout support not available" in the console output. (I had that case before.)
      Still the whole repository gets cloned into the workspace.

        Attachments

          Activity

          Hide
          wolterhis Lars added a comment -

          I'm using Gitlab. So it should work. But it doesn't - it's strange.
          The console output says "Obtained jenkinsfile from git ...". After that it waits a few seconds for a Jenkins agent to get online, where the job should be executed.
          At this point the workspace is empty, no repository has been cloned, but Jenkins knows the content of the Jenkinsfile (otherwise it would not wait for the agent, because the agent is configured in the Jenkinsfile). So obviously the lightweight checkout must have worked!?
          But after the agent gets online and the build continues the complete repo where the Jenkinsfile is located gets cloned (and that is not a step of the Jenkinsfile). I don't get why.

          Show
          wolterhis Lars added a comment - I'm using Gitlab. So it should work. But it doesn't - it's strange. The console output says "Obtained jenkinsfile from git ...". After that it waits a few seconds for a Jenkins agent to get online, where the job should be executed. At this point the workspace is empty, no repository has been cloned, but Jenkins knows the content of the Jenkinsfile (otherwise it would not wait for the agent, because the agent is configured in the Jenkinsfile). So obviously the lightweight checkout must have worked!? But after the agent gets online and the build continues the complete repo where the Jenkinsfile is located gets cloned (and that is not a step of the Jenkinsfile). I don't get why.
          Hide
          markewaite Mark Waite added a comment -

          Lightweight checkout is a concept whose specific implementation depends on the git branch provider you are using in Jenkins.

          If you're using the lowest level component (git plugin), it uses command line git to retrieve the Jenkinsfile. That retrieval requires a fetch and checkout of the repository.

          If you're using a higher level component (GitHub branch source, Bitbucket branch source, GitLab branch source, Gitea, Tuleap branch source), they may be able to use provider API's to retrieve the Jenkinsfile.

          Show
          markewaite Mark Waite added a comment - Lightweight checkout is a concept whose specific implementation depends on the git branch provider you are using in Jenkins. If you're using the lowest level component (git plugin), it uses command line git to retrieve the Jenkinsfile. That retrieval requires a fetch and checkout of the repository. If you're using a higher level component (GitHub branch source, Bitbucket branch source, GitLab branch source, Gitea, Tuleap branch source), they may be able to use provider API's to retrieve the Jenkinsfile.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            wolterhis Lars
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: