Re: Script result interpreted a a command to execute?

2018-08-26 Thread Idan Adar
Thanks Slide!

On Sun, Aug 26, 2018 at 4:25 PM Slide  wrote:

> It's because your shell command has $() around it. This will try and eval
> the subshell value. You don't need the $() at all
>
> On Sun, Aug 26, 2018, 03:44 Idan Adar  wrote:
>
>> The following block fails... appreciate any insights:
>>
>> workerVersion = sh(script:"\$(ic cs workers ${clusterName} --json | jq
>> -r .[0].kubeVersion)", returnStdout: true).trim() // This returns
>> "1.9.9.1522"
>> slackSend (channel: "certmgr-health", color: '#199515', message: 
>> "*$JOB_NAME*,
>> <$BUILD_URL|build #$BUILD_NUMBER>: _${clusterName}'s_ worker nodes
>> successfully upgraded to ${workerVersion}.")
>>
>> The *slackSend* never happens because the following error happens:
>>
>> ++ ic cs workers  --json
>> ++ jq -r '.[0].kubeVersion'
>> + 1.9.9_1522
>> /var/jenkins/workspace/Worker Nodes Upgrader - 
>> Production@tmp/durable-1e1c34b9/script.sh: line 2: 1.9.9_1522: command not 
>> found
>>
>> --
>> 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/714b1868-0a6e-4fd3-b131-ab7bebcaa104%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/714b1868-0a6e-4fd3-b131-ab7bebcaa104%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 a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/X-2sV-aS7QE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAPiUgVfSTEntQ8qmD5LtJnQ%2BNyx5rsjuvq-1KEDxSDsfXCsfJA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfSTEntQ8qmD5LtJnQ%2BNyx5rsjuvq-1KEDxSDsfXCsfJA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
*Idan Adar*

-- 
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/CAA6x3wfAtPi9YHy5EL2U_p3AX5ZFgR9RcN7jeigfLD0_g0Aayw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Script result interpreted a a command to execute?

2018-08-26 Thread Idan Adar
The following block fails... appreciate any insights:

workerVersion = sh(script:"\$(ic cs workers ${clusterName} --json | jq -r 
.[0].kubeVersion)", returnStdout: true).trim() // This returns "1.9.9.1522"
slackSend (channel: "certmgr-health", color: '#199515', message: "*$JOB_NAME*, 
<$BUILD_URL|build #$BUILD_NUMBER>: _${clusterName}'s_ worker nodes 
successfully upgraded to ${workerVersion}.")

The *slackSend* never happens because the following error happens:

++ ic cs workers  --json
++ jq -r '.[0].kubeVersion'
+ 1.9.9_1522
/var/jenkins/workspace/Worker Nodes Upgrader - 
Production@tmp/durable-1e1c34b9/script.sh: line 2: 1.9.9_1522: command not found

-- 
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/714b1868-0a6e-4fd3-b131-ab7bebcaa104%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to detect TIMEOUT event and act upon it?

2018-03-19 Thread Idan Adar
In declarative pipeline there is also the option for a script {} block 
where "traditional" Jenkins scripting can be done, so what you're 
suggesting can be done there. However, I'm not looking to adding the user 
prompt like in your example, which seems like SYSTEM depends on, in your 
example.

Do you have an example without this?
Also, your example is not using the exception try/catch approach in my last 
comment.

On Monday, March 19, 2018 at 1:47:19 PM UTC+2, Victor Martinez wrote:
>
> This is indeed what I did:
> - https://groups.google.com/d/msg/jenkinsci-users/upVzT3SOZy8/N5iguMZsAgAJ
>
> But using scripted pipelines, it looks like you cannot use try/catch 
> within the declarative pipeline but post steps (
> https://jenkins.io/doc/book/pipeline/syntax/#post) but the timeout 
> triggers a failure therefore you need to run something like
>
> pipeline {
> agent any
> options {
> timeout(time: 1, unit: 'SECONDS')
>   }
> stages {
> ...
> }
> post { 
> failure { 
> // Catch failures and even the tiemout one
> }
> }
> }
>
>
> I don't know whether the declarative post step allows a kind of more 
> accurate granularity about what caused that particular failure... 
>
> Cheers
>

-- 
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/b68abf28-a3c8-4455-b570-9d3c5aced42a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to detect TIMEOUT event and act upon it?

2018-03-19 Thread Idan Adar
According to the Jenkins documentation for timeout, there is an exception
thrown:
Executes the code inside the block with a determined time out limit. If the
time limit is reached, an exception is thrown, which leads in aborting the
build (unless it is caught and processed somehow).


How do I catch the specific exception for *timeout*? the parameter inside
catch is not specific enough for it.

try {// some stages for the workflow}
catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e){
}


On Mon, Mar 19, 2018 at 12:48 PM, Victor Martinez <
victormartinezru...@gmail.com> wrote:

> I did play with that sometime ago but I don't have access to those
> pipelines anymore... The below article might help you out:
> - https://support.cloudbees.com/hc/en-us/articles/
> 226554067-Pipeline-How-to-add-an-input-step-with-timeout-
> that-continues-if-timeout-is-reached-using-a-default-value
>
> Although it's not about the declarative pipeline but the scripted one. but
> likely it works for your use case.
>
> Cheers
>
> --
> 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/-ifvFnu_Un4/unsubscribe.
> To unsubscribe from this group and all its topics, 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/7b34bb58-d0e0-4d38-8d47-eff33f4839c8%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/7b34bb58-d0e0-4d38-8d47-eff33f4839c8%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Idan Adar*

-- 
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/CAA6x3wdK%3DsFpUtcuGU6T7FDqTHOHN%2BpfjX9nKL6SRzRs8qFu%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Is it possible to detect TIMEOUT event and act upon it?

2018-03-18 Thread Idan Adar
In a declarative pipeline's Jenkinsfile it is possible to add a timeout 
option both global as well as override it per stage. E.g.: 

stage ("SonarQube analysis") {
  options {
timeout(time: 5, unit: 'MINUTES')
  }


  steps {
script {
  STAGE_NAME = "SonarQube analysis"


  withSonarQubeEnv('SonarQube') {
sh "../../../sonar-scanner/bin/sonar-scanner"
  }


  // Check whether coverage threshold is met, otherwise fail the job.
  def qualitygate = waitForQualityGate()
  if (qualitygate.status != "OK") {
slackSend (
  color: '#F01717',
  message: "*$JOB_NAME*: <$BUILD_URL|Build #$BUILD_NUMBER>, 
'$STAGE_NAME' stage failed."
)
error "Pipeline aborted due to quality gate coverage failure: 
${qualitygate.status}"
  }
}
  }
}


Is it possible to make some action in case the timeout was reached? to 
detect it somehow?
In case of a timeout I would like to send a Slack notification.

Right now what happens is that the scanning reached 5 minutes and thus 
never entered the if statement; in which case there is "silent failure".

-- 
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/20346cd1-b31b-46e8-8c74-c290e0bb4cd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can I load a declarative Jenkinsfile via a shared library?

2018-01-10 Thread Idan Adar
Any prerequisites?

On Wed, Jan 10, 2018 at 8:46 PM, Daniel Butler <danielsimonbut...@gmail.com>
wrote:

> I believe this was added a month or two ago.
>
> On 10 Jan 2018 6:33 pm, "Idan Adar" <i...@adar.me> wrote:
>
>> Is the following feasible?
>>
>> 1. Setup a Shared Library in the Jenkins settings
>> 2. In every repository requiring the Jenkinsfile (it is the same one used
>> in multiple repos...), use the following in the Jenkinsfile of the
>> repository instead:
>>
>> (based on https://dev.to/jalogut/centralise-jenkins-pipelines-confi
>> guration-using-shared-libraries)
>>
>> @Library("my-shared-library") _
>> standardPipeline {
>> // properties passed to the shared library
>> }
>>
>> 3. In the Shared Library, use this:
>>
>> def call(body) {
>>   def config = [:]
>>   body.resolveStrategy = Closure.DELEGATE_FIRST
>>   body.delegate = config
>>   body()
>>
>>   pipeline {
>>   // the declarative pipeline as-is as it was previously used in a
>> Jenkinsfile in a repository
>>   }
>> }
>>
>> --
>> 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/ms
>> gid/jenkinsci-users/c878f51d-8097-43fb-a0f5-a95b471f0184%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/c878f51d-8097-43fb-a0f5-a95b471f0184%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 a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/EG1BLWQq1Mo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAO37hbi18NX6yiGCj8_7AApgY0UTt4Q7_eXJcH26%
> 3DQx9NtWBug%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAO37hbi18NX6yiGCj8_7AApgY0UTt4Q7_eXJcH26%3DQx9NtWBug%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Idan Adar*

-- 
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/CAA6x3wf69HCQo%3DeYaE%3DR_41%2BCWSN3xQqPRokp8ETUeqkJwpdoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Can I load a declarative Jenkinsfile via a shared library?

2018-01-10 Thread Idan Adar
Is the following feasible?

1. Setup a Shared Library in the Jenkins settings
2. In every repository requiring the Jenkinsfile (it is the same one used 
in multiple repos...), use the following in the Jenkinsfile of the 
repository instead:

(based 
on 
https://dev.to/jalogut/centralise-jenkins-pipelines-configuration-using-shared-libraries)

@Library("my-shared-library") _
standardPipeline {
// properties passed to the shared library
} 

3. In the Shared Library, use this: 

def call(body) {
  def config = [:]
  body.resolveStrategy = Closure.DELEGATE_FIRST
  body.delegate = config
  body()

  pipeline {
  // the declarative pipeline as-is as it was previously used in a 
Jenkinsfile in a repository
  }
}

-- 
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/c878f51d-8097-43fb-a0f5-a95b471f0184%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can shell script be executed from an Extensible Choice -> Groovy Script?

2017-11-09 Thread Idan Adar
In a paramatized job that displays to the user some options before 
executing it, I also need to show a "dynamic" dropdown. I believe the way 
to do this is using the Extensible Choice option.
Can I execute a shell script in this option's Groovy Script textarea?

The below does not seem to be executed when starting the job and the job UI 
is displayed.

sh """
bx login -a https://... -c ... -u ... -p ...
bx cs clusters | tail -n +3 | cut -d ' ' -f 1 > clusters.txt"

def clusters = readFile('clusters.txt').trim()
"rm -rf clusters.txt"
clusters

-- 
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/a085cc05-e47b-4c41-9e04-7c7bca15ed32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can shell variables be read outside of the shell block while in a script block?

2017-10-14 Thread Idan Adar
script {
...
...
sh """
X = ...
"""
}


Can X be read directly, outside of the sh block?
Right now I'm echoing X to file (echo X > myfile.txt) and then read the 
contents of the file (def y = readFile("myfile.txt).trim).

There has to be a better way to do 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/f1625527-a748-4a34-9dca-f83baa5cd4cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing a variable in shell

2017-09-28 Thread Idan Adar
Indeed. This is long resolve. 
Thanks!

On Sunday, July 30, 2017 at 2:56:47 PM UTC+3, Idan Adar wrote:
>
> Given the following script block in a stage (Declarative pipeline), how 
> can I access the repoName variable?
>
> stages {
> stage("...") {
> script {
> for (String repoName: repoList) {
> sshagent (credentials: [
> 'e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
> sh """
> git clone -b master git@.com:/repoName.git
> cd repoName
> 
> """
> }
> }
>  }
>  }
> }
>
>

-- 
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/6f54fe01-dd14-482b-ac72-635533359c09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: String manipulation in sh block

2017-09-24 Thread Idan Adar
Okay, got it at last.
The backslashes weren't needed.

version=$(jq \".version\" package.json | tr -d '\"')



On Sunday, September 24, 2017 at 3:27:15 PM UTC+3, Idan Adar wrote:

> Appreciate help with getting the following block right (I always get 
> confused with strings and double/single/escaped quotes):
>
> Right now the below puts the message "Bump version number (${version}) 
> [ci skip]" in the commit message.
> The wanted result is for ${version} to actually be the extracted version 
> number rather than the variable name as-is...
>
> sshagent (credentials: ['...']) {
>sh '''
>   git clone -b master git@github.***.git
>   ...
>   ...
>   version=$(jq \".version\" package.json | tr -d '\"')
>   git commit -am "Bump version number (${version}) [ci skip]"
>   git push origin master
>'''
> }
>
>

-- 
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/8b88c81a-9f63-4f9e-821b-8aba0dee1dd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


String manipulation in sh block

2017-09-24 Thread Idan Adar
Appreciate help with getting the following block right (I always get 
confused with strings and double/single/escaped quotes):

Right now the below puts the message "Bump version number (${version}) [ci 
skip]" in the commit message.
The wanted result is for ${version} to actually be the extracted version 
number rather than the variable name as-is...

sshagent (credentials: ['...']) {
   sh '''
  git clone -b master git@github.***.git
  ...
  ...
  version=$(jq \".version\" package.json | tr -d '\"')
  git commit -am "Bump version number (${version}) [ci skip]"
  git push origin master
   '''
}

-- 
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/154e8398-5643-4919-9029-71e263d94f00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
The solution was to add "PR*" to the filter list.

-- 
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/08cad4ce-c181-4a37-82fd-c81f089a107b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
*Discover pull requests from origin*: Merging the pull request with the 
current target branch revision
*Filter by name (with wildcards)*: develop master
*Discover branches*: All branches

I didn't set the "..forks" option because we don't work with forks.
I have now changed "Discover branches" to match yours.

After scanning the repository it says:

Checking pull-requests...

Checking pull request #216 
<https://github.ibm.com/security-services/certificate-management-servicebroker/pull/216>

  1 pull requests were processed


But there's no job starting.
Tried also closing and re-opening the PR, which typically sends a request 
again to Jenkins, but this also didn't trigger the job.

On Friday, September 22, 2017 at 1:26:23 PM UTC+3, Stephen Connolly wrote:
>
> What behaviours have you configured?
> [image: Inline images 1]
> If you didn't configure "discover from origin" then it won't discover from 
> origin
>
> (likely the upgrade/rollback/upgrade screwed up the auto-migration)
>
> On 22 September 2017 at 03:18, Idan Adar <id...@adar.me > 
> wrote:
>
>> Why is it saying this?
>>
>> >  Checking pull request #215 
>> <https://github.ibm.com/security-services/certificate-management-servicebroker/pull/215>
>>
>> > Submitted from origin repository, skipping
>>
>>
>> I have a repository and in this repository I have two branches: develop and 
>> master.
>>
>> I created another branch, "devops", from which I make a pull request to 
>> develop.
>>
>>
>> I do want this PR discovered, and have the Jenkinsfile executed.
>>
>> -- 
>> 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/301ac6bc-4211-4bab-b4c0-b06443807d07%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/301ac6bc-4211-4bab-b4c0-b06443807d07%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/4bcf3ec4-febb-4c72-9891-88547bf74235%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
Why is it saying this?

>  Checking pull request #215 


> Submitted from origin repository, skipping


I have a repository and in this repository I have two branches: develop and 
master.

I created another branch, "devops", from which I make a pull request to develop.


I do want this PR discovered, and have the Jenkinsfile executed.

-- 
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/301ac6bc-4211-4bab-b4c0-b06443807d07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
Thanks Daniel.


Now that jobs can run again, I'm back to the original topic of upgrading 
the plugins...
I see that the job configuration looks different in multibranch pipelines 
and now PRs opened in GitHub are no longer automatically starting...

On Friday, September 22, 2017 at 12:40:37 PM UTC+3, Daniel Beck wrote:
>
>
> > On 22. Sep 2017, at 11:33, Idan Adar <id...@adar.me > 
> wrote: 
> > 
> > credentials("${JENKINSBOT_USERNAME_PASSWORD}") 
>
> This is equivalent to: 
>
> credentials(JENKINSBOT_USERNAME_PASSWORD) 
>

-- 
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/e9c54db2-908d-4403-ac73-f17d0350340b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
Okay, the problem was lines like this:

JENKINSBOT = credentials('${JENKINSBOT_USERNAME_PASSWORD}')

In v2.46 this worked.
Once I upgraded to 2.73 I had to change it to:

JENKINSBOT = credentials("${JENKINSBOT_USERNAME_PASSWORD}")




-- 
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/8465056e-d071-4d67-89d1-9a7c36150e16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
And yes, I do have a backup from yesterday. If all fails I'll ask to 
restore to yesterday...

-- 
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/24c074e8-6ee2-409b-8dff-d90f0d0db904%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
)
at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:32)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:32)
at 
org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
at 
org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at 
jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE


On Fri, Sep 22, 2017 at 10:45 AM, Daniel Beck <m...@beckweb.net> wrote:

>
> > On 22. Sep 2017, at 09:45, Daniel Beck <m...@beckweb.net> wrote:
> >
> > This is unrelated to GHBS, rather looks like a problem in Declarative
> Pipeline. Possibly related to yesterday's release of version 1.2.
>
> Oops, didn't notice there were further responses. Sorry about that.
>
> --
> 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/gs37LHzjIcQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CC2B4CB9-2D1C-4E56-802E-4328F42EE730%40beckweb.net.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Idan Adar*

-- 
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/CAA6x3wcBavz0wnbD9Omp%3D9mhmj5QFTYHkRWnLeq_huFHBNF2EQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-22 Thread Idan Adar
I went back to version 1.1.8 (instead of 1.2) of pipeline model definition, 
but that didn't help either...

Stephen, what are my options here?

On Friday, September 22, 2017 at 8:54:22 AM UTC+3, Stephen Connolly wrote:
>
> That stack trace is from a different plugin.
>
> Pipeline model definition.
>
> Upgrading updated some other plugins, and *those* other plugins are 
> causing the stack trace
>
> On Fri 22 Sep 2017 at 06:51, Idan Adar <id...@adar.me > 
> wrote:
>
>> The plug-in author is stephen connolly, but I'm not sure how to contact 
>> him...
>>
>> The plug-in release notes didn't mention info that could help me AFAICT.
>> I'm not sure how to manually restore old settings and what those should 
>> be...
>>
>> Appreciate any help anyone could provide is this totally brings down the 
>> pipeline... :(
>>
>>
>> On Friday, September 22, 2017 at 8:48:22 AM UTC+3, Idan Adar wrote:
>>>
>>> I had the unfortunate luck of upgrading said plug-in. Now any job fails 
>>> with the error below.
>>> The upgrade warning does say:
>>> Warning: the new version of this plugin claims to use a different 
>>> settings format than the installed version. Jobs using this plugin may need 
>>> to be reconfigured, and/or you may not be able to cleanly revert to the 
>>> prior version without manually restoring old settings. Consult the plugin 
>>> release notes for details.
>>>
>>> However it is not mentioned how one _can_ resolve this issue once it 
>>> happened...
>>> I downgraded back to 2.0.8 which didn't help.
>>>
>>> java.lang.AbstractMethodError: 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidatorImpl.validateElement(Lorg/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage;Z)Z
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStage.validate(ModelASTStage.java:78)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages.validate(ModelASTStages.java:41)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages.validate(ModelASTStages.java:35)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef.validate(ModelASTPipelineDef.java:64)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef$validate.call(Unknown
>>>  Source)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser.parse(ModelParser.groovy:204)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser$parse.callCurrent(Unknown
>>>  Source)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser.parse(ModelParser.groovy:91)
>>> at 
>>> org.jenkinsci.plugins.pipeline.modeldefinition.parser.GroovyShellDecoratorImpl$1.call(GroovyShellDecoratorImpl.java:46)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
>>> at 
>>> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
>>> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
>>> at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
>>> at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129)
>>> at 
>>> org.jenkinsci.plugins.workflow.cps.Cps

GitHub Branch Source Plugin - upgrade messed up jobs

2017-09-21 Thread Idan Adar
I had the unfortunate luck of upgrading said plug-in. Now any job fails 
with the error below.
The upgrade warning does say:
Warning: the new version of this plugin claims to use a different settings 
format than the installed version. Jobs using this plugin may need to be 
reconfigured, and/or you may not be able to cleanly revert to the prior 
version without manually restoring old settings. Consult the plugin release 
notes for details.

However it is not mentioned how one _can_ resolve this issue once it 
happened...
I downgraded back to 2.0.8 which didn't help.

java.lang.AbstractMethodError: 
org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidatorImpl.validateElement(Lorg/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage;Z)Z
at 
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStage.validate(ModelASTStage.java:78)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages.validate(ModelASTStages.java:41)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages.validate(ModelASTStages.java:35)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef.validate(ModelASTPipelineDef.java:64)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTPipelineDef$validate.call(Unknown
 Source)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser.parse(ModelParser.groovy:204)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser$parse.callCurrent(Unknown
 Source)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.parser.ModelParser.parse(ModelParser.groovy:91)
at 
org.jenkinsci.plugins.pipeline.modeldefinition.parser.GroovyShellDecoratorImpl$1.call(GroovyShellDecoratorImpl.java:46)
at 
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at 
org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129)
at 
org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123)
at 
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:517)
at 
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:480)
at 
org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:253)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
Finished: FAILURE



-- 
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/2d57f4bc-39b8-400a-8d0a-e3f01a5b6fcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass paramater to process environment variable?

2017-09-21 Thread Idan Adar
Thanks Robert. However I'm not sure yet how this helps in solving the next 
step here. Namely:

> How can I then use this in combination with: 
https://github.com/jansepar/node-jenkins-api#build_with_params 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fjansepar%2Fnode-jenkins-api%23build_with_params=D=1=AFQjCNEuXKpvHxclHo7p8aWqWiMf2nOymw>
> ... the end goal is to trigger the job remotely with a parameter, and the 
parameter's value then needs to be used as an environment variable...

On Friday, September 22, 2017 at 6:42:35 AM UTC+3, Robert Hales wrote:
>
> The Parameters can be defined in the pipeline, or in the job 
> configuration, but if you define it in the pipeline, it will update the job 
> configuration the first time it runs. So when you add the parameters to the 
> pipeline, and have none configured in your job, your Build Now button will 
> still be Build Now. Run it once, things may fail and die. But now your job 
> will be configured with the parameters, and the Build Now link now says 
> Build with Parameters. I think it is cleaner to add any config possible in 
> the pipeline code. Also, if you change any property from the pipeline code, 
> it will change all properties in the job config, so if it wasn't specified 
> in the pipeline code, it will disable. So, for example, if you configure 
> the build discarder in the project, then configure parameters in the 
> pipeline code, you will lose your build discarder when the job runs. 
>
> To access the parameters in your pipeline, use the params object: 
>
> parameters {
> string(defaultValue: 'master', description: 'Git Branch', name: 
> 'gitBranch')
> }
>
>
> ...
>
>
> myProperty = "${params.gitBranch}"
>
>
>
>
> On Wednesday, September 20, 2017 at 1:29:32 AM UTC-6, Idan Adar wrote:
>>
>> The following is my current pipeline:
>>
>> stage ("My Stage") {  
>>  environment {
>> cloudcerts_iamConfig_preprod = credentials(
>> '${cloudcerts_iamConfig_preprod}')
>>  }
>>  
>>  steps {
>>// Setup packages and run tests
>>sh '''
>>   npm install
>>   npm test
>>'''
>>  }
>> }
>>
>> During runtime of the tests, "cloudcerts_iamConfig_preprod" is available 
>> via process.env and everything is great.
>> My requirement now however is to add another property dynamically.
>>
>> To do this I ticked the checkbox "This project is parameterized" > String 
>> parameter, and provided a name and default value (myStringParameter, "xxx").
>> I then added to "environments":
>>
>> myProperty = ${myStringParameter)
>>
>> However when the tests run process.env.myProperty returns "undefined".
>> Is this the right way to pass the parameter? Is there a different way?
>>
>

-- 
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/8b4bed06-9b03-41cb-bee4-432bed087390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass paramater to process environment variable?

2017-09-20 Thread Idan Adar
Okay.
How can I then use this in combination 
with: https://github.com/jansepar/node-jenkins-api#build_with_params

I used parameters as a way to test getting a value "externally".
With this working, the end goal is to trigger the job remotely with a 
parameter, and the parameter's value then needs to be used as an 
environment variable...

Can this be done with the Parameters pipeline option you've mentioned?

On Wednesday, September 20, 2017 at 12:21:05 PM UTC+3, Steven Foster wrote:
>
> You should define the parameters in the pipeline also:
> https://jenkins.io/doc/book/pipeline/syntax/#parameters
>
> currently there is some disconnect in the project configuration UI for 
> pipeline jobs, many of the options there need to actually be defined in the 
> pipeline.
>
> On Wednesday, September 20, 2017 at 8:29:32 AM UTC+1, Idan Adar wrote:
>>
>> The following is my current pipeline:
>>
>> stage ("My Stage") {  
>>  environment {
>> cloudcerts_iamConfig_preprod = credentials(
>> '${cloudcerts_iamConfig_preprod}')
>>  }
>>  
>>  steps {
>>// Setup packages and run tests
>>sh '''
>>   npm install
>>   npm test
>>'''
>>  }
>> }
>>
>> During runtime of the tests, "cloudcerts_iamConfig_preprod" is available 
>> via process.env and everything is great.
>> My requirement now however is to add another property dynamically.
>>
>> To do this I ticked the checkbox "This project is parameterized" > String 
>> parameter, and provided a name and default value (myStringParameter, "xxx").
>> I then added to "environments":
>>
>> myProperty = ${myStringParameter)
>>
>> However when the tests run process.env.myProperty returns "undefined".
>> Is this the right way to pass the parameter? Is there a different way?
>>
>

-- 
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/5227f101-4edb-4add-8c67-3d7f556bdf77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to pass paramater to process environment variable?

2017-09-20 Thread Idan Adar
The following is my current pipeline:

stage ("My Stage") {  
 environment {
cloudcerts_iamConfig_preprod = credentials(
'${cloudcerts_iamConfig_preprod}')
 }
 
 steps {
   // Setup packages and run tests
   sh '''
  npm install
  npm test
   '''
 }
}

During runtime of the tests, "cloudcerts_iamConfig_preprod" is available 
via process.env and everything is great.
My requirement now however is to add another property dynamically.

To do this I ticked the checkbox "This project is parameterized" > String 
parameter, and provided a name and default value (myStringParameter, "xxx").
I then added to "environments":

myProperty = ${myStringParameter)

However when the tests run process.env.myProperty returns "undefined".
Is this the right way to pass the parameter? Is there a different way?

-- 
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/3bb3b123-046a-4c6b-8a7e-655b76a2b5a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Solid approach to starting Jenkins jobs from Slack?

2017-08-10 Thread Idan Adar
I've scored the web, tried all sort of Hubot plug-ins, Slash Command 
integration in Slack, but it's pretty bad... they either don't work, don't 
support multi-branch jobs, etc...
Has anyone found a solid way to start Jenkins jobs from Slack and can share 
with the rest of us?

-- 
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/66003175-a92f-46f6-bdc7-10b71f8d5802%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing a variable in shell

2017-08-08 Thread Idan Adar
Damn. I had those there before...

Thanks. The combination of the more standard loop and the return of the 
double-quotes now made it work.

On Tuesday, August 8, 2017 at 6:37:28 PM UTC+3, Björn Pedersen wrote:
>
>
>  
> sh '''
>  
>
>^^^
>
> You are using a triple-single-quoted string. Replacement of groovy vars 
> happens only in single- or triple-double-quoted strings.
>   
>  So use:
>  sh """
>
>
>
>
>
>

-- 
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/54de66df-3616-4b42-a66c-13a0bb8e3a25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing a variable in shell

2017-08-08 Thread Idan Adar
Still failing:

[Commons Updater] Running shell script
+ git clone -b master git@.com:/.git
Cloning into 'security-services'...
ERROR: Repository not found.
fatal: Could not read from remote repository.


This happens because the the variable is missing when trying to execute the 
shell command:


for (int i = 0; i < repoList.size(); i++) {
  def repoName = repoList[i]
  
  sshagent (credentials: ['credential-id']) {
 sh '''
git clone -b master 
git@.com:/${repoName}.git
cd ${repoName}
...

Note how it attempts to clone /.git instead of /the-repo-name.git.
I know that the repoList is occupied with the repo names because if I will 
echo it, I see the repo name.

def repoList = ReposToUpdate.tokenize(",");

echo repoList[0]


On Tuesday, August 8, 2017 at 3:54:17 PM UTC+3, mpapo - Michael Pailloncy 
wrote:
>
> Oh just realized that this for loop syntax exists even in Groovy :-) (I'm 
> used to using *each *instead of for loops)
> But please try using C-style for loop syntax.
>
> 2017-08-08 14:45 GMT+02:00 Michael Pailloncy <michael@gmail.com 
> >:
>
>> This syntax doesn't exist in Groovy : *for (String repoName : repoList) 
>> { ... }*
>> The direct equivalent is : *for (String repoName in repoList) { ... }*
>>
>> However, it's better to use the C-style for loop syntax when using 
>> pipeline (that's why I've used it in my previous example) :
>>
>> for (int i = 0; i < moduleList.size(); i++) {
>>def moduleName = moduleList[i]
>>...
>> }
>>
>> See 
>> https://github.com/jenkinsci/pipeline-examples/blob/master/docs/BEST_PRACTICES.md#groovy-gotchas
>>
>> Cheers
>>
>> 2017-08-08 14:31 GMT+02:00 Idan Adar <id...@adar.me >:
>>
>>> I've made some changes and now I'm getting:
>>>
>>> java.lang.NullPointerException: Cannot get property '$repoName' on null 
>>> object
>>>
>>>
>>>
>>> def repoList = ReposToUpdate.tokenize(",");
>>> def moduleList = npmDependencies.tokenize(",");
>>>
>>> pipeline {
>>>agent {
>>>   label '' 
>>>}
>>>
>>>stages {
>>>   stage ("Update package.json") {
>>>  steps {
>>> script {
>>>for (String repoName : repoList) {
>>>   sshagent (credentials: ['']) {
>>>  sh '''
>>> git clone -b master 
>>> git@.com:/${repoName}.git
>>> cd ${repoName}
>>> stat -t . > folderStat1.txt
>>>  '''
>>>
>>>  for (String moduleName : moduleList) {
>>> sh '''
>>>cd ${repoName}
>>>ncu -u -f "${moduleName}"
>>>stat -t . > folderStat2.txt
>>> '''
>>>  }
>>>
>>>  def folderStat1 = readFile('folderStat1.txt').trim()
>>>  def folderStat2 = readFile('folderStat2.txt').trim()
>>>
>>>  if (folderStat1 == folderStat2) {
>>> slackSend (
>>>color: '#199515',
>>>message: "$JOB_NAME: <$BUILD_URL|Build 
>>> #$BUILD_NUMBER> ${repoName}: Common code dependencies match the latest 
>>> package versions."
>>> )
>>>  }
>>>  else {
>>> sh '''
>>>cd ${repoName}
>>>
>>>git config --global user.name ""
>>>git config --global user.email 
>>>git commit -am 'Bump common packages version 
>>> number [ci skip]'
>>>git push origin master
>>>
>>>cd ..
>>>rm -rf ${repoName}
>>> '''
>>>
>>> slackSend (
>>>color: '#199515',
>>>message: "$JOB_NAME: <$BUILD_URL|Build 
>>

Re: Accessing a variable in shell

2017-08-08 Thread Idan Adar
I've made some changes and now I'm getting:

java.lang.NullPointerException: Cannot get property '$repoName' on null 
object



def repoList = ReposToUpdate.tokenize(",");
def moduleList = npmDependencies.tokenize(",");

pipeline {
   agent {
  label '' 
   }

   stages {
  stage ("Update package.json") {
 steps {
script {
   for (String repoName : repoList) {
  sshagent (credentials: ['']) {
 sh '''
git clone -b master 
git@.com:/${repoName}.git
cd ${repoName}
stat -t . > folderStat1.txt
 '''

 for (String moduleName : moduleList) {
sh '''
   cd ${repoName}
   ncu -u -f "${moduleName}"
   stat -t . > folderStat2.txt
'''
 }

 def folderStat1 = readFile('folderStat1.txt').trim()
 def folderStat2 = readFile('folderStat2.txt').trim()

 if (folderStat1 == folderStat2) {
slackSend (
   color: '#199515',
   message: "$JOB_NAME: <$BUILD_URL|Build 
#$BUILD_NUMBER> ${repoName}: Common code dependencies match the latest 
package versions."
)
 }
 else {
sh '''
   cd ${repoName}

   git config --global user.name ""
   git config --global user.email 
   git commit -am 'Bump common packages version 
number [ci skip]'
   git push origin master

   cd ..
   rm -rf ${repoName}
'''

slackSend (
   color: '#199515',
   message: "$JOB_NAME: <$BUILD_URL|Build 
#$BUILD_NUMBER> ${repoName}: Common code dependencies successfully updated 
to the latest package versions."
)
 }
  }
   }
}
 }
  }
   }

   post {
  failure {
 slackSend (
color: '#F01717',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, Update 
failed. Review the build logs."
 )
  }
   }
}

-- 
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/54962dc1-e80e-4ce3-8583-652a1fd714fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing a variable in shell

2017-08-08 Thread Idan Adar
Hm, failed with the same error... full stack: https://pastebin.com/AL2J5MMS


On Tuesday, August 8, 2017 at 9:49:28 AM UTC+3, mpapo - Michael Pailloncy 
wrote:
>
> The for loop is in Java syntax instead of script shell syntax here :
>
> sh """
> git clone -b master git@.com:/${repoName}.git
> cd ${repoName}
>
> stat -t . > folderStat1.txt
> for (String moduleName : moduleList) {
>ncu -u -f "${moduleName}"
> }
> 
> stat -t . > folderStat2.txt
> """
>
> IIUC, you want to do something like :
>
> sh "git clone -b master git@.com:/${repoName}.git"
>
> dir(repoName) {
> sh "stat -t . > folderStat1.txt"
> for (int i = 0; i < moduleList.size(); i++) {
> def moduleName = moduleList[i]
> sh "ncu -u -f \"${moduleName}\""
> }
> sh "stat -t . > folderStat2.txt"
> }
>
> Hopefully it helps.
>
> 2017-08-07 14:49 GMT+02:00 Idan Adar <id...@adar.me >:
>
>> I have tried this, but it complains: 
>>
>> groovy.lang.MissingPropertyException: No such property: moduleName for 
>> class: WorkflowScript
>>
>>
>> Here is the full Jenkinsfile:
>> The majority of it can be disregarded... the issue at hand is the use of 
>> the variables, ${repoName}, ${moduleName}, etc...
>>
>> ReposToUpdate and npmDependencies are Extended choice parameters e.g.:
>> myrepo1,myrepo2,myrepo3,...
>>
>> def repoList = ReposToUpdate.tokenize(",");
>> def moduleList = npmDependencies.tokenize(",");
>>
>> pipeline {
>>agent {
>>   label 'cert_mgmt' 
>>}
>>
>>stages {
>>   stage ("Update package.json") {
>>  steps {
>> script {
>>for (String repoName : repoList) {
>>   sshagent (credentials: ['credentials-ID']) {
>>  sh """
>> git clone -b master 
>> git@.com:/${repoName}.git
>> cd ${repoName}
>>
>> stat -t . > folderStat1.txt
>> for (String moduleName : moduleList) {
>>ncu -u -f "${moduleName}"
>> }
>> 
>> stat -t . > folderStat2.txt
>>  """
>>  
>>  def folderStat1 = readFile('folderStat1.txt').trim()
>>  def folderStat2 = readFile('folderStat2.txt').trim()
>>  
>>  if (folderStat1 == folderStat2) {
>> slackSend (
>>color: '#199515',
>>message: "$JOB_NAME: <$BUILD_URL|Build 
>> #$BUILD_NUMBER> ${repoName}: Common code dependencies match the latest 
>> package versions."
>> )
>>  }
>>  else {
>> sh """
>>cd ${repoName}
>>
>>git config --global user.name ""
>>git config --global user.email 
>>git commit -am 'Bump common packages version 
>> number [ci skip]'
>>git push origin master
>> 
>>cd ..
>>rm -rf ${repoName}
>> """
>> 
>> slackSend (
>>color: '#199515',
>>message: "$JOB_NAME: <$BUILD_URL|Build 
>> #$BUILD_NUMBER> ${repoName}: Common code dependencies successfully updated 
>> to the latest package versions."
>> )
>>  }
>>   }
>>}
>> }
>>  }
>>   }
>>}
>>
>>post {
>>   failure {
>>  slackSend (
>> color: '#F01717',
>> message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, 
>> Update failed. Review the build logs."
>>  )
>>   }
>>}
&

Re: Accessing a variable in shell

2017-08-07 Thread Idan Adar
I have tried this, but it complains: 

groovy.lang.MissingPropertyException: No such property: moduleName for class: 
WorkflowScript


Here is the full Jenkinsfile:
The majority of it can be disregarded... the issue at hand is the use of 
the variables, ${repoName}, ${moduleName}, etc...

ReposToUpdate and npmDependencies are Extended choice parameters e.g.:
myrepo1,myrepo2,myrepo3,...

def repoList = ReposToUpdate.tokenize(",");
def moduleList = npmDependencies.tokenize(",");

pipeline {
   agent {
  label 'cert_mgmt' 
   }

   stages {
  stage ("Update package.json") {
 steps {
script {
   for (String repoName : repoList) {
  sshagent (credentials: ['credentials-ID']) {
 sh """
git clone -b master 
git@.com:/${repoName}.git
cd ${repoName}
   
stat -t . > folderStat1.txt
for (String moduleName : moduleList) {
   ncu -u -f "${moduleName}"
}

stat -t . > folderStat2.txt
 """
 
 def folderStat1 = readFile('folderStat1.txt').trim()
 def folderStat2 = readFile('folderStat2.txt').trim()
 
 if (folderStat1 == folderStat2) {
slackSend (
   color: '#199515',
   message: "$JOB_NAME: <$BUILD_URL|Build 
#$BUILD_NUMBER> ${repoName}: Common code dependencies match the latest 
package versions."
)
 }
 else {
sh """
   cd ${repoName}
   
   git config --global user.name ""
   git config --global user.email 
   git commit -am 'Bump common packages version 
number [ci skip]'
   git push origin master

   cd ..
   rm -rf ${repoName}
"""

slackSend (
   color: '#199515',
   message: "$JOB_NAME: <$BUILD_URL|Build 
#$BUILD_NUMBER> ${repoName}: Common code dependencies successfully updated 
to the latest package versions."
)
 }
  }
   }
}
 }
  }
   }
   
   post {
  failure {
 slackSend (
color: '#F01717',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, Update 
failed. Review the build logs."
 )
  }
   }
}



On Sunday, July 30, 2017 at 10:48:39 PM UTC+3, Joachim Nilsson wrote:
>
> As I understand, it is written in Groovy. That means you can access a 
> variable in a (Groovy)string using dollar and optionally curly brackets. 
>
> "  variable value is ${variable} "
>
> Skaffa Outlook för Android <https://aka.ms/ghei36>
>
>
>
> Från: Idan Adar
> Skickat: söndag 30 juli 13:56
> Ämne: Accessing a variable in shell
> Till: Jenkins Users
>
>
> Given the following script block in a stage (Declarative pipeline), how 
> can I access the repoName variable?
>
> stages {
> stage("...") {
> script {
> for (String repoName: repoList) {
> sshagent (credentials: 
> ['e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
> sh """
> git clone -b master git@.com:/repoName.git
> cd repoName
> 
> """
> }
> }
>  }
>  }
> }
>
> -- 
> 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/d9d247a5-8ab9-4154-99c5-8c77b0861ec2%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/d9d247a5-8ab9-4154-99c5-8c77b0861ec2%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/f5ba050e-2d42-47d4-8183-89e43edc6fec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use "secret text" credential inside NodeJS app as part of a pipeline?

2017-08-06 Thread Idan Adar
Working now. The problem was with another property that was defined as 
username/password credential and not secret text credential.

-- 
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/9afe041a-fcdc-4d3b-a3b5-6a8b5a62e61f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use "secret text" credential inside NodeJS app as part of a pipeline?

2017-08-06 Thread Idan Adar
Also, if I will print all of process.env when running npm test via the 
Jenkinsfile, I can see the Jenkins logs that the not-working value is 
printed...

-- 
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/77559762-bcb2-496e-9ac9-10ca22dfac37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use "secret text" credential inside NodeJS app as part of a pipeline?

2017-08-06 Thread Idan Adar
Actually I think it does work... for the most part...

Working example:I created a "secret text" credential containing some 
password value and I then put the credential's ID as the value for a Global 
Variable called "myPassword".
In the Global Variables section there is a checkbox, "environment 
variables".

These key-value pairs apply for every build on every node. They can be used 
in Jenkins' configuration (as $key or ${key}) and will be added to the 
environment for processes launched from the build.


Then, in the Jenkinsfile I do as in my previous post.

environment {
myPassword = credentials('${myPassword}')  
...
}

This extracts the value of the credential (the name references the ID) into 
myPassword.

Lastly, in the JavaScript I reference it as process.env.myPassword
When npm test is run as part of the Jenkinsfile, it works this way for all 
credentials that I "inject", except for a credential that is a JSON like 
this:

{"property":"value", "property": "value", "property": "value", "property": 
"value"}


This breaks for some reason.

When running locally (outside of jenkins) with npm test, the values are 
stored in a local .js file and it works flawlessly.


On Thursday, August 3, 2017 at 8:44:41 PM UTC+3, Joshua Noble wrote:
>
> The secret text being printed as *** is a feature, so credentials aren't 
> leaked in console logs. You cannot use Jenkins credentials during 
> application runtime. (ie: If you deploy a backend Node app to an app 
> server) You can however use Jenkins credentials to run npm scripts, such as 
> npm test, (which require the Node runtime) within a Jenkins build.
>
> The credentials function needs an input of the credential ID. When a 
> credential is created, you can set the ID value to a custom one, such as a 
> human-friendly name. Otherwise, you will end up with a unique UUID.
>
> Everyone has their own personal taste, but I would refactor the 
> Jenkinsfile above to the following:
>
> stage ("E2E tests") {  
>   when {
> branch 'e2e-dev'
>   }
>   environment {
> MY_SECRET = credentials('jenkins-secret-id')
>   }   
>   steps {
> sh 'rm -f config/e2e-config.json'
> sh 'mv config/e2e-dev-config.json config/e2e-config.json'
> sh 'npm install'
> sh 'npm test'
>   }
> }
>
> With the above Jenkinsfile, you should be able to reference your secret 
> with ${MY_SECRET} anywhere in the code or shell steps, but only when 
> running npm scripts. This will not work for running applications on a 
> server. It should be noted that if you need to specify the secret within a 
> shell step line, that line must use double quotes to resolve the variable 
> properly.
>
> Another way of doing this would be:
>
> withCredentials([string(credentialsId: 'credential-id-here', variable: 
> 'CUSTOM_VARIABLE_NAME_HERE')]) {
>   sh "MY_SECRET=CUSTOM_VARIABLE_NAME_HERE npm test"
> }
>
> I hope that helps.
>
>
> On Thursday, August 3, 2017 at 6:26:28 AM UTC-4, Idan Adar wrote:
>>
>> I have done the following:
>>
>> 1. Create a "secret text" type credential
>> 2. Put in the credential a password
>> 3. Create a Global Variable, mySecret, with its value being the 
>> credential ID
>> 4. In the declarative pipeline: 
>>
>> stage ("E2E tests") {  
>>  environment {
>> mySecret = credentials('${mySecret}')
>>  }
>>  
>>  steps {
>> script {
>>STAGE_NAME = "E2E tests"
>>echo " $mySecret"
>>
>>
>>if (JOB_NAME == "e2e-dev") {
>>   // Setup packages and run tests
>>   sh '''
>>  rm -f config/e2e-config.json
>>  mv config/e2e-dev-config.json config/e2e-config.json
>>  npm install
>>  npm test
>>   '''
>>}
>>}
>> }
>> }
>>
>> In Jenkins, the secret text is printed: "*"
>> In the NodeJS app, I'm getting an error...
>>
>> Global Variables in Jenkins can also be used as environment variables and 
>> I know I can use those as clear text in the NodeJS app.
>> My question is how to use Jenkins credentials from Jenkins in the NodeJS 
>> app...
>>
>> Any thoughts?
>>
>

-- 
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/d1e51b34-8fc4-4785-9b86-eee09072eb52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use "secret text" credential inside NodeJS app as part of a pipeline?

2017-08-03 Thread Idan Adar
I have done the following:

1. Create a "secret text" type credential
2. Put in the credential a password
3. Create a Global Variable, mySecret, with its value being the credential 
ID
4. In the declarative pipeline: 

stage ("E2E tests") {  
 environment {
mySecret = credentials('${mySecret}')
 }
 
 steps {
script {
   STAGE_NAME = "E2E tests"
   echo " $mySecret"


   if (JOB_NAME == "e2e-dev") {
  // Setup packages and run tests
  sh '''
 rm -f config/e2e-config.json
 mv config/e2e-dev-config.json config/e2e-config.json
 npm install
 npm test
  '''
   }
   }
}
}

In Jenkins, the secret text is printed: "*"
In the NodeJS app, I'm getting an error...

Global Variables in Jenkins can also be used as environment variables and I 
know I can use those as clear text in the NodeJS app.
My question is how to use Jenkins credentials from Jenkins in the NodeJS 
app...

Any thoughts?

-- 
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/49e5cabe-6916-4c1f-a0a5-c7bd146725a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Accessing a variable in shell

2017-07-30 Thread Idan Adar
Given the following script block in a stage (Declarative pipeline), how can 
I access the repoName variable?

stages {
stage("...") {
script {
for (String repoName: repoList) {
sshagent (credentials: [
'e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
sh """
git clone -b master git@.com:/repoName.git
cd repoName

"""
}
}
 }
 }
}

-- 
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/d9d247a5-8ab9-4154-99c5-8c77b0861ec2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can we construct a more complex slackSend notification?

2017-06-30 Thread Idan Adar
Do you happen to know why does the following line shows an error?
"mrkdwn_in": ['text','pretext'], -- expecting '}', found ':'

def payload = JsonOutput.toJson([
  "username": "Production Deployer",
  "icon_emoji": ":robot_face:",
  "mrkdwn": true,
  "attachments": [
 {
"mrkdwn_in": ['text','pretext'],
"color": "#199515",
"text": "*$JOB_NAME:* <$BUILD_URL|Build #$BUILD_NUMBER>, 
_microservice_ in _${clusterName}_ successfully updated.",
"fallback": "*Production Deployer*: operation succeeded."
 }
  ]
   ])


On Friday, June 30, 2017 at 6:23:18 PM UTC+3, Idan Adar wrote:
>
> Ohhh, nice!
> Thanks for the example Michael.
>
> On Friday, June 30, 2017 at 5:41:38 PM UTC+3, mpapo - Michael Pailloncy 
> wrote:
>>
>> Alternatively, you can create your own Pipeline method, a bit like this 
>> one : 
>> https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/slacknotify/slackNotify.groovy
>>   
>> Since it's a simple curl, you can then directly use all the existing 
>> options/parameters offered by the Slack REST API.
>>
>> Note that it's better to centralized this method inside a Global Shared 
>> Library (just in case you are not already using it :))
>>
>>
>> 2017-06-30 16:11 GMT+02:00 Idan Adar <id...@adar.me>:
>>
>>> Anyone? :)
>>>
>>> On Tuesday, June 27, 2017 at 8:13:35 PM UTC+3, Idan Adar wrote:
>>>>
>>>> In a Node.js app, one can use the slack-notify package to send 
>>>> something like this:
>>>>
>>>>
>>>> slack.send({
>>>>   "username": "myBotName",
>>>>   "icon_emoji": ":robot_face:",
>>>>   "mrkdwn": true,
>>>>   "attachments": [
>>>>  {
>>>> "mrkdwn_in": ['text','pretext'],
>>>> "color": "#199515",
>>>> "text": message,
>>>> "fallback": "*my*: _markdown_ message."
>>>>  }
>>>>   ]   
>>>>});
>>>>
>>>> In a Jenkinsfile, one can do this:
>>>> slackSend (
>>>>color: '#F01717',
>>>>message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, my 
>>>> message."
>>>> )
>>>>
>>>> I'm looking for a way to accomplish the Node implementation, but using 
>>>> slackSend so that the message dispatched from the Jenkinsfile will be 
>>>> on-par with the Node.js-sent message.
>>>>
>>> -- 
>>> 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/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%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/b4ac2560-b636-49da-a7e6-4d90e677a383%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can we construct a more complex slackSend notification?

2017-06-30 Thread Idan Adar
Ohhh, nice!
Thanks for the example Michael.

On Friday, June 30, 2017 at 5:41:38 PM UTC+3, mpapo - Michael Pailloncy 
wrote:
>
> Alternatively, you can create your own Pipeline method, a bit like this 
> one : 
> https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/slacknotify/slackNotify.groovy
>   
> Since it's a simple curl, you can then directly use all the existing 
> options/parameters offered by the Slack REST API.
>
> Note that it's better to centralized this method inside a Global Shared 
> Library (just in case you are not already using it :))
>
>
> 2017-06-30 16:11 GMT+02:00 Idan Adar <id...@adar.me >:
>
>> Anyone? :)
>>
>> On Tuesday, June 27, 2017 at 8:13:35 PM UTC+3, Idan Adar wrote:
>>>
>>> In a Node.js app, one can use the slack-notify package to send something 
>>> like this:
>>>
>>>
>>> slack.send({
>>>   "username": "myBotName",
>>>   "icon_emoji": ":robot_face:",
>>>   "mrkdwn": true,
>>>   "attachments": [
>>>  {
>>> "mrkdwn_in": ['text','pretext'],
>>> "color": "#199515",
>>> "text": message,
>>> "fallback": "*my*: _markdown_ message."
>>>  }
>>>   ]   
>>>});
>>>
>>> In a Jenkinsfile, one can do this:
>>> slackSend (
>>>color: '#F01717',
>>>message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, my 
>>> message."
>>> )
>>>
>>> I'm looking for a way to accomplish the Node implementation, but using 
>>> slackSend so that the message dispatched from the Jenkinsfile will be 
>>> on-par with the Node.js-sent message.
>>>
>> -- 
>> 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/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%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/85f506e6-27ed-46c5-8c1f-5f9a0ac445df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can we construct a more complex slackSend notification?

2017-06-30 Thread Idan Adar
Anyone? :)

On Tuesday, June 27, 2017 at 8:13:35 PM UTC+3, Idan Adar wrote:
>
> In a Node.js app, one can use the slack-notify package to send something 
> like this:
>
>
> slack.send({
>   "username": "myBotName",
>   "icon_emoji": ":robot_face:",
>   "mrkdwn": true,
>   "attachments": [
>  {
> "mrkdwn_in": ['text','pretext'],
> "color": "#199515",
> "text": message,
> "fallback": "*my*: _markdown_ message."
>  }
>   ]   
>});
>
> In a Jenkinsfile, one can do this:
> slackSend (
>color: '#F01717',
>message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, my 
> message."
> )
>
> I'm looking for a way to accomplish the Node implementation, but using 
> slackSend so that the message dispatched from the Jenkinsfile will be 
> on-par with the Node.js-sent message.
>

-- 
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/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to pass variables into multiple lines sh section

2017-06-25 Thread Idan Adar
Thanks, ".substring(16)" did the trick for what I needed in addition to the 
variables suggestion.

On Sunday, June 25, 2017 at 3:25:06 PM UTC+3, slide wrote:
>
> Groovy will not replace anything if you use single quotes. The problem is 
> that you are mixing shell variables and groovy variables, so you need to be 
> careful. Try something like this:
>
> datacenter=repoName.substring(0, 16)
>  sh """
>export 
> KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/${clusterName}/kube-config-${datacenter}-${clusterName}.yml
> 
># Set the build number
>case ${repoName} in
>   "") 
>  ../../../yaml w -i 
> config/environments/prod/$clusterName/kubernetes/deployment.yaml 
> spec.template.spec.containers[0].image 
> registry.ng.bluemix.net/certmgmt_prod/instmgr:$instmgr
>  ;;
>    esac
>  """
>
> On Sun, Jun 25, 2017 at 12:50 AM Idan Adar <id...@adar.me > 
> wrote:
>
>> I'm having difficulty passing parameters into a multiple lines sh section 
>> like below.
>> Can someone help with spotting the problem?
>>
>> Specifically, 
>> 1. $datacenter is empty
>> 2. $clusterName is empty
>> 3. I suspect $repoName is empty too
>>
>>
>> stage ("Update Deployments") {  
>>  steps {
>> script {
>>def repoList = microServicesToPublish.tokenize(",")
>>def clusterList = clustersToPublishTo.tokenize(",")
>>
>>for (String clusterName : clusterList) {
>>   for (String repoName : repoList) {
>>  
>>  // Create a folder based on the current repository 
>> in the list
>>  dir(repoName) {
>> // Clone it
>> git branch: 'master', credentialsId: 
>> 'caf2691d-42c7-4d10-acf0-cf5fcc2575a4', url: "https:////; + 
>> repoName
>> 
>> // Apply Kubernetes configuration and update the 
>> Deployment
>> sh '''
>>datacenter=${repoName:16}
>>export 
>> KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml
>> 
>># Set the build number
>>case $repoName in
>>   "") 
>>  ../../../yaml w -i 
>> config/environments/prod/$clusterName/kubernetes/deployment.yaml 
>> spec.template.spec.containers[0].image 
>> registry.ng.bluemix.net/certmgmt_prod/instmgr:$instmgr
>>  ;;
>>esac
>>  '''
>>   }
>>   }
>>}
>> }
>>}  
>>  }
>>
>> -- 
>> 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/a20604e6-42cf-452d-887f-c4d3ab58bc69%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/a20604e6-42cf-452d-887f-c4d3ab58bc69%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/832c7248-f6eb-4467-95b9-c7ebba9838e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to pass values into multiple lines sh section

2017-06-25 Thread Idan Adar
There are actually two additional def's.

def repoName = ""
def clusterName = ""

On Sunday, June 25, 2017 at 12:25:14 PM UTC+3, Idan Adar wrote:
>
> I'm having difficulty passing parameters into a multiple lines sh section 
> like below.
> Can someone help with spotting the problem?
>
> Specifically, 
> 1. $datacenter is empty
> 2. $clusterName is empty
> 3. I suspect $repoName is empty too
>
>
> stage ("Update Deployments") {  
>  steps {
> script {
>def repoList = microServicesToPublish.tokenize(",")
>def clusterList = clustersToPublishTo.tokenize(",")
>
>for (String clusterName : clusterList) {
>   for (String repoName : repoList) {
>  
>  // Create a folder based on the current repository 
> in the list
>  dir(repoName) {
> // Clone it
> git branch: 'master', credentialsId: '', url: 
> "https:////; + repoName
> 
> // Apply Kubernetes configuration and update the 
> Deployment
> sh '''
>datacenter=${repoName:16}
>export 
> KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml
> 
># Set the build number
>case $repoName in
>   "") 
>  ../../../yaml w -i 
> config/environments//$clusterName/kubernetes/deployment.yaml 
> spec.template.spec.containers[0].image myregistry/mynamespace/myimage:m 
> <http://registry.ng.bluemix.net/certmgmt_prod/instmgr:$instmgr>ytag
>  ;;
>esac
>  '''
>   }
>   }
>}
> }
>}  
>  }
>

-- 
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/7c8867ca-6481-4129-b1f3-90bcc78b7311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unable to pass values into multiple lines sh section

2017-06-25 Thread Idan Adar
I'm having difficulty passing parameters into a multiple lines sh section 
like below.
Can someone help with spotting the problem?

Specifically, 
1. $datacenter is empty
2. $clusterName is empty
3. I suspect $repoName is empty too


stage ("Update Deployments") {  
 steps {
script {
   def repoList = microServicesToPublish.tokenize(",")
   def clusterList = clustersToPublishTo.tokenize(",")
   
   for (String clusterName : clusterList) {
  for (String repoName : repoList) {
 
 // Create a folder based on the current repository in 
the list
 dir(repoName) {
// Clone it
git branch: 'master', credentialsId: '', url: 
"https:////; + repoName

// Apply Kubernetes configuration and update the 
Deployment
sh '''
   datacenter=${repoName:16}
   export 
KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml

   # Set the build number
   case $repoName in
  "") 
 ../../../yaml w -i 
config/environments//$clusterName/kubernetes/deployment.yaml 
spec.template.spec.containers[0].image myregistry/mynamespace/myimage:m 
ytag
 ;;
   esac
 '''
  }
  }
   }
}
   }  
 }

-- 
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/53d89cf2-54db-4b6c-9871-c3c6c64f5a36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unable to pass variables into multiple lines sh section

2017-06-25 Thread Idan Adar
I'm having difficulty passing parameters into a multiple lines sh section 
like below.
Can someone help with spotting the problem?

Specifically, 
1. $datacenter is empty
2. $clusterName is empty
3. I suspect $repoName is empty too


stage ("Update Deployments") {  
 steps {
script {
   def repoList = microServicesToPublish.tokenize(",")
   def clusterList = clustersToPublishTo.tokenize(",")
   
   for (String clusterName : clusterList) {
  for (String repoName : repoList) {
 
 // Create a folder based on the current repository in 
the list
 dir(repoName) {
// Clone it
git branch: 'master', credentialsId: 
'caf2691d-42c7-4d10-acf0-cf5fcc2575a4', url: "https:////; + repoName

// Apply Kubernetes configuration and update the 
Deployment
sh '''
   datacenter=${repoName:16}
   export 
KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml

   # Set the build number
   case $repoName in
  "") 
 ../../../yaml w -i 
config/environments/prod/$clusterName/kubernetes/deployment.yaml 
spec.template.spec.containers[0].image 
registry.ng.bluemix.net/certmgmt_prod/instmgr:$instmgr
 ;;
   esac
 '''
  }
  }
   }
}
   }  
 }

-- 
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/a20604e6-42cf-452d-887f-c4d3ab58bc69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-18 Thread Idan Adar
I eventually used the following to accomplish my 
goal: 
https://stackoverflow.com/questions/44612496/bash-variable-escaping-in-a-jenkinsfile#44612844
Still looking forward to changes in "checkout"!

-- 
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/9801a313-e975-4266-9f82-bb830d9b1825%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
BTW, this whole exercise is essentially only so that I could tag builds of 
the master branch with 0.0.$BUILD_NUMBER so that I could record these as 
"GitHub releases".
Naturally, if there is a simpler approach to create these releases/tags 
instead of clone-tag-push, it'd simplify the whole process...

On Sunday, June 18, 2017 at 6:49:36 AM UTC+3, Idan Adar wrote:
>
>
>- An intentionally narrow refspec (like 
>+refs/heads/master:refs/remotes/origin/master) reduces the objects copied 
>in the clone to only those in that refspec (typically the desired branch), 
>while still providing the full history of the working branch (but not the 
>history of other branches in the repository)
>
> Is this relevant in a multibranch job? I thought that in this job that 
> specifies "master develop" branches, a checkout of the develop branch 
> checks out just the develop branch and a checkout of the master branch 
> checks out just the master branch. Seems narrow enough?
>
>
> If Stephen's changes will really simply allow me to git push as part of 
> the default "checkout scm" command, I could just do that without trying to 
> customize it... as I would be fine with the single checkout and then 
> operate it on (instead of the forced git cloning I need to do now in order 
> to git push).
>
> BTW, trying that checkout customization in my previous post failed with an 
> exception...
>
> java.lang.NullPointerException
>   at 
> org.jenkinsci.plugins.workflow.steps.scm.MultiSCMRevisionState.get(MultiSCMRevisionState.java:56)
>   at 
> org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:106)
>   at 
> org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
>   at 
> org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
>   at 
> org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
>   at hudson.security.ACL.impersonate(ACL.java:260)
>   at 
> org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
>   at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>   at java.lang.Thread.run(Thread.java:745)
>
>
>
>
>
>
> On Sunday, June 18, 2017 at 1:42:58 AM UTC+3, Mark Waite wrote:
>>
>>
>>
>> On Saturday, June 17, 2017 at 11:48:19 AM UTC-6, Idan Adar wrote:
>>>
>>> Okay, so looks like what I should try in order to:
>>> 1. make checkouts faster
>>> 2. be able to git tag & push
>>>
>>> Is the following:
>>>
>>> 1. Try with:
>>>
>>> checkout(
>>>  extensions: [
>>>  [$class: 'CloneOption',
>>>   depth: 1,
>>>   shallow: true
>>>  ]
>>>  ]
>>> )
>>>
>>>
>>>
>> I look forward to hearing that it helped with your use case.
>>
>> There are several ways to reduce the work done by git fetch or git clone, 
>> each with its own set of reasons it helps and reasons it hinders.  For 
>> example:
>>
>>- An intentionally narrow refspec (like 
>>+refs/heads/master:refs/remotes/origin/master) reduces the objects copied 
>>in the clone to only those in that refspec (typically the desired 
>> branch), 
>>while still providing the full history of the working branch (but not the 
>>history of other branches in the repository)
>>- A reference repository updated on the agent (by whatever means you 
>>wish) can avoid network copies of objects by allowing git fetch and git 
>>clone  to point to the references instead of retrieving them.  This can 
>> be 
>>a major savings with large repositories, since multiple jobs can point to 
>> a 
>>single copy of the reference repository and save disc space and network 
>>transfer
>>- Large file support (LFS) can reduce network transfers by only 
>>transferring the current copy of large files which are being tracked, 
>>rather than transferring the entire history of large files.  LFS requires 
>> a 
>>newer version of git, changes in the repository, and some extra setup for 
>>support from the git s

Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Okay, so looks like what I should try in order to:
1. make checkouts faster
2. be able to git tag & push

Is the following:

1. Try with:

checkout(
 extensions: [
 [$class: 'CloneOption',
  depth: 1,
  shallow: true
 ]
 ]
)


2. Wait for Stephen...



BTW, I thought the shallow cloning is basically to specify depth, so why 
shallow:true is needed in additition to depth:1 ?

-- 
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/8083e7e7-20b5-4e32-b506-343e444b4eaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Another question, if I do customize "checkout", do I need to include 
everything like in your example, or only what I want specifically, like 
depth, and if nothing else is mentioned that the defaults are taken...?

-- 
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/ed87e710-1906-46b3-9486-6440b92da5ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Oh, hm, interesting...
In my multibranch job I selected "GitHub" as the "Branch source"... for 
"GitHub" there aren't many options... but for "Git" there are... and I 
guess these play fine with Jenkinsfile...

Question.
Lets say I setup "Git" as the branch source and add some "additional 
options", but in my Jenkinsfile I set:

options {
  skipDefaultCheckout()
}


stages {
  stage ("Checkout SCM") {
  checkout scm
  }
}

Does this contradict one another?

-- 
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/e626b928-8b84-4791-aa17-401bbbca52af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Oh, hm, interesting...
In my multibranch job I selected "GitHub" as the "Branch source"... for 
"GitHub" there aren't many options... but for "Git" there are... and I 
guess these play fine with Jenkinsfile...

Question.
Lets say I setup "Git" as the branch source and in my Jenkinsfile I set:

options {
  skipDefaultCheckout()
}


stages {
  stage ("Checkout SCM") {
  checkout scm
  }
}

Does this contradict one another?

-- 
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/ac85462a-a44d-4c56-925d-a4753c9f6ef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Thanks Mark. Since I'm using declarative pipeline in a Jenkinsfile in a 
multi-branch job, UI option is kinda scarce and less relevant for me. So 
anything that can be added to the declarative way of doing things is great. 
The example you linked to is in scripted pipeline form, which I'm trying to 
get away from where ever I can.

That said, I'm not versed enough in Git to understand these concepts 
mentioned... "checkout to specific local branch" doesn't mean much to me... 
I understand "checkout" but "_to_ a specific branch"? Not sure what it 
means.

What I understand is that the "checkout scm" command does a headless 
checking out of a given branch of a repository, which takes place thanks to 
a github webhook with "pull request" and "push", pointing to the Jenkins 
instance. So basically what I want, and hopefully is what you and Stephen 
are referring to soon be available, is that the "checkout scm" command will 
be such that won't be headless?

I'd be great if I could specify for it "--depth 1" and be able to do git 
operations on the checked out repo/branch. :)

On Saturday, June 17, 2017 at 3:13:45 PM UTC+3, Mark Waite wrote:
>
> .You're correct that the git push needs to be wrapped in some form of 
> credentials.
>
> Git checkouts in Jenkins can be done to the branch name of your choice, 
> including "match the branch name".  Refer to the "Additional Behaviour" 
> called "Checkout to specific local branch".  The online help for that 
> option says that you can use "**" as the value and that will be interpreted 
> to use the branch name which was selected for checkout.  An example is 
> available in 
> https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-33827/Jenkinsfile .  
> The "pipeline syntax" for checkout will add that behavior for you as well 
> (though as Stephen notes, the UI is not pretty and shows you many things as 
> options which you should not use).
>
> Sorry that is not the default, but preserving historical behavior has been 
> important for the many users of the plugin.
>
> Mark Waite
>
> On Sat, Jun 17, 2017 at 1:09 AM Idan Adar <id...@adar.me > 
> wrote:
>
>> I take it back, not good workaround for me after all...
>>
>> -- 
>> 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/954f8f8f-9cc3-4085-ba95-d3a241dc8e8a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/954f8f8f-9cc3-4085-ba95-d3a241dc8e8a%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/e0519bdd-a0cb-4162-a8aa-2a1aed17af55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
I take it back, not good workaround for me after all...

-- 
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/954f8f8f-9cc3-4085-ba95-d3a241dc8e8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
I'm sorry, but could you please elaborate? :)
What changes to which plug-in and an example implementation...

Right now instead of "checkout scm" in the checkout stage and "git clone" 
in the stage where I need to do git tag/push, I do only the following in 
the checkout stage:

sshagent (credentials: ['...']) {
sh "git clone --depth 1 -b develop g...@myrepo.git"
}

And then I should be able to do the operations...
Essentially, Jenkinsfile now does the "checkout" not-headlessly, but it 
does meant it's not declarative anymore...

-- 
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/b1020fe2-961e-4586-8b19-0f6c51879cad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fastest way to git tag in a Jenkinsfile?

2017-06-17 Thread Idan Adar
Checkouts in Jenkins, AFAIK, are headless, meaning that I cannot do git 
operations on them.
If I want to do an operation, like git tag and then git push... I need to 
first do git clone inside an sshagent block or similar.

For large repositories this can be a problem, as the process becomes 
lengthy...
checkout scm...
do stuff (tests, build, etc)...
git clone...
git tag...
git push...

This can be made a little better by git cloning using --depth 1, but this 
still will git clone the whole repo, even if without history.

So I'm looking for a way to be able to git tag/push, but not also git clone 
the repo again... is this at all possible, to maybe check scm with head 
(or, not headless) so git operations would be possible?

-- 
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/52f875bc-020c-422f-8508-2277a628f608%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Shallow clone example for declarative pipeline?

2017-06-16 Thread Idan Adar
I mean, for the checkout scm part above... not a separate "git clone 
--depth 1 ..."

-- 
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/616a459f-55d4-4511-b061-b0188fbe6b54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Shallow clone example for declarative pipeline?

2017-06-16 Thread Idan Adar
Could someone please provide an example for shallow clone in a declarative 
pipeline?

pipeline {
   options {
  ansiColor('xterm')
  skipDefaultCheckout()
  disableConcurrentBuilds()
   }
   
   stages {
 steps {
 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b2ab1afe-1ea9-46f1-81c9-4509a4d56c8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can a Jenkins global variable be used inside running code as part of a job?

2017-06-16 Thread Idan Adar
I forgot about parameters option in a Jenkinsfile... thanks.

On Thursday, June 15, 2017 at 8:12:15 PM UTC+3, Stephen Connolly wrote:
>
>
> On Thu 15 Jun 2017 at 17:44, Idan Adar <id...@adar.me > 
> wrote:
>
>> Well that's a deadlock... I need both those variables and the parameter 
>> provided to me via parametrized build...
>> parametrized build is available in pipeline but not multibranch
>>
>
> If can define the parameters from your Jenkinsfile
>
> An alternative is to use a different Jenkinsfile (in a different repo) for 
> the deployment 
>
>>
>>
>> -- 
>> 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/67314e16-6ae2-4c93-84ed-b76b5d46f0de%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/67314e16-6ae2-4c93-84ed-b76b5d46f0de%40googlegroups.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/711fed79-4222-47a5-8014-58c62cd39576%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can a Jenkins global variable be used inside running code as part of a job?

2017-06-15 Thread Idan Adar
Well that's a deadlock... I need both those variables and the parameter 
provided to me via parametrized build...
parametrized build is available in pipeline but not multibranch

-- 
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/67314e16-6ae2-4c93-84ed-b76b5d46f0de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can a Jenkins global variable be used inside running code as part of a job?

2017-06-15 Thread Idan Adar
Question:

It seems that $CHANGE_ID and $CHANGE_URL are not available in a pipeline 
job but are available in a multibranch 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/faea6e95-baac-4e08-91dc-48ba7660c33d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can a Jenkins global variable be used inside running code as part of a job?

2017-06-15 Thread Idan Adar
Thanks. I'll need it to be two jobs as the first cluster has a 3 runs scheduled 
and the second one shouldn't be scheduled. I'll give it a try.

Sent from my iPhone

> On 15 Jun 2017, at 16:20, Stephen Connolly <stephen.alan.conno...@gmail.com> 
> wrote:
> 
> Parameterized job. that will expose the parameter. you can have the parameter 
> be a drop-down with the two clusters (and even nice names)
> 
>> On 15 June 2017 at 06:12, Idan Adar <i...@adar.me> wrote:
>> Here's the situation:
>> 
>> I have 2 clusters, each with its own unique URL, that do end-2-end testing.
>> The code that does the tests is the same. It basically goes through a set of 
>> actions performed on a cluster.
>> 
>> I have a job that basically does npm test which starts the process.
>> Now I'd like to use the same code and the same job to be able to run the 
>> test for the second cluster.
>> 
>> The URL of the cluster is inside the code. So without a way to change the 
>> URL in some way, I can't run the tests on the second cluster.
>> Options thus far:
>> 
>> 1. Use branches, one for each, but that means updating the tests twice...
>> 2. Use external variable to update the URL value during runtime
>> 3. Find out the job name during runtime and then use a different config file 
>> during runtime.
>> 
>> 3 is a new option that I'd like to explore. Is there a way to retrieve the 
>> job name during a job runtime?
>> 
>>> On Thursday, June 15, 2017 at 4:00:27 PM UTC+3, Stephen Connolly wrote:
>>> It looks like you are trying to write a build script in pipeline...
>>> 
>>> 
>>> 
>>> I would think twice if that is actually what you are trying to do.
>>> 
>>> Write your build script to be independent of Jenkins. That lets you test 
>>> thing from the command line.
>>> 
>>> Pipeline is the glue to wire it all together at the end (same goes for 
>>> non-pipeline job types, except it is harder to fall into the trap and hence 
>>> less likely... but it can still happen)
>>> 
>>> 
>>>> On 15 June 2017 at 05:19, Idan Adar <id...@adar.me> wrote:
>>>> Currently I have in a node project a .json file with certain values.
>>>> Is it possible to externalize these values into a Jenkins global variable 
>>>> and then consume these properties in my code?
>>>> -- 
>>>> 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/98e36806-f4b9-4b8d-964a-81ee0f71a66d%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/6c1ec535-68e5-4b77-a46d-a3b8a67d958d%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/1Cfq4PzoPsM/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CA%2BnPnMzjHyXgi5Xkh1B_SC7BL3pHRRx%3Dmw2t%2BpVELO87wefjEQ%40mail.gmail.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/B9160269-FBDE-4AFE-A8C3-290DAF5948C5%40adar.me.
For more options, visit https://groups.google.com/d/optout.


Re: Can a Jenkins global variable be used inside running code as part of a job?

2017-06-15 Thread Idan Adar
Here's the situation:

I have 2 clusters, each with its own unique URL, that do end-2-end testing.
The code that does the tests is the same. It basically goes through a set 
of actions performed on a cluster.

I have a job that basically does npm test which starts the process.
Now I'd like to use the same code and the same job to be able to run the 
test for the second cluster.

The URL of the cluster is inside the code. So without a way to change the 
URL in some way, I can't run the tests on the second cluster.
Options thus far:

1. Use branches, one for each, but that means updating the tests twice...
2. Use external variable to update the URL value during runtime
3. Find out the job name during runtime and then use a different config 
file during runtime.

3 is a new option that I'd like to explore. Is there a way to retrieve the 
job name during a job runtime?

On Thursday, June 15, 2017 at 4:00:27 PM UTC+3, Stephen Connolly wrote:
>
> It looks like you are trying to write a build script in pipeline...
>
>
> I would think twice if that is actually what you are trying to do.
>
> Write your build script to be independent of Jenkins. That lets you test 
> thing from the command line.
>
> Pipeline is the glue to wire it all together at the end (same goes for 
> non-pipeline job types, except it is harder to fall into the trap and hence 
> less likely... but it can still happen)
>
>
> On 15 June 2017 at 05:19, Idan Adar <id...@adar.me > wrote:
>
>> Currently I have in a node project a .json file with certain values.
>> Is it possible to externalize these values into a Jenkins global variable 
>> and then consume these properties in my code?
>>
>> -- 
>> 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/98e36806-f4b9-4b8d-964a-81ee0f71a66d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/98e36806-f4b9-4b8d-964a-81ee0f71a66d%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/6c1ec535-68e5-4b77-a46d-a3b8a67d958d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can a Jenkins global variable be used inside running code as part of a job?

2017-06-15 Thread Idan Adar
Currently I have in a node project a .json file with certain values.
Is it possible to externalize these values into a Jenkins global variable 
and then consume these properties in my code?

-- 
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/98e36806-f4b9-4b8d-964a-81ee0f71a66d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can environment directive be used in post?

2017-06-15 Thread Idan Adar
Thanks. I ended doing what I needed doing as part of the last stage instead 
of in post.

On Wednesday, June 14, 2017 at 9:54:06 PM UTC+3, Kevin Burnett wrote:
>
> i don't believe you can use the environment instruction in post, no.
>
> but you can use withEnv: 
> https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-withenv-code-set-environment-variables
>
> On Wednesday, June 14, 2017 at 8:43:43 AM UTC-4, Idan Adar wrote:
>>
>> In a stage I can do the following: 
>>
>> stage ("Merge pull request") {
>>  environment {
>> JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
>>  }
>>  ...
>>  ...
>>  steps {
>>   
>>  }
>> }
>>
>> Can this done also in post?
>>
>> post {
>>  success {
>>  environment { 
>>  JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
>>  }
>>
>>  script {
>>  
>>  }
>>   }
>> }
>> 
>>
>> Or is there any other way to ahchieve 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/30806026-862d-4b3d-8a07-e2d34595b14d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can environment directive be used in post?

2017-06-14 Thread Idan Adar
In a stage I can do the following: 

stage ("Merge pull request") {
 environment {
JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
 }
 ...
 ...
 steps {
  
 }
}

Can this done also in post?

post {
 success {
 environment { 
 JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
 }

 script {
 
 }
  }
}


Or is there any other way to ahchieve 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/3dbaa1ef-96c3-4067-8cc3-00d3a1b8452b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable jobs of type Multi-branch?

2017-06-01 Thread Idan Adar
I ended with updating a file in a repo if the tests fail.
Any job that then tries to run will first check for the contents of the 
file, if it's not what it should be the job will exit.

-- 
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/41f94006-84f7-4f94-bc0d-0192a41f3bd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable jobs of type Multi-branch?

2017-06-01 Thread Idan Adar
Thanks for the suggestions Stephen. I'd like to try a couple more ideas...

Is it possible to modify a global variable? What are my options to deal 
with variables cross-jobs?

On Wednesday, May 31, 2017 at 5:00:50 PM UTC+3, Stephen Connolly wrote:
>
>
>
> On 31 May 2017 at 14:17, Idan Adar <id...@adar.me > wrote:
>
>> I actually do want these to build automatically. I control what then 
>> happens in the jenkinsfile...
>>
>
> multi-branch is strongly opinionated. One of the core opinions is that 
> branches are independent.
>
> it sounds like what you are trying to do is significantly more reliant on 
> repository cohesive state.
>
> I would suggest taking a different approach. In any case, the stuff you 
> are likely trying to do is not something that is "permitted" from a 
> Jenkinsfile as there are too many security risks. As such you will probably 
> have to write a plugin.
>
> I recommend re-thinking your use-case and requirements if you want to do 
> something off-the-shelf without having to write a Jenkins plugin. 
>  
>
>>
>>
>> On Wednesday, May 31, 2017 at 4:03:18 PM UTC+3, Stephen Connolly wrote:
>>>
>>> no.
>>>
>>> What you really want to do is not have those branches build 
>>> automatically effectively you want to turn the multbranch source to be 
>>> something like[image: Inline images 1]
>>> or (assuming you want master to still build automatically)
>>> [image: Inline images 2]
>>>
>>> Should be possible to configure that by groovy or a plugin
>>>
>>> On 30 May 2017 at 20:19, Idan Adar <id...@adar.me> wrote:
>>>
>>>> To disable, can I point to a branch like so?
>>>> def job = Jenkins.instance.getItem("job-name/branch-name"); job.disable
>>>> (); 
>>>>
>>>> And then to enable, maybe it could be achieved also programmatically?
>>>> def job = Jenkins.instance.getItem("job-name/branch-name"); job.enable
>>>> (); 
>>>>
>>>>
>>>> -- 
>>>> 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/63a5e368-ff1a-4898-b86f-1eee9536961c%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/63a5e368-ff1a-4898-b86f-1eee9536961c%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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/1e9347b6-b304-4c74-bb33-e3c119b9ac06%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/1e9347b6-b304-4c74-bb33-e3c119b9ac06%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/cab1b66c-6996-4a18-8e87-32b5250cf51a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable jobs of type Multi-branch?

2017-05-31 Thread Idan Adar
I actually do want these to build automatically. I control what then 
happens in the jenkinsfile...

On Wednesday, May 31, 2017 at 4:03:18 PM UTC+3, Stephen Connolly wrote:
>
> no.
>
> What you really want to do is not have those branches build 
> automatically effectively you want to turn the multbranch source to be 
> something like[image: Inline images 1]
> or (assuming you want master to still build automatically)
> [image: Inline images 2]
>
> Should be possible to configure that by groovy or a plugin
>
> On 30 May 2017 at 20:19, Idan Adar <id...@adar.me > wrote:
>
>> To disable, can I point to a branch like so?
>> def job = Jenkins.instance.getItem("job-name/branch-name"); job.disable
>> (); 
>>
>> And then to enable, maybe it could be achieved also programmatically?
>> def job = Jenkins.instance.getItem("job-name/branch-name"); job.enable(); 
>>
>>
>> -- 
>> 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/63a5e368-ff1a-4898-b86f-1eee9536961c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/63a5e368-ff1a-4898-b86f-1eee9536961c%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/1e9347b6-b304-4c74-bb33-e3c119b9ac06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable jobs of type Multi-branch?

2017-05-30 Thread Idan Adar
To disable, can I point to a branch like so?
def job = Jenkins.instance.getItem("job-name/branch-name"); job.disable(); 

And then to enable, maybe it could be achieved also programmatically?
def job = Jenkins.instance.getItem("job-name/branch-name"); job.enable(); 


-- 
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/63a5e368-ff1a-4898-b86f-1eee9536961c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable jobs of type Multi-branch?

2017-05-30 Thread Idan Adar
Deleting a branch is definitely not an option.

The actual scenario here is that when end-to-end tests are run, if they fail 
then I want to disable all other jobs (why? Because that's the task I was 
handed... I don't necessarily agree with this...). 

In my case those other jobs are of type multi branch.

I can't delete the branch in question because it is the develop branch... :)

So I'm just looking to programmatically disable such jobs and then how to 
manually enable them (after the issue in the test failure was resolved).

 

Sent from my iPhone

> On 30 May 2017, at 23:47, Stephen Connolly <stephen.alan.conno...@gmail.com> 
> wrote:
> 
> 
>> On Tue 30 May 2017 at 20:36, Idan Adar <i...@adar.me> wrote:
>> I thought this would be possible after the fix in 
>> https://issues.jenkins-ci.org/browse/JENKINS-27299, but apparently not so... 
>> Hence asking here.
> 
> Remove the branch from being discovered... (then it will be an orphaned 
> branch and disabled until eligible for removal according to the orphaned 
> branch strategy you configured)
> 
> Or delete the branch.
> 
>> 
>> Assuming in a Jenkinsfile, that is run as part of a multi-branch type job, I 
>> decide to disable some jobs, e.g:
>> 
>> post {
>>  failure { 
>>   script { 
>>def job = Jenkins.instance.getItem("some-job-name"); job.disable(); 
>>   }
>>  }
>> } 
>> 
>> If this actually works, how could I then re-enable this job given there is 
>> no button in the UI to enable 
> 
> Well you'd commit to the branch again and then the next build of that branch 
> would enable it... oh but you cannot have another build because the branch is 
> disabled...
> 
> This is in part why the functionality you are looking for is not present. 
> Once you disabled the job it would be stuck there forever.
>> (or even disable) a multi-branch 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/57001001-e365-4c14-b901-5ee4f8417bb7%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> Sent from my phone
> -- 
> 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/CwXkESYhfDs/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CA%2BnPnMxORekN_hv_SAuJ2LsaCtYUqZ%2BOr7BCT%2BRQFkEbwktCww%40mail.gmail.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/F0014F29-3255-40C1-86A2-7EC3DD48B42E%40adar.me.
For more options, visit https://groups.google.com/d/optout.


How to disable jobs of type Multi-branch?

2017-05-30 Thread Idan Adar
I thought this would be possible after the fix 
in https://issues.jenkins-ci.org/browse/JENKINS-27299, but apparently not 
so... Hence asking here.

Assuming in a Jenkinsfile, that is run as part of a multi-branch type job, 
I decide to disable some jobs, e.g:

post {
 failure { 
  script { 
   def job = Jenkins.instance.getItem("some-job-name"); job.disable(); 
  }
 }
} 


If this actually works, how could I then re-enable this job given there is 
no button in the UI to enable (or even disable) a multi-branch 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/57001001-e365-4c14-b901-5ee4f8417bb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to start a job from another job in a declarative pipeline?

2017-04-13 Thread Idan Adar
That was it... just had to specify the branch. d'oh.

 build job: '/master', wait: false


On Thursday, April 13, 2017 at 10:42:46 AM UTC+3, Idan Adar wrote:
>
> I should mention that both jobs are multi-branch jobs...
> should the job name also somehow incorporate the branch name? i.e. 
> "develop"
>

-- 
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/8cf41ffa-120c-4e16-a90d-74dc6e1285f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to start a job from another job in a declarative pipeline?

2017-04-13 Thread Idan Adar
I should mention that both jobs are multi-branch jobs...
should the job name also somehow incorporate the branch name? i.e. "develop"

-- 
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/5a844df2-f8a1-42da-88b7-473ab371c656%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to start a job from another job in a declarative pipeline?

2017-04-12 Thread Idan Adar
Yep, found "build" as well. I thought maybe it's done differently in 
declarative pipelines...

Ended up with the following, however despite this, it did not start.

post {
   // Run end-to-end tests, if requested
   success {
  script {
 if (BRANCH_NAME == "develop") {
result = sh (script: "git log -1 | grep '.*\\[e2e\\].*'", 
returnStatus: true) 
if (result == 0) {
   build job: '', wait: false
}
 }
  }
   }
}

The following was logged: 

+ git log -1
+ grep '.*\[e2e\].*'
Run tests [e2e][Pipeline] build (Building )Scheduling item: * 
<https://security-services-jenkins.swg-devops.com/job/certificate-management-end-to-end-testing/>***


But when visiting that job's Stages View, there is no build running.
Could this be because the end-to-end job is also scheduled to run at 
specific time? Its Jenksinfile has the following specified: 

pipeline {
triggers {

cron ('0 12,16,20 * * 1-4,7')
}
...


(run everyday except Friday and Saturday, at 12:00, 16:00 and 20:00).

On Wednesday, April 12, 2017 at 11:40:41 AM UTC+3, Danny Rehelis wrote:
>
> This is how I do this, should be easy enough -
>
> pipeline {
> stages {
> stage ('xxx') {
> steps {
> ...
> ...
> build job: '', parameters: [
> string(name: 'PARAM1', value: "xxx"),
> string(name: 'PARAM2, value: "yyy")
>     ]
> }
>   }
> }
>
>
> On Wed, Apr 12, 2017 at 10:53 AM Idan Adar <id...@adar.me > 
> wrote:
>
>> Hi,
>>
>> Lets assume there are two job:
>>
>> 1. a job for a micro-service repository
>> 2. a job for end-to-end tests
>>
>> I'd like, in specific cases, to start the end-to-end tests job from the 
>> micro-service job.
>> For example, after introducing a change that even though passed unit 
>> testing and integration testing, it needs further testing, available in the 
>> end-to-end tests job.
>>
>> I'd like for the developers to make a commit with a specific phrase, e.g. 
>> "[e2e]" and to use it as follows (just pseudo code for now).
>>
>> pipeline {
>> ...
>> ...
>> stages {
>> ...
>> }
>>
>>
>> post {
>> success {
>> if (BRANCH_NAME == "develop") {
>> result = sh (script: "git log -1 | grep '.*\\[e2e\\].*'", 
>> returnStatus: true) 
>> if (result == 0) {
>> // start the d2d 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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/db4e7ca4-4a8b-4a70-ae49-6595eda541b7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/db4e7ca4-4a8b-4a70-ae49-6595eda541b7%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/aefb5f67-2901-4fa8-8630-e189320a0e8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to start a job from another job in a declarative pipeline?

2017-04-12 Thread Idan Adar
Hi,

Lets assume there are two job:

1. a job for a micro-service repository
2. a job for end-to-end tests

I'd like, in specific cases, to start the end-to-end tests job from the 
micro-service job.
For example, after introducing a change that even though passed unit 
testing and integration testing, it needs further testing, available in the 
end-to-end tests job.

I'd like for the developers to make a commit with a specific phrase, e.g. 
"[e2e]" and to use it as follows (just pseudo code for now).

pipeline {
...
...
stages {
...
}


post {
success {
if (BRANCH_NAME == "develop") {
result = sh (script: "git log -1 | grep '.*\\[e2e\\].*'", 
returnStatus: true) 
if (result == 0) {
// start the d2d 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/db4e7ca4-4a8b-4a70-ae49-6595eda541b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
The thought crossed my mind. Will do just that.

On Friday, April 7, 2017 at 5:34:19 PM UTC+3, Mark Waite wrote:
>
> I think the best thing you could do for the community is document it.  
> Find a reasonable place in the Jenkins Handbook 
> <https://jenkins.io/doc/book/>, and submit a pull request with your 
> information.  That will help others use what you've learned.
>
> Mark Waite
>
> On Fri, Apr 7, 2017 at 8:27 AM Idan Adar <id...@adar.me > 
> wrote:
>
>> Okay, I guess that after the first time the Jenkinsfile is read Jenkins 
>> must have saved this info somewhere as when looking at the job in Jenkins 
>> there is a "View Configuration" button and there you can see the specified 
>> schedule. sigh. I wish that'd be documented...
>>
>> -- 
>> 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/9180e134-f2d4-4c80-936a-9853fd8d8720%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/9180e134-f2d4-4c80-936a-9853fd8d8720%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/74d837e9-7013-485c-9e19-6cb7f3603d91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
Okay, I guess that after the first time the Jenkinsfile is read Jenkins 
must have saved this info somewhere as when looking at the job in Jenkins 
there is a "View Configuration" button and there you can see the specified 
schedule. sigh. I wish that'd be documented...

-- 
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/9180e134-f2d4-4c80-936a-9853fd8d8720%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
Yep, thanks. In my last update I did the same cron as you.
Do you happen to know how does the triggers directive actually works with a 
declarative pipeline (Jenkinsfile)? how does it tell Jenkins to actually 
start the job at the specified hours?

On Friday, April 7, 2017 at 5:08:54 PM UTC+3, Mark Waite wrote:
>
> That same exception is reported when you enter that cron specification 
> into the "Poll SCM" field of a freestyle job.
>
> I think the issue is that you have six fields in your cron specification, 
> while the online help indicates it only accepts 5 fields.
>
> I think you want 'H 12,16,20 * * 1-4,7' or if you really want it at the 
> start of the hour rather than at some time during the hour, then '0 
> 12,16,20 * * 1-4,7'.
>
> Mark Waite
>
> On Fri, Apr 7, 2017 at 8:00 AM Idan Adar <id...@adar.me > 
> wrote:
>
>> oops... disregard the snippet, it was wrong (but the failure is there 
>> anyway).
>>
>> The following is the cron used.
>> I am attempting to run the job at 12:00, 16:00 and 20:00 on 
>> Sunday-Thursday... (every week, every month, every year).
>>
>> triggers {
>>cron '0 12,16,20 * * 1-4,7 *'
>> }
>>
>> The error is the following. Why?
>>
>> Caused by: antlr.ANTLRException: Invalid input: "0 12,16,20 * * 1-4,7 *": 
>> line 1:21: expecting EOF, found ' '
>>
>>
>> The documentation states that  "The Unix cron style syntax is supported."
>> I thus used the following as reference: 
>> http://www.nncron.ru/help/EN/working/cron-format.htm
>>
>> -- 
>> 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/3b6ffda4-1804-420f-9b14-6191ff85c578%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/3b6ffda4-1804-420f-9b14-6191ff85c578%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/69b05c91-d523-4574-b37a-6fa4ae26c7ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
Okay, I tried various variations, this one works: 0 12,16,20 * * 1-4,7
Meaning: "At minute 0 past hour 12, 16, and 20 on every day-of-week from 
Monday through Thursday and Sunday."

Could someone now explain to me how this is supposed to work in Jenkins? 
How will Jenkins know when to actually run it _automatically_? i.e. 
schedule the job to run at the specified hours?

-- 
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/e9b77409-8930-42be-a0d4-8f13cc762ac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
oops... disregard the snippet, it was wrong (but the failure is there 
anyway).

The following is the cron used.
I am attempting to run the job at 12:00, 16:00 and 20:00 on 
Sunday-Thursday... (every week, every month, every year).

triggers {
   cron '0 12,16,20 * * 1-4,7 *'
}

The error is the following. Why?

Caused by: antlr.ANTLRException: Invalid input: "0 12,16,20 * * 1-4,7 *": line 
1:21: expecting EOF, found ' '


The documentation states that  "The Unix cron style syntax is supported."
I thus used the following as 
reference: http://www.nncron.ru/help/EN/working/cron-format.htm

-- 
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/3b6ffda4-1804-420f-9b14-6191ff85c578%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
FYI, The log is from my actual pipeline. The code snippet is just usage 
example.

-- 
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/c91cefca-aef6-4f1b-8c91-fb62b078b3a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting result of a stage in a pipeline job?

2017-04-07 Thread Idan Adar
You could something like the following, where if all actions have worked, 
it'll simply read the slack action and perform it.

stage ("Publish CF app") {
 environment {
JENKINSBOT = credentials('...')
 }
 
 when {
branch "develop"
 }
 
 steps {
script {
   STAGE_NAME = "Publish CF app"
}

// Login and push
sh "cf api ..."
sh "cf login ... -u $JENKINSBOT_USR -p $JENKINSBOT_PSW"
sh "cf push"
  
slackSend (
   color: '#199515',
   message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER> 
passed successfully."
)
 }
  }

You could also use the POST directive inside a stage:

stage {
   steps {
   ...
   }
 
   post {
   success {
   slack...
   }
   failure {
   slack...
   }
}
}

Now, once a stage fails, the whole job fails, so you don't really need to 
handle the failure in each stage. Instead you can also use POST globally:
And as you can see in my first example, I basically set a "STAGE_NAME" in 
each stage and use it in the failure directive globally

stages {
stage {
steps {

}
}


stage {
steps {

}
}


post {
success {

}
failure {
slackSend (
color: '#F01717',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, 
'$STAGE_NAME' stage failed."
 )
}
}
}



On Friday, April 7, 2017 at 1:41:29 PM UTC+3, Per Ostman wrote:
>
> Hi!
>
> I'm trying to figure out how to get hold of the result of a stage in a 
> pipeline job to report progress/status in e g slack as the pipeline stages 
> execute.
>
> Does anyone have any pointers to how to accomplish this?
>
> /P
>

-- 
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/0c9ade5c-4541-4711-bd49-7cd5f8add805%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use trigger directive in a declarative pipeline?

2017-04-07 Thread Idan Adar
It sounds obvious from reading the docs 
,
 
but...

In a multi-branch pipeline there is no UI in Jenkins for defining a 
schedule to decide when should the job run automatically.
It seems that the following should do so, I don't understand how, given the 
file has to be read first after a checkout... but anyway...

I added the following triggers directive:

stages
triggers {
cron('H 4/* 0 0 1-5')
}


stage ("...") {
...
}
}


But once running the job with this directive, it fails with the following:

java.lang.IllegalArgumentException: Could not instantiate 
> {properties=[org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty@1523de8c,
>  
> @pipelineTriggers(=[@cron(=0 12,16,20 0 0 0)])]} for 
> JobPropertyStep
> ...
> ...


-- 
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/12df9e26-665b-4039-ae36-d68bc99cdc9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: After uninstalling Blue Ocean 1.0, link to build in GitHub remains with /blue, leading to 404

2017-04-06 Thread Idan Adar
When uninstalling, make sure to search for both "blue ocean" and 
"blueocean". There were a couple of additional plugins not uninstalled yet, 
one of which handled the redirect from github to /blue.

On Thursday, April 6, 2017 at 10:13:04 PM UTC+3, Liam Newman wrote:
>
>
> Sounds like there needs to be a setting for that.
>
> Please file an issue on https://issues.jenkins-ci.org .
>
> I just popped over to the gitter channel for blue ocean (
> https://gitter.im/jenkinsci/blueocean-plugin) to ask about this, too.  
>
>
> On Thursday, April 6, 2017 at 8:46:11 AM UTC-7, Idan Adar wrote:
>>
>> Perhaps Liam (CCed) can help?
>>
>> On Thursday, April 6, 2017 at 5:41:03 PM UTC+3, Idan Adar wrote:
>>>
>>> Apparently after installing Blue Ocean, the build check links in GitHub 
>>> were changed to /blue. Was this mentioned somewhere?
>>> After uninstalling Blue Ocean (I uninstalled all "blue ocean" plugins), 
>>> the link remains... but now it leads to 404, because whatever /blue is, 
>>> it's no longer available.
>>>
>>> How can I fix 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/fd11e3bc-24e6-4581-82d6-8304d079029f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to replace withCredentials([usernamePassword ... with credentials(...)

2017-04-06 Thread Idan Adar
The problem was that it's not "PWD" but "PSW"...

On Thursday, April 6, 2017 at 6:26:00 PM UTC+3, Idan Adar wrote:
>
> In declarative pipeline, one can use credentials() instead 
> of withCredentials, but I am not really sure how this works. In general, 
> lots of examples are missing...
>
> Assuming I've created in Jenkins a credential for an access token, I can 
> do this:
>
> stage ("Merge pull request") {
> environment {
>  ACCESS_TOKEN = credentials('credentials_id')
> }
>   
> steps {
> ... $ACCESS_TOKEN
> }
> }
>
> But how do I handle username/password variables with credentials()?
> Assuming I've created credentials for a username/password combination, 
> previously it'd be like this:
>
> withCredentials([usernamePassword(credentialsId: 'credentials_id', 
> usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {   
>
> ... $USERNAME
> ... $PASSWORD
> }
>
>

-- 
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/f4c9858f-96c7-4113-955f-617d7686a90c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to replace withCredentials([usernamePassword ... with credentials(...)

2017-04-06 Thread Idan Adar
There's a missing ' below, just a copy/paste mistake. The error still 
happens, and also with a different credential, the same one used for the 
checkout... so I know 100% that the values in it are valid and working... 
but it fails with that _PWD...

On Thursday, April 6, 2017 at 9:05:27 PM UTC+3, Idan Adar wrote:
>
> The following resulted in an exception during runtime.
>
> groovy.lang.MissingPropertyException: No such property: UP_PWD for class: 
> groovy.lang.Binding
>   at groovy.lang.Binding.getVariable(Binding.java:63)
>   at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
>   at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
>   at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
>   at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
>   at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
>   at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
>   at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
>   at 
> com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:28)
>   at 
> com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
>   at WorkflowScript.run(WorkflowScript:126)
> ...
> ...
>
>
>
>
> stage ("...") {
>  environment {
> UP = credentials('...)
>  }
>  
>  when {
> branch "develop"
>  }
>  
>  steps {
> 
> sh "cf login ... -u $UP_USR -p $UP_PWD"
>  }
>   }
>
>
> On Thursday, April 6, 2017 at 7:42:04 PM UTC+3, Andrew Bayer wrote:
>>
>> FOO = credentials('id') will create environment variables FOO_USR and 
>> FOO_PWD
>>
>> On Apr 6, 2017 8:42 AM, "Idan Adar" <id...@adar.me> wrote:
>>
>> Perhaps Robert (CCed) can help?
>>
>>
>> On Thursday, April 6, 2017 at 6:26:00 PM UTC+3, Idan Adar wrote:
>>>
>>> In declarative pipeline, one can use credentials() instead 
>>> of withCredentials, but I am not really sure how this works. In general, 
>>> lots of examples are missing...
>>>
>>> Assuming I've created in Jenkins a credential for an access token, I can 
>>> do this:
>>>
>>> stage ("Merge pull request") {
>>> environment {
>>>  ACCESS_TOKEN = credentials('credentials_id')
>>> }
>>>   
>>> steps {
>>> ... $ACCESS_TOKEN
>>> }
>>> }
>>>
>>> But how do I handle username/password variables with credentials()?
>>> Assuming I've created credentials for a username/password combination, 
>>> previously it'd be like this:
>>>
>>> withCredentials([usernamePassword(credentialsId: 'credentials_id', 
>>> usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {   
>>>
>>> ... $USERNAME
>>> ... $PASSWORD
>>> }
>>>
>>> -- 
>> 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/f25e52a4-f28a-4738-8901-c3500bd1d952%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/f25e52a4-f28a-4738-8901-c3500bd1d952%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/8bd0281e-b42e-47a0-9631-8aa4f39a1d31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to replace withCredentials([usernamePassword ... with credentials(...)

2017-04-06 Thread Idan Adar
The following resulted in an exception during runtime.

groovy.lang.MissingPropertyException: No such property: UP_PWD for class: 
groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at 
org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at 
com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:28)
at 
com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.run(WorkflowScript:126)
...
...




stage ("...") {
 environment {
UP = credentials('...)
 }
 
 when {
branch "develop"
 }
 
 steps {

sh "cf login ... -u $UP_USR -p $UP_PWD"
 }
  }


On Thursday, April 6, 2017 at 7:42:04 PM UTC+3, Andrew Bayer wrote:
>
> FOO = credentials('id') will create environment variables FOO_USR and 
> FOO_PWD
>
> On Apr 6, 2017 8:42 AM, "Idan Adar" <id...@adar.me > wrote:
>
> Perhaps Robert (CCed) can help?
>
>
> On Thursday, April 6, 2017 at 6:26:00 PM UTC+3, Idan Adar wrote:
>>
>> In declarative pipeline, one can use credentials() instead 
>> of withCredentials, but I am not really sure how this works. In general, 
>> lots of examples are missing...
>>
>> Assuming I've created in Jenkins a credential for an access token, I can 
>> do this:
>>
>> stage ("Merge pull request") {
>> environment {
>>  ACCESS_TOKEN = credentials('credentials_id')
>> }
>>   
>> steps {
>> ... $ACCESS_TOKEN
>> }
>> }
>>
>> But how do I handle username/password variables with credentials()?
>> Assuming I've created credentials for a username/password combination, 
>> previously it'd be like this:
>>
>> withCredentials([usernamePassword(credentialsId: 'credentials_id', 
>> usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {   
>>
>> ... $USERNAME
>> ... $PASSWORD
>> }
>>
>> -- 
> 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/f25e52a4-f28a-4738-8901-c3500bd1d952%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/f25e52a4-f28a-4738-8901-c3500bd1d952%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/38a60623-c2ce-40c9-8fcd-a31acf264e73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Valid use of environment directive

2017-04-06 Thread Idan Adar
script { } it is... :/

On Thursday, April 6, 2017 at 7:39:27 PM UTC+3, Andrew Bayer wrote:
>
> No, that's definitely not intended to work that way, and it probably won't 
> work. 
>
> On Apr 6, 2017 9:09 AM, "Idan Adar" <id...@adar.me > wrote:
>
>> Yes, that's how I do it in my actual Jenkinsfile, but I thought maybe in 
>> a Declarative pipeline this works differently...
>>
>> On Thursday, April 6, 2017 at 6:57:13 PM UTC+3, Danny Rehelis wrote:
>>>
>>> Encapsulate MY_VAR in script { } blocked required to set a variable when 
>>> using declarative pipeline inside a Stage. 
>>>
>>> No need to declare it with-in environment { }. 
>>>
>>> On Thu, Apr 6, 2017, 18:42 Idan Adar <id...@adar.me> wrote:
>>>
>>>> Perhaps Robert (CCed) can help?
>>>>
>>>>
>>>> On Thursday, April 6, 2017 at 6:08:18 PM UTC+3, Idan Adar wrote:
>>>>>
>>>>> Is this a valid use of environment directive and variables in 
>>>>> declarative pipeline?
>>>>>
>>>>> pipeline {
>>>>>environment {
>>>>>MY_VAR = null
>>>>>}  
>>>>>
>>>>>
>>>>>stages {
>>>>>   stage ("...") {
>>>>>  steps {
>>>>>  MY_VAR = "this_stage"
>>>>>  }
>>>>>   }
>>>>>   stage ("...") {
>>>>>  steps {
>>>>>  MY_VAR = "this_stage2"
>>>>>  }
>>>>>   }
>>>>>   }
>>>>>   
>>>>>   post {
>>>>>   success {
>>>>>   slackSend (
>>>>> message: "$STAGE_NAME stage failed."
>>>>>  )
>>>>>   }
>>>>>   }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> -- 
>>>> 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/76f4796b-9bee-455f-8c95-decdff8da6fb%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/76f4796b-9bee-455f-8c95-decdff8da6fb%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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/4c7b1a85-8fde-435a-bee2-45275b787aa1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/4c7b1a85-8fde-435a-bee2-45275b787aa1%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/f8dd7c08-6f2c-4948-ad28-583fbc2dfb77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Valid use of environment directive

2017-04-06 Thread Idan Adar
Yes, that's how I do it in my actual Jenkinsfile, but I thought maybe in a 
Declarative pipeline this works differently...

On Thursday, April 6, 2017 at 6:57:13 PM UTC+3, Danny Rehelis wrote:
>
> Encapsulate MY_VAR in script { } blocked required to set a variable when 
> using declarative pipeline inside a Stage. 
>
> No need to declare it with-in environment { }. 
>
> On Thu, Apr 6, 2017, 18:42 Idan Adar <id...@adar.me > wrote:
>
>> Perhaps Robert (CCed) can help?
>>
>>
>> On Thursday, April 6, 2017 at 6:08:18 PM UTC+3, Idan Adar wrote:
>>>
>>> Is this a valid use of environment directive and variables in 
>>> declarative pipeline?
>>>
>>> pipeline {
>>>environment {
>>>MY_VAR = null
>>>}  
>>>
>>>
>>>stages {
>>>   stage ("...") {
>>>  steps {
>>>  MY_VAR = "this_stage"
>>>  }
>>>   }
>>>   stage ("...") {
>>>  steps {
>>>  MY_VAR = "this_stage2"
>>>  }
>>>   }
>>>   }
>>>   
>>>   post {
>>>   success {
>>>   slackSend (
>>> message: "$STAGE_NAME stage failed."
>>>  )
>>>   }
>>>   }
>>>
>>> }
>>>
>>>
>>> -- 
>> 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/76f4796b-9bee-455f-8c95-decdff8da6fb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/76f4796b-9bee-455f-8c95-decdff8da6fb%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/4c7b1a85-8fde-435a-bee2-45275b787aa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: After uninstalling Blue Ocean 1.0, link to build in GitHub remains with /blue, leading to 404

2017-04-06 Thread Idan Adar
Perhaps Liam (CCed) can help?

On Thursday, April 6, 2017 at 5:41:03 PM UTC+3, Idan Adar wrote:
>
> Apparently after installing Blue Ocean, the build check links in GitHub 
> were changed to /blue. Was this mentioned somewhere?
> After uninstalling Blue Ocean (I uninstalled all "blue ocean" plugins), 
> the link remains... but now it leads to 404, because whatever /blue is, 
> it's no longer available.
>
> How can I fix 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/94a2f0c2-885b-493f-87e1-b402fbf579c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to replace withCredentials([usernamePassword ... with credentials(...)

2017-04-06 Thread Idan Adar
Perhaps Robert (CCed) can help?

On Thursday, April 6, 2017 at 6:26:00 PM UTC+3, Idan Adar wrote:
>
> In declarative pipeline, one can use credentials() instead 
> of withCredentials, but I am not really sure how this works. In general, 
> lots of examples are missing...
>
> Assuming I've created in Jenkins a credential for an access token, I can 
> do this:
>
> stage ("Merge pull request") {
> environment {
>  ACCESS_TOKEN = credentials('credentials_id')
> }
>   
> steps {
> ... $ACCESS_TOKEN
> }
> }
>
> But how do I handle username/password variables with credentials()?
> Assuming I've created credentials for a username/password combination, 
> previously it'd be like this:
>
> withCredentials([usernamePassword(credentialsId: 'credentials_id', 
> usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {   
>
> ... $USERNAME
> ... $PASSWORD
> }
>
>

-- 
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/f25e52a4-f28a-4738-8901-c3500bd1d952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Valid use of environment directive

2017-04-06 Thread Idan Adar
Perhaps Robert (CCed) can help?

On Thursday, April 6, 2017 at 6:08:18 PM UTC+3, Idan Adar wrote:
>
> Is this a valid use of environment directive and variables in declarative 
> pipeline?
>
> pipeline {
>environment {
>MY_VAR = null
>}  
>
>
>stages {
>   stage ("...") {
>  steps {
>  MY_VAR = "this_stage"
>  }
>   }
>   stage ("...") {
>  steps {
>  MY_VAR = "this_stage2"
>  }
>   }
>   }
>   
>   post {
>   success {
>   slackSend (
> message: "$STAGE_NAME stage failed."
>  )
>   }
>   }
>
> }
>
>
>

-- 
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/76f4796b-9bee-455f-8c95-decdff8da6fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to replace withCredentials([usernamePassword ... with credentials(...)

2017-04-06 Thread Idan Adar
In declarative pipeline, one can use credentials() instead 
of withCredentials, but I am not really sure how this works. In general, 
lots of examples are missing...

Assuming I've created in Jenkins a credential for an access token, I can do 
this:

stage ("Merge pull request") {
environment {
 ACCESS_TOKEN = credentials('credentials_id')
}
  
steps {
... $ACCESS_TOKEN
}
}

But how do I handle username/password variables with credentials()?
Assuming I've created credentials for a username/password combination, 
previously it'd be like this:

withCredentials([usernamePassword(credentialsId: 'credentials_id', 
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {   

... $USERNAME
... $PASSWORD
}

-- 
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/a2b12a7e-dd47-410c-a92e-b8c8ef45cb33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Valid use of environment directive

2017-04-06 Thread Idan Adar
Is this a valid use of environment directive and variables in declarative 
pipeline?

pipeline {
   environment {
   MY_VAR = null
   }  


   stages {
  stage ("...") {
 steps {
 MY_VAR = "this_stage"
 }
  }
  stage ("...") {
 steps {
 MY_VAR = "this_stage2"
 }
  }
  }
  
  post {
  success {
  slackSend (
message: "$STAGE_NAME stage failed."
 )
  }
  }

}


-- 
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/6ca3e69a-43ca-4fb5-a2f2-ad03403651c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


After uninstalling Blue Ocean 1.0, link to build in GitHub remains with /blue, leading to 404

2017-04-06 Thread Idan Adar
Apparently after installing Blue Ocean, the build check links in GitHub 
were changed to /blue. Was this mentioned somewhere?
After uninstalling Blue Ocean (I uninstalled all "blue ocean" plugins), the 
link remains... but now it leads to 404, because whatever /blue is, it's no 
longer available.

How can I fix 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/9874e22e-7ee4-41d1-bb82-4821e9bebfa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Blue Ocean 1.0 is now available

2017-04-05 Thread Idan Adar
Looks great!
Question: in the 'regular UI' I can separate/organize jobs into 
categories/different tabs. In Blue Ocean there is no such separation? Can 
this be achieved somehow?

A use case would be two teams using the same Jenkins instance, so need some 
sort of job ordering/separation. 

On Thursday, April 6, 2017 at 3:22:49 AM UTC+3, James Dumay wrote:
>
> Hi everyone,
>
> We are happy to announce the general availability of Blue Ocean 1.0 - you 
> can read all about it on the Jenkins blog 
> .
>
> Thank you everyone for your ideas, bug reports and enthusiasm - its the 
> users who make the Jenkins project truely awesome! 
>
> Thanks,
> James
>
> P.S. It would be great if you could help us get the word out by sharing 
> the news about the release on social media. The fancy new Blue Ocean 
> project page  has a quick way to 
> share on Twitter, Facebook and LinkedIn.
>

-- 
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/28cb8c7c-ef08-470f-8e76-c5f0bae02907%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Disable new jobs if a build fails

2017-04-05 Thread Idan Adar
Looks like this is the 
solution: https://issues.jenkins-ci.org/browse/JENKINS-27299
But only once it actually get merged. Otherwise this is a no-go for 
multi-branch pipelines...


On Tuesday, April 4, 2017 at 12:07:55 PM UTC+3, Idan Adar wrote:
>
> Thanks!
>
> I looked at the job, which is a multi-branch pipeline, and I did not see 
> any disable or enable button. So assume the job does get somehow disabled 
> via code, how would I enable it (manually)? only by code?
>
> On Tue, Apr 4, 2017 at 11:35 AM, 'Maciej Jaros' via Jenkins Users <
> jenkinsci-users@googlegroups.com> wrote:
>
>> Idan Adar (2017-04-03 15:11):
>>
>> Hello, 
>>
>> I received a request, which sounds kinda far-fetched to me, but maybe I 
>> wrong.
>>
>> Lets assume there is a job that is scheduled to run 3 times ago. End to 
>> end sort of tests. And at some point one of the job runs fails.
>> The request here is to block all future PRs for any repository in GitHub 
>> from triggering their respective jobs (each repo has a Jenkinsfile, a PR 
>> triggers it).
>>
>> Is this at all possible? Blocking all jobs until an error is fixed?
>>
>>
>> I think you would have to manually enable builds after the error is 
>> fixed, but you can disable builds with Groovy:
>> def job = Jenkins.instance.getItem("your-job-name");
>> job.disable()
>> //job.enable()
>>
>> Regards,
>> Nux.
>>
>> -- 
>> 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/YcdTo2AZgiA/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/f5fecaad-dbc3-d665-c35f-15e97345d2fa%40mol.com.pl
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/f5fecaad-dbc3-d665-c35f-15e97345d2fa%40mol.com.pl?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> *Idan Adar*
>

-- 
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/02cc3246-25cf-4b74-ba25-29ac580da16e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Disable new jobs if a build fails

2017-04-04 Thread Idan Adar
Thanks!

I looked at the job, which is a multi-branch pipeline, and I did not see
any disable or enable button. So assume the job does get somehow disabled
via code, how would I enable it (manually)? only by code?

On Tue, Apr 4, 2017 at 11:35 AM, 'Maciej Jaros' via Jenkins Users <
jenkinsci-users@googlegroups.com> wrote:

> Idan Adar (2017-04-03 15:11):
>
> Hello,
>
> I received a request, which sounds kinda far-fetched to me, but maybe I
> wrong.
>
> Lets assume there is a job that is scheduled to run 3 times ago. End to
> end sort of tests. And at some point one of the job runs fails.
> The request here is to block all future PRs for any repository in GitHub
> from triggering their respective jobs (each repo has a Jenkinsfile, a PR
> triggers it).
>
> Is this at all possible? Blocking all jobs until an error is fixed?
>
>
> I think you would have to manually enable builds after the error is fixed,
> but you can disable builds with Groovy:
> def job = Jenkins.instance.getItem("your-job-name");
> job.disable()
> //job.enable()
>
> Regards,
> Nux.
>
> --
> 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/YcdTo2AZgiA/unsubscribe.
> To unsubscribe from this group and all its topics, 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/f5fecaad-dbc3-d665-c35f-15e97345d2fa%40mol.com.pl
> <https://groups.google.com/d/msgid/jenkinsci-users/f5fecaad-dbc3-d665-c35f-15e97345d2fa%40mol.com.pl?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Idan Adar*

-- 
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/CAA6x3weEutHAa%2BtMVK2qurGcJX0ykt7r9KWQFAsaob6tFfQ%3DHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Disable new jobs if a build fails

2017-04-03 Thread Idan Adar
Hello,

I received a request, which sounds kinda far-fetched to me, but maybe I 
wrong.

Lets assume there is a job that is scheduled to run 3 times ago. End to end 
sort of tests. And at some point one of the job runs fails.
The request here is to block all future PRs for any repository in GitHub 
from triggering their respective jobs (each repo has a Jenkinsfile, a PR 
triggers it).

Is this at all possible? Blocking all jobs until an error is fixed?

-- 
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/bfb817b4-eb2d-4c27-b48b-8fbb06e42597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to skip a build after a "git push" done by a Jenkinsfile

2017-03-25 Thread Idan Adar
At last, resolved using parameters, when and expression blocks.
See 
here: 
http://stackoverflow.com/questions/43016942/can-a-jenkins-job-be-aborted-with-success-result

-- 
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/fe5bcea7-305e-45b2-b9e1-750bc243574b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to skip a build after a "git push" done by a Jenkinsfile

2017-03-25 Thread Idan Adar
I am now attempting to solve this use the environment, when and expression 
blocks.
Could some please take a 
look? 
http://stackoverflow.com/questions/43016942/can-a-jenkins-job-be-aborted-with-success-result

-- 
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/3c884828-05c1-4038-8864-e0e5fae9e727%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to skip a build after a "git push" done by a Jenkinsfile

2017-03-25 Thread Idan Adar
Thus far I have tried:

* success ("...") -- build stops with "failed" status
* sh "exit 0" -- build doesn't stop (continues to the next stage in the 
pipeline)

I think "exit 0" is the way to go, but didn't yet figure out exactly how... 

On Saturday, March 25, 2017 at 1:01:15 PM UTC+3, Stephen Connolly wrote:
>
> Skipping polling from the git plugin is not an option for branch sources
>
> The branch source tracks last revision built for each branch and fires a 
> build of the current revision is not equal to the last.
>
> What you want is a build step that stops the build with an "ignore" status 
> of some sort.
>
> On Sat 25 Mar 2017 at 09:52, Idan Adar <id...@adar.me > 
> wrote:
>
>> As Mark mentioned, the alternative is to trigger an exception... (which 
>> will in turn show the row in red color).
>> I do it as follows. After checking out, if a git commit includes "[ci 
>> skip]" I use a "success" keyword (this keyword does not exit) hence the 
>> build stops.
>>
>> I would love for this keyword to exist, so that the job will stop with a 
>> green row instead of a red row... Is this possible?
>>
>> stage ("Checkout SCM") {
>> steps {
>> script {
>>STAGE_NAME = "Checkout SCM"
>>
>>checkout scm
>>result = sh (script: "git log -1 | grep '.*\\[ci skip\\].*'", 
>> returnStatus: true) 
>>if (result == 0) {
>>   echo ("'ci skip' spotted in git commit. Aborting.")
>>   success ("'ci skip' spotted in git commit. Aborting.")
>>}
>> }
>> }
>> }
>>
>> -- 
>> 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/cd25bb36-d893-4281-a04e-d5a6bb54f6b8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/cd25bb36-d893-4281-a04e-d5a6bb54f6b8%40googlegroups.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/720a5799-1150-462a-afe8-55d3e01636ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to skip a build after a "git push" done by a Jenkinsfile

2017-03-25 Thread Idan Adar
As Mark mentioned, the alternative is to trigger an exception... (which 
will in turn show the row in red color).
I do it as follows. After checking out, if a git commit includes "[ci 
skip]" I use a "success" keyword (this keyword does not exit) hence the 
build stops.

I would love for this keyword to exist, so that the job will stop with a 
green row instead of a red row... Is this possible?

stage ("Checkout SCM") {
steps {
script {
   STAGE_NAME = "Checkout SCM"
   
   checkout scm
   result = sh (script: "git log -1 | grep '.*\\[ci skip\\].*'", 
returnStatus: true) 
   if (result == 0) {
  echo ("'ci skip' spotted in git commit. Aborting.")
  success ("'ci skip' spotted in git commit. Aborting.")
   }
}
}
}

-- 
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/cd25bb36-d893-4281-a04e-d5a6bb54f6b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >