Is there a way of cloning the repo an additional layer down?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way of cloning the repo an additional layer down?

dandeliondodgeball
Default: ../workspace/Pipeline01/<what ever you clone>
Desired: ../workspace/Pipeline01/repo01code/<what ever you clone>

Why do I want to do this?   
The scripts to build the code, can't live at the same level as the code.  I can have the scripts live some place other then the Pipeline01 workspace, but then Jenkins doesn't "know" about them.

Assuming there is no simple generic solution, what is the best custom solution?  My first thought would be a script.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a09a4554-09f4-42dc-8330-58b56f9b0b7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way of cloning the repo an additional layer down?

Daniel Beck

> On 2. Oct 2017, at 21:13, dandeliondodgeball <[hidden email]> wrote:
>
> Assuming there is no simple generic solution, what is the best custom solution?  My first thought would be a script.
>

If this is a scripted pipeline, you can do

  dir('repo01code') {
    checkout scm
  }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/78E0692E-50BB-40C4-AEC7-B6B2C3542BB5%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way of cloning the repo an additional layer down?

dandeliondodgeball
Did this two different ways in the same workspace. 
../workspace/Pipeline01/Artifact/my.zip
../workspace/Pipeline01/clonedRepo/

One for the artifact I needed.   
For this I used an attribute in the CopyArtifact plugin, like this (declarative pipeline):
stages {
    stage('Copy Archive') {
        steps {
            script {
                step ([$class: 'CopyArtifact',
                projectName: 'Create_archive',
                filter: "packages/my.zip",
                target: 'Artifact']);



And another for the code which was getting cloned.   
For this I used the "Check out to sub-directory" feature in the git plugin, like this:



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f6b55274-4823-47e3-b1a7-46892e9d3601%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way of cloning the repo an additional layer down?

Mark Waite-2


On Fri, Oct 6, 2017 at 2:24 PM dandeliondodgeball <[hidden email]> wrote:
Did this two different ways in the same workspace. 
../workspace/Pipeline01/Artifact/my.zip
../workspace/Pipeline01/clonedRepo/

One for the artifact I needed.   
For this I used an attribute in the CopyArtifact plugin, like this (declarative pipeline):
stages {
    stage('Copy Archive') {
        steps {
            script {
                step ([$class: 'CopyArtifact',
                projectName: 'Create_archive',
                filter: "packages/my.zip",
                target: 'Artifact']);



And another for the code which was getting cloned.   
For this I used the "Check out to sub-directory" feature in the git plugin, like this:




If you use the dir('dest-dir') { checkout scm } syntax, you avoid using that special case from the git plugin, and have something that is maintained in code (and looks like pipeline), rather than something that looks like a special case of the git plugin.

The technique you used (with the git extension) works, but was really created to be used with freestyle projects.  Pipeline has a better way to do it with the dir() step.

Mark Waite
  

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f6b55274-4823-47e3-b1a7-46892e9d3601%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG_t7%2BvdWK0P1qovNV5zX7J71UEfoWsCxXkHaM8TZH%3D1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way of cloning the repo an additional layer down?

dandeliondodgeball
Good point.  I would rather have it in the Jenkinsfile.  Thanks.

On Fri, Oct 6, 2017 at 5:06 PM, Mark Waite <[hidden email]> wrote:


On Fri, Oct 6, 2017 at 2:24 PM dandeliondodgeball <[hidden email]> wrote:
Did this two different ways in the same workspace. 
../workspace/Pipeline01/Artifact/my.zip
../workspace/Pipeline01/clonedRepo/

One for the artifact I needed.   
For this I used an attribute in the CopyArtifact plugin, like this (declarative pipeline):
stages {
    stage('Copy Archive') {
        steps {
            script {
                step ([$class: 'CopyArtifact',
                projectName: 'Create_archive',
                filter: "packages/my.zip",
                target: 'Artifact']);



And another for the code which was getting cloned.   
For this I used the "Check out to sub-directory" feature in the git plugin, like this:




If you use the dir('dest-dir') { checkout scm } syntax, you avoid using that special case from the git plugin, and have something that is maintained in code (and looks like pipeline), rather than something that looks like a special case of the git plugin.

The technique you used (with the git extension) works, but was really created to be used with freestyle projects.  Pipeline has a better way to do it with the dir() step.

Mark Waite
  

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f6b55274-4823-47e3-b1a7-46892e9d3601%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/ZlxbJHRC2Dg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG_t7%2BvdWK0P1qovNV5zX7J71UEfoWsCxXkHaM8TZH%3D1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Chris Foran       | Senior Software Engineer
(617) 586-9962 | [hidden email] 

101 Huntington Ave, 17th Floor
Suite 1300 c/o 3Derm @ BCBSMA
Boston, MA 02199

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAACcGGUZssPMuxRNe_%2B-oCUuuVp-8hdMWBODKOg9xwOyHYv0bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.