Re: How to prevent concurrent builds across all branches in a multibranch pipeline project?

2017-08-14 Thread Mark Allison
Yes we have a database server for testing new database changes, and I want 
to serialise all database project builds across branches so they don't 
interfere. I will look into the lockable resources plugin.

Is there a way to tie an executor to a particular database server? For 
example have 10 executors and they will only run on against certain 
database servers.

On Monday, 14 August 2017 11:54:36 UTC+1, mpapo - Michael Pailloncy wrote:
>
> Why do you want to prevent this ? Do you have a shared resource for all 
> your builds ?
> If yes, I think that this plugin will fit your needs 
> https://wiki.jenkins.io/display/JENKINS/Lockable+Resources+Plugin 
>
> 2017-08-14 12:37 GMT+02:00 Mark Allison <marka...@gmail.com >
> :
>
>> I have tried to use 
>>
>> properties[(disableConcurrentBuilds)]
>>
>> but that only prevents concurrent builds within one branch in a 
>> multibranch pipeline project. Is there a way to prevent concurrent builds 
>> across all branches in a project?
>>
>> 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 jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/f91f57d6-e39a-4abd-93e0-1a016434cc9f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/f91f57d6-e39a-4abd-93e0-1a016434cc9f%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3b773487-e5c3-49c6-abb2-b046d20de256%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to prevent concurrent builds across all branches in a multibranch pipeline project?

2017-08-14 Thread Mark Allison
I have tried to use 

properties[(disableConcurrentBuilds)]

but that only prevents concurrent builds within one branch in a multibranch 
pipeline project. Is there a way to prevent concurrent builds across all 
branches in a project?

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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f91f57d6-e39a-4abd-93e0-1a016434cc9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to only build one directory in a pipeline job?

2017-06-15 Thread Mark Allison
It's still building both projects. Anyone got any ideas?

On Wednesday, 14 June 2017 14:36:06 UTC+1, Mark Allison wrote:
>
> I just noticed a potential bug.
>
> I changed these:
>
>Included Regions: Project1\/.+
>Excluded Regions: 
>
> On Wednesday, 14 June 2017 11:44:43 UTC+1, Mark Allison wrote:
>>
>> I have a github repo called multibranch-test with two sub-directories 
>> Project1, Project2.
>>
>> PS C:\Repos\multibranch-test> tree .
>> Folder PATH listing for volume Windows
>> Volume serial number is 2085-6D3D
>> C:\REPOS\MULTIBRANCH-TEST
>> ├───Project1
>> └───Project2
>>
>>
>> Each sub-directory has a Jenkinsfile and the code for that project.
>>
>> I Jenkins I have two multibranch pipeline jobs - one for Project1 and one 
>> for Project2. In the configuration for Project1 I don't want a push 
>> notification or polling to build Project1 if a commit was pushed in 
>> sub-directory for Project2.
>>
>> So in Project1 I have configured Additional Behaviours:
>> *Advanced clone behaviours*
>> Shallow clone is checked
>> *Sparse checkout path *is set to Project1
>> *Polling ignores commits in certain paths*
>>Included Regions: Project1/*
>>Excluded Regions: *
>>
>> *Build Configuration*
>> Script Path: Project1/Jenkinsfile
>>
>> What is happening is if I push a commit to master in sub-directory 
>> Project2, Project1 and Project2 jobs get built. I only want Project2 to 
>> build. Can someone point out what I'm doing wrong?
>>
>> Jenkinsfiles for both Projects are similar and look like:
>>
>> #!groovy
>> node {
>> stage ('checkout') {
>> checkout scm
>> }
>> stage ('build') {
>> dir ('Project1') {
>> bat 'powershell -Command gci'
>> bat 'powershell -Command gci env:'
>> bat 'powershell -File .\\Project1.ps1'
>> }
>> }
>>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2808c506-7e41-4e4a-8880-b806f337434d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to only build one directory in a pipeline job?

2017-06-14 Thread Mark Allison
I just noticed a potential bug.

I changed these:

   Included Regions: Project1\/.+
   Excluded Regions: 

On Wednesday, 14 June 2017 11:44:43 UTC+1, Mark Allison wrote:
>
> I have a github repo called multibranch-test with two sub-directories 
> Project1, Project2.
>
> PS C:\Repos\multibranch-test> tree .
> Folder PATH listing for volume Windows
> Volume serial number is 2085-6D3D
> C:\REPOS\MULTIBRANCH-TEST
> ├───Project1
> └───Project2
>
>
> Each sub-directory has a Jenkinsfile and the code for that project.
>
> I Jenkins I have two multibranch pipeline jobs - one for Project1 and one 
> for Project2. In the configuration for Project1 I don't want a push 
> notification or polling to build Project1 if a commit was pushed in 
> sub-directory for Project2.
>
> So in Project1 I have configured Additional Behaviours:
> *Advanced clone behaviours*
> Shallow clone is checked
> *Sparse checkout path *is set to Project1
> *Polling ignores commits in certain paths*
>Included Regions: Project1/*
>Excluded Regions: *
>
> *Build Configuration*
> Script Path: Project1/Jenkinsfile
>
> What is happening is if I push a commit to master in sub-directory 
> Project2, Project1 and Project2 jobs get built. I only want Project2 to 
> build. Can someone point out what I'm doing wrong?
>
> Jenkinsfiles for both Projects are similar and look like:
>
> #!groovy
> node {
> stage ('checkout') {
> checkout scm
> }
> stage ('build') {
> dir ('Project1') {
> bat 'powershell -Command gci'
> bat 'powershell -Command gci env:'
> bat 'powershell -File .\\Project1.ps1'
> }
> }
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2d93af03-096e-49ff-a66b-29672a53324e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set environment variable in multibranch pipeline?

2017-06-14 Thread Mark Allison
Thanks for the reply, but I need to set the variable outside the pipeline 
script similar to the Environment Injector plugin. Is there a way to do 
that?

On Tuesday, 13 June 2017 13:36:07 UTC+1, Kevin Burnett wrote:
>
> here's an example Jenkinsfile that sets an environment variable (REPO_URL) 
> that applies to all stages. you can also use the withEnv step to set an 
> environment variable for a certain block.
>
> pipeline {
>   agent { label 'docker' }
>   environment {
> REPO_URL = 'www.my.repo'
>   }
>   stages {
> stage('build') {
>   steps {
> sh 'env | grep REPO_URL'
>   }
> }
>   }
> }
>
> Jenkinsfiles apply to all branches in a repo, so that part is handled 
> implicitly.
>
> Hope this helps,
> KB
>
>
> On Tuesday, June 13, 2017 at 3:53:33 AM UTC-4, Mark Allison wrote:
>>
>> I have a Jenkins multibranch pipeline project and I want to set an 
>> environment variable for all branches. Is this possible? I could only see a 
>> way to do it with the environment injector plugin at the branch level. I 
>> want to be able to do this at the project level because I want new feature 
>> branches to automatically inherit some environment variables.
>>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/67fe426e-5c0d-4019-8972-d9ac24167fce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to only build one directory in a pipeline job?

2017-06-14 Thread Mark Allison
I have a github repo called multibranch-test with two sub-directories 
Project1, Project2.

PS C:\Repos\multibranch-test> tree .
Folder PATH listing for volume Windows
Volume serial number is 2085-6D3D
C:\REPOS\MULTIBRANCH-TEST
├───Project1
└───Project2


Each sub-directory has a Jenkinsfile and the code for that project.

I Jenkins I have two multibranch pipeline jobs - one for Project1 and one 
for Project2. In the configuration for Project1 I don't want a push 
notification or polling to build Project1 if a commit was pushed in 
sub-directory for Project2.

So in Project1 I have configured Additional Behaviours:
*Advanced clone behaviours*
Shallow clone is checked
*Sparse checkout path *is set to Project1
*Polling ignores commits in certain paths*
   Included Regions: Project1/*
   Excluded Regions: *

*Build Configuration*
Script Path: Project1/Jenkinsfile

What is happening is if I push a commit to master in sub-directory 
Project2, Project1 and Project2 jobs get built. I only want Project2 to 
build. Can someone point out what I'm doing wrong?

Jenkinsfiles for both Projects are similar and look like:

#!groovy
node {
stage ('checkout') {
checkout scm
}
stage ('build') {
dir ('Project1') {
bat 'powershell -Command gci'
bat 'powershell -Command gci env:'
bat 'powershell -File .\\Project1.ps1'
}
}

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/da14d74a-1786-4959-a9aa-0eef857282a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to set environment variable in multibranch pipeline?

2017-06-13 Thread Mark Allison
I have a Jenkins multibranch pipeline project and I want to set an 
environment variable for all branches. Is this possible? I could only see a 
way to do it with the environment injector plugin at the branch level. I 
want to be able to do this at the project level because I want new feature 
branches to automatically inherit some environment variables.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2a847c8e-78ac-44e0-837e-2679435449ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't see any GIT_ environment variables in my pipeline script

2017-06-01 Thread Mark Allison
Thanks. Is that the correct number? Doesn't look related to me, and there's 
only one comment. https://issues.jenkins-ci.org/browse/JENKINS-2100

On Thursday, 1 June 2017 12:12:59 UTC+1, Mark Waite wrote:
>
> JENKINS-2100 describes that bug / enhancement request.  The comments 
> include some possible work-around techniques.
>
> Mark Waite
>
> On Thu, Jun 1, 2017 at 4:28 AM Mark Allison <marka...@gmail.com 
> > wrote:
>
>> I am using the git plugin and use a Jenkinsfile, however none of the GIT 
>> environment variables are being set according to the git plugin 
>> documentation here: 
>> https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin in section 
>> Environment variables.
>>
>> Jenkins is installed on Windows Server 2012 R2 and I have this command 
>> after my checkout but none of the GIT variables are present:
>>
>> bat 'set'
>>
>> I can see the typical Jenkins ones like WORKSPACE, JENKINS_URL, etc
>>
>> I want access to these:
>>
>> GIT_LOCAL_BRANCH
>> GIT_URL
>>
>> -- 
>> 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 jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/a5a4a9a3-6ce6-4345-8367-8ecf06234e15%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/a5a4a9a3-6ce6-4345-8367-8ecf06234e15%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/65949ad0-cb91-47ff-be5e-6ed8c1adc37a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can't see any GIT_ environment variables in my pipeline script

2017-06-01 Thread Mark Allison
I am using the git plugin and use a Jenkinsfile, however none of the GIT 
environment variables are being set according to the git plugin 
documentation here: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin 
in section Environment variables.

Jenkins is installed on Windows Server 2012 R2 and I have this command 
after my checkout but none of the GIT variables are present:

bat 'set'

I can see the typical Jenkins ones like WORKSPACE, JENKINS_URL, etc

I want access to these:

GIT_LOCAL_BRANCH
GIT_URL

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a5a4a9a3-6ce6-4345-8367-8ecf06234e15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-31 Thread Mark Allison

>
>
>
> On Wed, May 24, 2017 at 9:01 AM Mark Allison <marka...@gmail.com 
> > wrote:
>
>> On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>>
>>>
>>> > On 24. May 2017, at 09:23, Mark Allison <marka...@gmail.com> wrote: 
>>> > 
>>> > I know I probably need to use sparse and/or shallow checkouts, but 
>>> can't seem to work out how to configure that in a Jenkins pipeline script 
>>> with the git plugin. Any ideas? 
>>>
>>> Use the 'checkout' step and specify Git SCM. That should allow you to 
>>> use all the options available in Git. Use the snippet generator for this. 
>>>
>>> Daniel, how does that show checking out a directory within a repo? Do 
>> you have something more concrete? The snippet generator does not show this.
>>
>
> Checking out to a subdirectory within a workspace requires that you nest 
> the checkout() step inside a dir("subdir-name") step.  The snippet 
> generator only shows one at a time (as far as I recall), so it won't show 
> you that combination.
>
> Refer to 
> https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43052/Jenkinsfile for 
> an example of that technique.
>

Hi Mark,

I am trying to checkout FROM a remote subdirectory within a repo not to a 
subdirectory. Does anyone know how to do that with the git plugin?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c90805be-fae3-4f26-bc85-c9e8c1f45e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Mark Allison
On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>
>
> > On 24. May 2017, at 09:23, Mark Allison <marka...@gmail.com 
> > wrote: 
> > 
> > I know I probably need to use sparse and/or shallow checkouts, but can't 
> seem to work out how to configure that in a Jenkins pipeline script with 
> the git plugin. Any ideas? 
>
> Use the 'checkout' step and specify Git SCM. That should allow you to use 
> all the options available in Git. Use the snippet generator for this. 
>
> Daniel, how does that show checking out a directory within a repo? Do you 
have something more concrete? The snippet generator does not show 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/56b64b99-70dc-4e38-9a6a-6ba29e28aa1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Mark Allison
Hi,

I have a large repo in GitHub Enterprise and need to clone a sub-directory 
from it on my Jenkins build server and just build that sub-directory. I am 
using a pipeline script and have this right now:

node {
stage ('checkout') {
git url: 'git@github.devops.mycompany.local:Org/MyLargeRepo.git'
}
}

What I want is to clone from 
github.devops.mycompany.local:Org/MyLargeRepo/path/to/subproject

I know I probably need to use sparse and/or shallow checkouts, but can't 
seem to work out how to configure that in a Jenkins pipeline script with 
the git plugin. Any ideas?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1800cb3e-750c-403a-8c5a-41ef6b7354b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What version of Jenkins was stage blocks introduced?

2017-01-27 Thread Mark Allison
I am building some pipeline projects and want to use the new stage blocks 
feature as the old way is now deprecated. 

e.g.

stage ('build') {
// my block of code to do the build
}


Trouble is our current Jenkins version (2.7) doesn't support stage blocks, 
does anyone know what version they were introduced? I'm being told by our 
DevOps admin that the earliest we can upgrade to is version 2.19.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/89f6c9b0-d7cc-48d7-bb05-9277ed25bb16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to echo the ${JOB_NAME} excluding the folder/

2017-01-26 Thread Mark Allison
I worked this out with 


def jobBaseName = "${env.JOB_NAME}".split('/').last()
echo "Job Name (excl. path): ${jobBaseName}"


Thanks Dirk for the code snippet that helped speed up the solution!


On Wednesday, 25 January 2017 10:38:32 UTC, Mark Allison wrote:
>
> I want to use the ${JOB_NAME} environment variable on my Windows slave, 
> however my project is in a folder in Jenkins and I want to exclude the 
> folder. How can I use %JOB_NAME% without the folder name?
>
> Thanks
> -- 
>
> Sent from my phone 
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9f19c840-62e3-40b9-b09e-26c5a04457cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to load variables from file into windows environment variables in Jenkins pipeline?

2017-01-26 Thread Mark Allison
Thanks, simply using double quotes instead of single works fine.

bat "echo MYKEY is %MYKEY%"



On Thu, 26 Jan 2017 at 14:25 Daniel Beck <m...@beckweb.net> wrote:

>
> > On 26.01.2017, at 12:57, Mark Allison <markalli...@gmail.com> wrote:
> >
> > How can I load variables from a file in a Windows job and have them
> loaded into the environment at run time?
>
> These are just Groovy variables. You didn't specify for them to be passed
> to launched processes' environment (as e.g. build parameters automatically
> are).
>
> withEnv(…) should work.
>
> env.VAR = 'value' probably too, but am not sure whether that's a
> recommended approach.
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/32EBB24D-996C-4CE4-8C1B-B1E8ECD6560F%40beckweb.net
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Sent from my phone

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAN9sP2ZjGkjBkC3nDfHTgYX%3D11H%3DjsVDNtaPMkjgzc%3D_bE6DrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to load variables from file into windows environment variables in Jenkins pipeline?

2017-01-26 Thread Mark Allison
I have the following Jenkinsfile

node  {
stage 'checkout'
deleteDir()
checkout scm

load 'LoadTheseVariables.txt'  

echo "MYKEY: ${MYKEY}"
echo "REPO: ${REPO}"

bat 'echo MYKEY is %MYKEY%'
bat 'echo REPO is %REPO%'
}


The file *LoadTheseVariables.txt* contains:

MYKEY="ThisIsTheKey"
REPO="ThisIsTheRepo"


The output of the Jenkins build is:

<..snip..>
[Pipeline] load
[Pipeline] { (LoadTheseVariables.txt)
[Pipeline] }
[Pipeline] // load
[Pipeline] echo
MYKEY: ThisIsTheKey
[Pipeline] echo
REPO: ThisIsTheRepo
[Pipeline] bat
[test] Running batch script

D:\Jenkins\workspace\test>echo MYKEY is  
MYKEY is 
[Pipeline] bat
[test] Running batch script

D:\Jenkins\workspace\test>echo REPO is  
REPO is 
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS


The Jenkins pipeline can see the variables but why can't my windows cmd 
environment see the variables? I even tried this step before the `bat` 
commands at the end: `bat 'refreshenv'` but that didn't reload the 
environment with those variables.

How can I load variables from a file in a Windows job and have them loaded 
into the environment at run time?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8dd050be-24cb-47ab-a3bb-4ff4ac88f0c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to echo the ${JOB_NAME} excluding the folder/

2017-01-25 Thread Mark Allison
Thanks for the reply. I am using a pipeline job, so can I just put this in
my pipeline script?

  JOB_BASE_NAME: JOB_NAME.split('/').last()





On Wed, 25 Jan 2017 at 10:59 Dirk Heinrichs <dhein...@opentext.com> wrote:

> Am 25.01.2017 um 11:38 schrieb Mark Allison:
>
> I want to use the ${JOB_NAME} environment variable on my Windows slave,
> however my project is in a folder in Jenkins and I want to exclude the
> folder. How can I use %JOB_NAME% without the folder name?
>
>
> In the job configuration, check "Prepare an environment for the run" and
> enter the following snippet under "Evaluated Groovy script" (may need
> Groovy plugin):
>
> return [
>   JOB_BASE_NAME: JOB_NAME.split('/').last()
> ]
>
> You can then use %JOB_BASE_NAME%.
>
> HTH...
>
> Dirk
> --
> *Dirk Heinrichs*
> Senior Systems Engineer, Delivery Pipeline
> OpenTextTM Discovery | Recommind
> *Email*: dirk.heinri...@recommind.com
> *Website*: www.recommind.de
>
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
>
> Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon
> Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB
> 10646
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/8601d9d6-1eb8-c31a-96e0-e267d05c43c7%40opentext.com
> <https://groups.google.com/d/msgid/jenkinsci-users/8601d9d6-1eb8-c31a-96e0-e267d05c43c7%40opentext.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Sent from my phone

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAN9sP2Y11ibDgucx_H6hBNhtCb%3D1nNN7qD4tU3fhb_7kYqMQBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Is it possible to echo the ${JOB_NAME} excluding the folder/

2017-01-25 Thread Mark Allison
I want to use the ${JOB_NAME} environment variable on my Windows slave,
however my project is in a folder in Jenkins and I want to exclude the
folder. How can I use %JOB_NAME% without the folder name?

Thanks
-- 

Sent from my phone

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAN9sP2boVT5_Ww6Y%2Bwu99np-y4j0rmGPvUKmOQfdgp-GuBN0VA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to trigger Jenkins build with parameters from Gitlab webhook?

2017-01-12 Thread Mark Allison
I don't think that's correct because when I invoke the job manually and set 
parameters, then they show up in the echo command. However, when I use the 
webhook from gitlab, the parameter values don't show up.

On Wednesday, 11 January 2017 23:23:09 UTC, Indra Gunawan (ingunawa) wrote:
>
> It should be “echo MYPARAM: ${env.MYPARAM}” in pipeline
>
>  
>
>  
>
> *From: *<jenkins...@googlegroups.com > on behalf of Mark 
> Allison <marka...@gmail.com >
> *Reply-To: *"jenkins...@googlegroups.com " <
> jenkins...@googlegroups.com >
> *Date: *Wednesday, January 11, 2017 at 2:58 PM
> *To: *Jenkins Users <jenkins...@googlegroups.com >
> *Subject: *Re: How to trigger Jenkins build with parameters from Gitlab 
> webhook?
>
>  
>
> I have defined it outside of the pipeline script in the *This project is 
> parameterised section*. Is that what you mean? I haven't defined anything 
> in the pipeline itself. Do I need to do it there? If so, what is the syntax? 
>
>  
>
> Thanks
>
> On Monday, 9 January 2017 18:41:36 UTC, David Karr wrote: 
>
> I'm not sure if this matters, but did you define that parameter in the 
> pipeline job? 
>
> On Mon, Jan 9, 2017 at 3:02 AM, Mark Allison <marka...@gmail.com> wrote: 
> > I have GitLab Community Edition 8.15.2 successfully trigger pipeline 
> > projects in Jenkins 2.32.1 using a webhook (but without any parameters). 
> I 
> > want the gitlab push to trigger a build with parameters but the 
> parameter 
> > value is null when it comes through to Jenkins so the build fails. 
> > 
> > The gitlab webhook looks like: 
> > 
> > 
> http://jenkins.server:8080/project/project-a/buildWithParameters?MYPARAM=foo 
> > 
> > 
> > In my pipeline project I echo the parameter value out with 
> > 
> > echo "MYPARAM: ${MYPARAM}" 
> > 
> > 
> > and it's not set to anything. Any ideas on where I've gone wrong? 
> > 
> > -- 
> > 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 jenkinsci-use...@googlegroups.com. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/jenkinsci-users/058c423d-150e-4f17-99ca-aa0dfc2c5d50%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 jenkinsci-use...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/bf8683f8-6f93-454f-9c2c-dbf867d70adb%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/bf8683f8-6f93-454f-9c2c-dbf867d70adb%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c0e47c12-4489-4c48-8ef9-c328dfd94a5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to trigger Jenkins build with parameters from Gitlab webhook?

2017-01-11 Thread Mark Allison
I have defined it outside of the pipeline script in the *This project is 
parameterised section*. Is that what you mean? I haven't defined anything 
in the pipeline itself. Do I need to do it there? If so, what is the syntax?

Thanks

On Monday, 9 January 2017 18:41:36 UTC, David Karr wrote:
>
> I'm not sure if this matters, but did you define that parameter in the 
> pipeline job? 
>
> On Mon, Jan 9, 2017 at 3:02 AM, Mark Allison <marka...@gmail.com 
> > wrote: 
> > I have GitLab Community Edition 8.15.2 successfully trigger pipeline 
> > projects in Jenkins 2.32.1 using a webhook (but without any parameters). 
> I 
> > want the gitlab push to trigger a build with parameters but the 
> parameter 
> > value is null when it comes through to Jenkins so the build fails. 
> > 
> > The gitlab webhook looks like: 
> > 
> > 
> http://jenkins.server:8080/project/project-a/buildWithParameters?MYPARAM=foo 
> > 
> > 
> > In my pipeline project I echo the parameter value out with 
> > 
> > echo "MYPARAM: ${MYPARAM}" 
> > 
> > 
> > and it's not set to anything. Any ideas on where I've gone wrong? 
> > 
> > -- 
> > 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 jenkinsci-use...@googlegroups.com . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/jenkinsci-users/058c423d-150e-4f17-99ca-aa0dfc2c5d50%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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/bf8683f8-6f93-454f-9c2c-dbf867d70adb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Jenkinsfile in pipeline builds?

2017-01-11 Thread Mark Allison
Actually this works fine, ignore. I had misconfigured something.

On Wednesday, 11 January 2017 20:10:36 UTC, Mark Allison wrote:
>
> I have a pipeline build and I want to move it to source control. I've 
> copied out the script from the the project into a Jenkinsfile and added it 
> to git. In my pipeline I have code like this:
>
> #!groovy​
> node {
>
> stage('checkout') {
>
> deleteDir()
> git 'http://git.server/markallison/my-project.git'
> }
> 
> stage('build') {
> // build code
>
>
> }
>
>
> ... etc
>
> I like to have a clean workspace every time the build runs, so how do I do 
> this without having to have a separate project for my Jenkinsfile? 
>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7c6c8d1a-7ff1-41bb-b329-8c6e580d99ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use Jenkinsfile in pipeline builds?

2017-01-11 Thread Mark Allison
I have a pipeline build and I want to move it to source control. I've 
copied out the script from the the project into a Jenkinsfile and added it 
to git. In my pipeline I have code like this:

#!groovy​
node {

stage('checkout') {

deleteDir()
git 'http://git.server/markallison/my-project.git'
}

stage('build') {
// build code


}

   
... etc

I like to have a clean workspace every time the build runs, so how do I do 
this without having to have a separate project for my Jenkinsfile? 
   

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0cf05e7f-0f14-4f5f-94d6-0995b33ac500%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to trigger Jenkins build with parameters from Gitlab webhook?

2017-01-09 Thread Mark Allison
I have GitLab Community Edition 8.15.2 successfully trigger pipeline 
projects in Jenkins 2.32.1 using a webhook (but without any parameters). I 
want the gitlab push to trigger a build with parameters but the parameter 
value is null when it comes through to Jenkins so the build fails.

The gitlab webhook looks like:

http://jenkins.server:8080/project/project-a/buildWithParameters?MYPARAM=foo


In my pipeline project I echo the parameter value out with

echo "MYPARAM: ${MYPARAM}"


and it's not set to anything. Any ideas on where I've gone wrong?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/058c423d-150e-4f17-99ca-aa0dfc2c5d50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any PowerShell people can help with DSC in Jenkins?

2017-01-03 Thread Mark Allison
Running Jenkins as a 64-bit process solved the issue. 
See http://stackoverflow.com/a/34030153/38211

On Tuesday, 3 January 2017 11:54:23 UTC, Mark Allison wrote:
>
> I have a Windows Server 2016 Jenkins build box. I want to run some 
> powershell in a Jenkins job.
>
> As a test I have set the job to do this in a Execute Windows batch 
> command build step:
>
> powershell -command Get-DscResource -module xhyper-v
>
>
> I get this output:
>
> D:\Jenkins\workspace\build-windows-server-2016-corepowershell 
> -command 
> Get-DscResource -module xhyper-v 
> WARNING: There are no modules present in the system with the given 
> module specification.
>
>
> I even tried installing the PowerShell plugin and running it in a 
> Powershell build step and I get the same result.
>
> If I RDP onto the box and log on as the jenkins service account and open a 
> cmd.exe window and run 
> powershell -command Get-DscResource -module xhyper-v
>
> I get this output:
>
> C:\Users\svc_jenkinspowershell -command get-dscresource -module 
> xhyper-v
> 
> ImplementedAs   Name  ModuleName 
> VersionProperties
> -     -- 
> -----
> PowerShell  xVHD  xHyper-V   
> 3.6.0.0{Name, Path, DependsOn, Ensure...}
> PowerShell  xVhdFile  xHyper-V   
> 3.6.0.0{FileDirectory, VhdPath, CheckSu...
> PowerShell  xVMHyperV xHyper-V   
> 3.6.0.0{Name, VhdPath, DependsOn, Enabl...
> PowerShell  xVMSwitch xHyper-V   
> 3.6.0.0{Name, Type, AllowManagementOS, ...
>
>
>
> Any ideas why Get-DscResource can't find xHyper-V module when run from a 
> Jenkins job?
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/31a15873-1a99-4d2b-864f-897ee34aa816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Any PowerShell people can help with DSC in Jenkins?

2017-01-03 Thread Mark Allison
I have a Windows Server 2016 Jenkins build box. I want to run some 
powershell in a Jenkins job.

As a test I have set the job to do this in a Execute Windows batch 
command build step:

powershell -command Get-DscResource -module xhyper-v


I get this output:

D:\Jenkins\workspace\build-windows-server-2016-corepowershell -command 
Get-DscResource -module xhyper-v 
WARNING: There are no modules present in the system with the given 
module specification.


I even tried installing the PowerShell plugin and running it in a 
Powershell build step and I get the same result.

If I RDP onto the box and log on as the jenkins service account and open a 
cmd.exe window and run 
powershell -command Get-DscResource -module xhyper-v

I get this output:

C:\Users\svc_jenkinspowershell -command get-dscresource -module 
xhyper-v

ImplementedAs   Name  ModuleName   
  VersionProperties
-     --   
  -----
PowerShell  xVHD  xHyper-V 
  3.6.0.0{Name, Path, DependsOn, Ensure...}
PowerShell  xVhdFile  xHyper-V 
  3.6.0.0{FileDirectory, VhdPath, CheckSu...
PowerShell  xVMHyperV xHyper-V 
  3.6.0.0{Name, VhdPath, DependsOn, Enabl...
PowerShell  xVMSwitch xHyper-V 
  3.6.0.0{Name, Type, AllowManagementOS, ...



Any ideas why Get-DscResource can't find xHyper-V module when run from a 
Jenkins job?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/580b16bd-9fcf-48f1-8757-add131ae0d89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.