• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • Jenkins ver. 2.73.2
      Git plugin ver. 3.6.0

      It would be nice to make adding additional custom git commands possible.

      In git plugin currently we have an option for example to clean before checkout, it would be nice to make it more customizable.

       

          [JENKINS-47605] Add custom git command before/after checkout

          Mark Waite added a comment -

          Can you explain more about the types of jobs where you would use that?

          For example, pipeline (scripted and declarative) already gives full control of the exact point where the repository should be fetched. I think this can already be satisfied with pipeline.

          Freestyle doesn't allow that generalization, but does allow a "pre-scm build step" which can perform calls to command line utilities.

          Mark Waite added a comment - Can you explain more about the types of jobs where you would use that? For example, pipeline (scripted and declarative) already gives full control of the exact point where the repository should be fetched. I think this can already be satisfied with pipeline. Freestyle doesn't allow that generalization, but does allow a "pre-scm build step" which can perform calls to command line utilities.

          Michal Sznek added a comment -

          Thank you Mark for your answer.

          Well,  i have pipeline which has some stages. One of the stages is a git stage (seperate freestyle job), which pulls some repo, does some stuff. I need this seperate job, because this is used by many different pipelines.

          Until now, i had this git job defined by some cmd commands (still has the LFS problems). 

          Git plugin supports LFS since some time, so i wanted to rewrite this job to use the git plugin, but it supports only specific commands, defined in advance. 

          But i have to for example do stashing files before updating repo, and i cant do this with git plugin. 

          Maybe, do you have any idea how can use git plugin commands with stashing files before within one job?

          Michal Sznek added a comment - Thank you Mark for your answer. Well,  i have pipeline which has some stages. One of the stages is a git stage (seperate freestyle job), which pulls some repo, does some stuff. I need this seperate job, because this is used by many different pipelines. Until now, i had this git job defined by some cmd commands (still has the LFS problems).  Git plugin supports LFS since some time, so i wanted to rewrite this job to use the git plugin, but it supports only specific commands, defined in advance.  But i have to for example do stashing files before updating repo, and i cant do this with git plugin.  Maybe, do you have any idea how can use git plugin commands with stashing files before within one job?

          Mark Waite added a comment -

          Unfortunately, I don't have any idea how you could inject commands to stash files within a freestyle job, other than using the pre-SCM build step to perform the operation before checkout.

          You could use the Jenkins Pipeline and the archiveArtifacts facility which it provides. The Jenkins Pipeline gives full control of when the checkout is to be performed, where it is performed, and can archive results from one stage for use in later stages.

          Mark Waite added a comment - Unfortunately, I don't have any idea how you could inject commands to stash files within a freestyle job, other than using the pre-SCM build step to perform the operation before checkout. You could use the Jenkins Pipeline and the archiveArtifacts facility which it provides. The Jenkins Pipeline gives full control of when the checkout is to be performed, where it is performed, and can archive results from one stage for use in later stages.

            Unassigned Unassigned
            miszcz Michal Sznek
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: