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

svn, git plugin have different interfaces, and not good pipeline documentation

    Details

    • Similar Issues:

      Description

      the subversion plugin supports multiple roots and sets variables like SVN_REVISION_1. the git-plugin does the same and sets GIT_COMMIT. the suversiom-plugin sets SVN_URL_1, the git plugin sets GIT_URL, or GIT_URL_1 for the first one, depending how many there are.  there is a request JENKINS-34271 to add GIT_COMMIT_n to the git plugin, which was closed with "use pipeline plugin", without referring to more details.

      it would be great to make this consistent. and document it so it can be found easily.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          Refer to the following resources for additional information on the results of a checkout:

          Show
          markewaite Mark Waite added a comment - Refer to the following resources for additional information on the results of a checkout: Jenkins Minute video that describes how to use git environment variables Pipeline SCM Step for checkout How to customize checkout for Multibranch Pipeline
          Hide
          rthurner rupert je thurner added a comment -

          thank you so much for the documentation. there is nothing on how to check out 2 git urls and use the variables?

          Show
          rthurner rupert je thurner added a comment - thank you so much for the documentation. there is nothing on how to check out 2 git urls and use the variables?
          Hide
          markewaite Mark Waite added a comment -

          There is nothing on how to checkout two git URLs and use the variables.

          If two different Git URL's are being used from within a single Pipeline job then each checkout must be performed in a separate subdirectory with a separate checkout command performed for each repository. The git plugin does not support mixing checkouts from two unrelated repositories in the same working directory.

          Show
          markewaite Mark Waite added a comment - There is nothing on how to checkout two git URLs and use the variables. If two different Git URL's are being used from within a single Pipeline job then each checkout must be performed in a separate subdirectory with a separate checkout command performed for each repository. The git plugin does not support mixing checkouts from two unrelated repositories in the same working directory.
          Hide
          rthurner rupert je thurner added a comment -

          ah, that is really interesting and seems powerful. i saw :

          i saw that one has "scm", "currentBuild". how would you get the author, and commit-id ? how would you put an example of such a deploy snipped if you have another jenkinsfile which is loaded, containing e.g. deploy scripts?

          Show
          rthurner rupert je thurner added a comment - ah, that is really interesting and seems powerful. i saw : https://stackoverflow.com/questions/37395860/jenkinsfile-with-two-git-repositories   https://stackoverflow.com/questions/40224272/using-a-jenkins-pipeline-to-checkout-multiple-git-repos-into-same-job   https://qa.nuxeo.org/jenkins/pipeline-syntax/globals   https://jenkins.io/doc/pipeline/steps/workflow-scm-step/   i saw that one has "scm", "currentBuild". how would you get the author, and commit-id ? how would you put an example of such a deploy snipped if you have another jenkinsfile which is loaded, containing e.g. deploy scripts?
          Hide
          markewaite Mark Waite added a comment -

          The Jenkins Minute video shows how to use the GIT_COMMIT environment variable. Other environment variables are available with a similar technique.

          Scripted Pipeline can use the return value of the checkout step as a map which contains the environment variables for that checkout.

          Other variables are included in the JENKINS-45489 test case.

          A simpler example is in the JENKINS-50401 test case.

          A different example is in the JENKINS-51218 test case.

          Show
          markewaite Mark Waite added a comment - The Jenkins Minute video shows how to use the GIT_COMMIT environment variable. Other environment variables are available with a similar technique. Scripted Pipeline can use the return value of the checkout step as a map which contains the environment variables for that checkout. Other variables are included in the JENKINS-45489 test case . A simpler example is in the JENKINS-50401 test case . A different example is in the JENKINS-51218 test case .
          Hide
          markewaite Mark Waite added a comment -

          Won't attempt to make the git plugin consistent with Subversion plugin because it risks breaking too many existing users.

          Show
          markewaite Mark Waite added a comment - Won't attempt to make the git plugin consistent with Subversion plugin because it risks breaking too many existing users.

            People

            • Assignee:
              Unassigned
              Reporter:
              rthurner rupert je thurner
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: