Re: Node troubles

2018-03-08 Thread Sam K
Hi

  Thanks For the reply.  But it does not explain why it works most of the 
times and why it stops working all of a sudden.  For example since I posted 
this, the server has been rebooted and it has been running fine for a week 
now.  

thanks


On Saturday, March 3, 2018 at 10:23:51 PM UTC-8, Ramanathan Muthaiah wrote:
>
> Hello Sam,
>
> Looks like something gone wrong here (in the pipeline script), extracted 
> from the stacktrace in your post.
>
> >>>
>
> at 
> com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
>   at WorkflowScript.run(WorkflowScript:343)
>   at ___cps.transform___(Native Method)
>
>
> /Ram
>
> On Friday, March 2, 2018 at 11:26:46 PM UTC+5:30, Sam K wrote:
>>
>> Hello
>>
>>I have about 20 nodes of various RHEL versions and one team's nodes 
>> always pose certain problems and cause their pipelines to fail.  For a 
>> while, I was able to get them to pass by 'bringing nodes online on-demand' 
>> because it would refresh the connection.  But lately that strategy has also 
>> failed.  The slaves had a higher version of Java than the master and after 
>> updating the master the problem seemed to go away only to come back again 
>> like this.  If I disconnect, offline the node and bring it back, the logs 
>> are clean. But once the pipeline starts running again, it fails.  Any help 
>> would be much appreciated.  Thanks. 
>>
>>
>>I'm running Jenkins master version: 2.91.  
>>
>> JDK version on master RHEL-7
>> [sup...@10.0.156.53 ~]$ java -version
>> openjdk version "1.8.0_141"
>> OpenJDK Runtime Environment (build 1.8.0_141-b16)
>> OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)
>>
>> Slave - 
>> RHEL 7.3
>> openjdk version "1.8.0_131"
>> OpenJDK Runtime Environment (build 1.8.0_131-b11)
>> OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
>>
>> Pipeline fails with such errors:
>>
>> [Pipeline] End of Pipelinejava.io.EOFException
>>  at 
>> java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2638)
>>  at 
>> java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3113)
>>  at 
>> java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:853)
>>  at java.io.ObjectInputStream.(ObjectInputStream.java:349)
>>  at 
>> hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48)
>>  at 
>> hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
>>  at 
>> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
>> Caused: java.io.IOException: Unexpected termination of the channel
>>  at 
>> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
>> Caused: hudson.remoting.ChannelClosedException: Remote call on 10.0.135.15 
>> failed. The channel is closing down or has closed down
>>  at hudson.remoting.Channel.call(Channel.java:901)
>>  at hudson.FilePath.act(FilePath.java:986)
>>  at hudson.FilePath.act(FilePath.java:975)
>>  at hudson.FilePath.mkdirs(FilePath.java:1158)
>>  at 
>> org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.(FileMonitoringTask.java:113)
>>  at 
>> org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.(BourneShellScript.java:198)
>>  at 
>> org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.(BourneShellScript.java:190)
>>  at 
>> org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:111)
>>  at 
>> org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:64)
>>  at 
>> org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:177)
>>  at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:224)
>>  at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
>>  at 
>> org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
>>  at sun.reflect.GeneratedMethodAccessor5286.invoke(Unknown Source)
>>  at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>  at java.lang.reflect.Method.invoke(Method.java:498)
>>  at 
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>>  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>>  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
>>  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>>  at 
>> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
>>  at 
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>  at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>>  at 

Re: Declarative Pipeline multiple agents Error

2018-03-08 Thread Matthew Ceroni
Take back what I said about the durable directory, they exist in both cases 
in this situation. So the below works. But if I have a global agent and try 
to over-ride that at a stage level I get the error about durable doesn't 
exist. 

On Thursday, March 8, 2018 at 1:28:04 PM UTC-8, Matthew Ceroni wrote:
>
> Ran another test that seems to validate somewhat of what I said above. 
> Instead of having a global agent I specified an agent per stage (2 stages)
>
> In this situation the first agent created the workspace, checked out the 
> code and the durable- directory existed.
>
> When it got to the second stage and connected to the docker container it 
> created the workspace but not the durable- directory but at the same time 
> didn't complain about it like the above error message.
>
>
> #!/usr/bin/env groovy
> @Library('shared-library@1.1.0') _
>
> pipeline {
>   agent none
>   stages {
>
> stage('Build') {
>   agent {
> kubernetes {
>   label buildId()
>   containerTemplate {
> name 'node'
> image 'node:8.9.4-alpine'
> ttyEnabled true
> command 'cat'
>   }
> }
>   }
>   steps {
> sh "echo npm run build"
> sh "/bin/sleep 120"
> 
> // stash build directory
> //stash includes: 'build/**', name: 'app'
>   }
> }
>
> stage('Package') {
>   agent { node { label 'docker1' } }
>   options { skipDefaultCheckout() }
>   steps {
> sh "/bin/sleep 120"
>   }
> }
> 
>   }
> }
>
>
>
>
>
>
>
> On Thursday, March 8, 2018 at 1:19:31 PM UTC-8, Matthew Ceroni wrote:
>>
>> I have the following example pipeline
>>
>> #!/usr/bin/env groovy
>> @Library('shared-library@1.1.0') _
>>
>> pipeline {
>>   agent {
>> kubernetes {
>>   label buildId()
>>   containerTemplate {
>> name 'node'
>> image 'node:8.9.4-alpine'
>> ttyEnabled true
>> command 'cat'
>>   }
>> }
>>   }
>>   stages {
>>
>> 
>> stage('Build') {
>>   steps {
>> sh "echo npm run build"
>> 
>> // stash build directory
>> //stash includes: 'build/**', name: 'app'
>>   }
>> }
>>
>> stage('Unit Test') {
>>   steps {
>> script {
>>   try {
>> sh "echo npm run test"
>>   } catch (err) {
>> println "Failed"
>>   //} finally {
>>// junit 'build/reports/**/*.xml'
>>   }
>> }
>>   }
>> }
>> 
>> stage('Package') {
>>   agent { node { label 'docker1' } }
>>   options { skipDefaultCheckout() }
>>   steps {
>> sh "/bin/sleep 120"
>>   }
>> }
>> 
>>   }
>> }
>>
>>
>> What happens is that on the Package stage I get the following error:
>>
>> [_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ]
>>  Running shell script
>> sh: can't create 
>> /home/jenkins/workspace/_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ@tmp/durable-de461dce/jenkins-log.txt:
>>  nonexistent directory
>>
>>
>> Since the node I am accessing in that step is a container I thought maybe it 
>> was a permissions issue. However I validated this wasn't the case by making 
>> that agent (node { label 'docker1' }} the top level agent and the pipeline 
>> runs fine. 
>>
>>
>> So my thought is that during the switch between agents/nodes it is expecting 
>> that directory to exist (it does create the workspace directory though, just 
>> not durable).
>>
>>
>> Any help would be appreciated.
>>
>>
>> Thanks
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/97ac2329-1926-4956-a974-c44341c6fd67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Declarative Pipeline multiple agents Error

2018-03-08 Thread Matthew Ceroni
Ran another test that seems to validate somewhat of what I said above. 
Instead of having a global agent I specified an agent per stage (2 stages)

In this situation the first agent created the workspace, checked out the 
code and the durable- directory existed.

When it got to the second stage and connected to the docker container it 
created the workspace but not the durable- directory but at the same time 
didn't complain about it like the above error message.


#!/usr/bin/env groovy
@Library('shared-library@1.1.0') _

pipeline {
  agent none
  stages {

stage('Build') {
  agent {
kubernetes {
  label buildId()
  containerTemplate {
name 'node'
image 'node:8.9.4-alpine'
ttyEnabled true
command 'cat'
  }
}
  }
  steps {
sh "echo npm run build"
sh "/bin/sleep 120"

// stash build directory
//stash includes: 'build/**', name: 'app'
  }
}

stage('Package') {
  agent { node { label 'docker1' } }
  options { skipDefaultCheckout() }
  steps {
sh "/bin/sleep 120"
  }
}

  }
}







On Thursday, March 8, 2018 at 1:19:31 PM UTC-8, Matthew Ceroni wrote:
>
> I have the following example pipeline
>
> #!/usr/bin/env groovy
> @Library('shared-library@1.1.0') _
>
> pipeline {
>   agent {
> kubernetes {
>   label buildId()
>   containerTemplate {
> name 'node'
> image 'node:8.9.4-alpine'
> ttyEnabled true
> command 'cat'
>   }
> }
>   }
>   stages {
>
> 
> stage('Build') {
>   steps {
> sh "echo npm run build"
> 
> // stash build directory
> //stash includes: 'build/**', name: 'app'
>   }
> }
>
> stage('Unit Test') {
>   steps {
> script {
>   try {
> sh "echo npm run test"
>   } catch (err) {
> println "Failed"
>   //} finally {
>// junit 'build/reports/**/*.xml'
>   }
> }
>   }
> }
> 
> stage('Package') {
>   agent { node { label 'docker1' } }
>   options { skipDefaultCheckout() }
>   steps {
> sh "/bin/sleep 120"
>   }
> }
> 
>   }
> }
>
>
> What happens is that on the Package stage I get the following error:
>
> [_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ]
>  Running shell script
> sh: can't create 
> /home/jenkins/workspace/_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ@tmp/durable-de461dce/jenkins-log.txt:
>  nonexistent directory
>
>
> Since the node I am accessing in that step is a container I thought maybe it 
> was a permissions issue. However I validated this wasn't the case by making 
> that agent (node { label 'docker1' }} the top level agent and the pipeline 
> runs fine. 
>
>
> So my thought is that during the switch between agents/nodes it is expecting 
> that directory to exist (it does create the workspace directory though, just 
> not durable).
>
>
> Any help would be appreciated.
>
>
> Thanks
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/49f8742c-0210-4850-abd3-adb7928dd076%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Declarative Pipeline multiple agents Error

2018-03-08 Thread Matthew Ceroni
I have the following example pipeline

#!/usr/bin/env groovy
@Library('shared-library@1.1.0') _

pipeline {
  agent {
kubernetes {
  label buildId()
  containerTemplate {
name 'node'
image 'node:8.9.4-alpine'
ttyEnabled true
command 'cat'
  }
}
  }
  stages {


stage('Build') {
  steps {
sh "echo npm run build"

// stash build directory
//stash includes: 'build/**', name: 'app'
  }
}

stage('Unit Test') {
  steps {
script {
  try {
sh "echo npm run test"
  } catch (err) {
println "Failed"
  //} finally {
   // junit 'build/reports/**/*.xml'
  }
}
  }
}

stage('Package') {
  agent { node { label 'docker1' } }
  options { skipDefaultCheckout() }
  steps {
sh "/bin/sleep 120"
  }
}

  }
}


What happens is that on the Package stage I get the following error:

[_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ]
 Running shell script
sh: can't create 
/home/jenkins/workspace/_location-service_PR-2-head-RP4JKIYE4QYJREC2YOQQGNKQG5UC56YLZET3VDC2IPW4C5FSH7EQ@tmp/durable-de461dce/jenkins-log.txt:
 nonexistent directory


Since the node I am accessing in that step is a container I thought maybe it 
was a permissions issue. However I validated this wasn't the case by making 
that agent (node { label 'docker1' }} the top level agent and the pipeline runs 
fine. 


So my thought is that during the switch between agents/nodes it is expecting 
that directory to exist (it does create the workspace directory though, just 
not durable).


Any help would be appreciated.


Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/cf5d0491-00ac-4c41-860f-49f926b9d461%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem by calling puppet script on LINUX

2018-03-08 Thread Felipe Grucci
I have the same error, but when I run the "puppet agent -t" command with a 
Jenkins job in a Windows environment

In Jenkins I have a Job with Powershell scripts that calls the PUPPET AGENT 
-T

Thanks in Advanced

Em quinta-feira, 29 de outubro de 2015 11:41:47 UTC-2, Wei Chen escreveu:
>
> Hi,
>
> I created a job in Jenkins which will start the puppet agent with command:
> puppet agent -t
>
> This command works fine under LINUX.
>
> But as I build the job in Jenkins I got following errors:
> ...
>
> Started by user anonymous 
> Building in workspace /var/lib/jenkins/jobs/TestPuppet/workspace
> [workspace] $ /bin/sh -xe /tmp/hudson50649338283499454.sh
> + puppet agent -t
>  [1;35merr: /File[/home/jenkins/.puppet]/ensure: change from absent to 
> directory failed: Cannot create /home/jenkins/.puppet; parent directory 
> /home/jenkins does not exist [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl]: Skipping because of failed 
> dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certificate_requests]: 
> Dependency File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certificate_requests]: 
> Skipping because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var]: Skipping because of failed 
> dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/log]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/log]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/facts]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/facts]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/clientbucket]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/clientbucket]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/state]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/state]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/state/graphs]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/state/graphs]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/lib]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/lib]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/client_data]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/client_data]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl/private_keys]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl/private_keys]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/client_yaml]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/client_yaml]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/var/run]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/var/run]: Skipping because of 
> failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl/public_keys]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl/public_keys]: Skipping 
> because of failed dependencies [0m
>  [0;36mnotice: /File[/home/jenkins/.puppet/ssl/certs]: Dependency 
> File[/home/jenkins/.puppet] has failures: true [0m
>  [0;33mwarning: /File[/home/jenkins/.puppet/ssl/certs]: Skipping because of 
> failed dependencies [0m
> Could not prepare for execution: Got 1 failure(s) while initializing: change 
> from absent to directory failed: Cannot create /home/jenkins/.puppet; parent 
> directory /home/jenkins does not exist
> Build step 'Execute shell' marked build as failure
> Finished: FAILURE
>
>
>
>
>
> Can someone help?
>
>
>
> Regards
>
>

-- 
You received this message because you are subscribed to the 

Re: Powershell Yarn Execution

2018-03-08 Thread Joe Cavanaugh


[SOE.POC] Running batch script
> C:\Jenkins\workspace\SOE.POC\SOE.POC>yarn install --frozen-lockfile 
> yarn install v1.5.1
> warning package.json: No license field
> warning soe@0.0.0: No license field
> [1/4] Resolving packages...
> success Already up-to-date.
> Done in 1.33s.
> [Pipeline] }
> [Pipeline] // dir
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // timeout
> [Pipeline] }
> [Pipeline] // withCredentials
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> Finished: SUCCESS

For comparison  

> [SOE.POC] Running PowerShell script
> yarn install v1.5.1
> powershell.exe : warning package.json: No license field
> At 
> C:\Jenkins\workspace\SOE.POC\SOE.POC@tmp\durable-c8ac6911\powershellWrapper.ps1:3
>  char:1
> + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File ...
> + ~
> + CategoryInfo  : NotSpecified: (warning package.json: No license 
> field:String) [], RemoteException
> + FullyQualifiedErrorId : NativeCommandError
>  
> warning soe@0.0.0: No license field
> [1/4] Resolving packages...
> success Already up-to-date.
> Done in 2.41s.
> [Pipeline] }
> [Pipeline] // dir
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // timeout
> [Pipeline] }
> [Pipeline] // withCredentials
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> ERROR: script returned exit code 1
> Finished: FAILURE


On Thursday, March 8, 2018 at 11:17:10 AM UTC-6, Joe Cavanaugh wrote:
>
> Yep - the middle section of the first post is when I ran directly as the 
> user on the server. The error codes are fine and the build worked just 
> great. It appears to only be an issue when transferring back information to 
> Jenkins to continue doing the pipeline. 
>
> On Thursday, March 8, 2018 at 9:31:45 AM UTC-6, slide wrote:
>>
>> Have you tried running the same command in powershell directly to see if 
>> the behavior is just powershell itself?
>>
>> On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh  
>> wrote:
>>
>>> bat 'yarn install' works fine. It seems that the powershell key word 
>>> does not work correctly in declarative pipelines consistently. 
>>>
>>> On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:

 I didn't post the error message : 

 ERROR: script returned exit code 1
 Finished: FAILURE


 On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
>
> stage('Build') {
>   steps {
> powershell '''
> Write-Output "Starting Yarn Install"
> try {
> \$ErrorActionPreference = 'Stop'
> yarn install
> } catch {
> Write-Output "Install failed : \$PSItem"
> }
> '''
>   }
> }
>
> However, when I run the command on the server itself in the directory, 
> all i get is 
>
>> yarn install v1.5.1
>>
>> yarn : warning package.json: No license field
>>
>> At line:1 char:19
>>
>> + try { yarn install --frozen-lockfile } catch {  
>>>   ...
>>
>> +   ~~
>>
>> + CategoryInfo  : NotSpecified: (warning package.json: No 
>>> license field:String) [], RemoteException
>>
>> + FullyQualifiedErrorId : NativeCommandError
>>
>>
>>> warning soe@0.0.0: No license field
>>
>> [1/4] Resolving packages...
>>
>> success Already up-to-date.
>>
>> Done in 2.16s.
>>
>> [blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
>>
>> 0
>>
>>
> Seems to me that the powershell method is incorrectly interpreting the 
> warning as a remote exception... The catch never gets hit, and even if I 
> set the $global:LASTEXITCODE to zero after the yarn install line it still 
> fails. 
>
> Any hints as to what else to try or consider would be greatly 
> appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with 
> Powershell 
> version 5.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-use...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%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 

Re: Powershell Yarn Execution

2018-03-08 Thread Joe Cavanaugh
Yep - the middle section of the first post is when I ran directly as the 
user on the server. The error codes are fine and the build worked just 
great. It appears to only be an issue when transferring back information to 
Jenkins to continue doing the pipeline. 

On Thursday, March 8, 2018 at 9:31:45 AM UTC-6, slide wrote:
>
> Have you tried running the same command in powershell directly to see if 
> the behavior is just powershell itself?
>
> On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh  > wrote:
>
>> bat 'yarn install' works fine. It seems that the powershell key word does 
>> not work correctly in declarative pipelines consistently. 
>>
>> On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
>>>
>>> I didn't post the error message : 
>>>
>>> ERROR: script returned exit code 1
>>> Finished: FAILURE
>>>
>>>
>>> On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:

 stage('Build') {
   steps {
 powershell '''
 Write-Output "Starting Yarn Install"
 try {
 \$ErrorActionPreference = 'Stop'
 yarn install
 } catch {
 Write-Output "Install failed : \$PSItem"
 }
 '''
   }
 }

 However, when I run the command on the server itself in the directory, 
 all i get is 

> yarn install v1.5.1
>
> yarn : warning package.json: No license field
>
> At line:1 char:19
>
> + try { yarn install --frozen-lockfile } catch {  
>>   ...
>
> +   ~~
>
> + CategoryInfo  : NotSpecified: (warning package.json: No 
>> license field:String) [], RemoteException
>
> + FullyQualifiedErrorId : NativeCommandError
>
>
>> warning soe@0.0.0: No license field
>
> [1/4] Resolving packages...
>
> success Already up-to-date.
>
> Done in 2.16s.
>
> [blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
>
> 0
>
>
 Seems to me that the powershell method is incorrectly interpreting the 
 warning as a remote exception... The catch never gets hit, and even if I 
 set the $global:LASTEXITCODE to zero after the yarn install line it still 
 fails. 

 Any hints as to what else to try or consider would be greatly 
 appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell 
 version 5.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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/6b3b58f6-a870-43d6-800f-6396329ad8b0%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/bdb03d61-ee14-4e06-aecd-e6bf3c8aef78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pipeline: Resource Locking Plugin hangs

2018-03-08 Thread Sverre Moe


torsdag 8. mars 2018 12.37.47 UTC+1 skrev Reinhold Füreder følgende:
>
> Very naïve thought(s):
>
>  
>
> While “*Do not know why nodeName1 acquired the lock before nodeName 
> released.*“ might be just a matter of output flushing/buffering, 
>
I thought so also, probably because of parallell execution.
 

“*The entire build hangs and goes no further.*” sounds really frightening 
> to me.
>
>  
>
> Maybe it is the usage of lock inside parallel step and/or some CPS 
> transformation reason, or some little resource misconfiguration issue!?
>
>  
>
> Ignoring CPS transformations (due to parallel step) I assume/hope the lock 
> plugin does unit testing the “normal” parallelization usage of locking 
> resources?
>

Perhaps a bug in Lockable Resource Plugin. 
There is no output of CPS transformation exception, nor any other error 
output. It just hangs after the first acquired resource lock is finished.

-- 
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/b7baa7e7-4042-4792-873b-6a1f47f8cf83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Powershell Yarn Execution

2018-03-08 Thread Slide
Have you tried running the same command in powershell directly to see if
the behavior is just powershell itself?

On Thu, Mar 8, 2018 at 8:20 AM Joe Cavanaugh 
wrote:

> bat 'yarn install' works fine. It seems that the powershell key word does
> not work correctly in declarative pipelines consistently.
>
> On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
>>
>> I didn't post the error message :
>>
>> ERROR: script returned exit code 1
>> Finished: FAILURE
>>
>>
>> On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
>>>
>>> stage('Build') {
>>>   steps {
>>> powershell '''
>>> Write-Output "Starting Yarn Install"
>>> try {
>>> \$ErrorActionPreference = 'Stop'
>>> yarn install
>>> } catch {
>>> Write-Output "Install failed : \$PSItem"
>>> }
>>> '''
>>>   }
>>> }
>>>
>>> However, when I run the command on the server itself in the directory,
>>> all i get is
>>>
 yarn install v1.5.1

 yarn : warning package.json: No license field

 At line:1 char:19

 + try { yarn install --frozen-lockfile } catch {
> ...

 +   ~~

 + CategoryInfo  : NotSpecified: (warning package.json: No
> license field:String) [], RemoteException

 + FullyQualifiedErrorId : NativeCommandError


> warning soe@0.0.0: No license field

 [1/4] Resolving packages...

 success Already up-to-date.

 Done in 2.16s.

 [blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE

 0


>>> Seems to me that the powershell method is incorrectly interpreting the
>>> warning as a remote exception... The catch never gets hit, and even if I
>>> set the $global:LASTEXITCODE to zero after the yarn install line it still
>>> fails.
>>>
>>> Any hints as to what else to try or consider would be greatly
>>> appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell
>>> version 5.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/6b3b58f6-a870-43d6-800f-6396329ad8b0%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/CAPiUgVctZwinoaGVSpXwAAuUJwdB45WWfcn%2BN%2Bt1uF4kK7Ykow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Powershell Yarn Execution

2018-03-08 Thread Joe Cavanaugh
bat 'yarn install' works fine. It seems that the powershell key word does 
not work correctly in declarative pipelines consistently. 

On Thursday, March 8, 2018 at 9:02:38 AM UTC-6, Joe Cavanaugh wrote:
>
> I didn't post the error message : 
>
> ERROR: script returned exit code 1
> Finished: FAILURE
>
>
> On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
>>
>> stage('Build') {
>>   steps {
>> powershell '''
>> Write-Output "Starting Yarn Install"
>> try {
>> \$ErrorActionPreference = 'Stop'
>> yarn install
>> } catch {
>> Write-Output "Install failed : \$PSItem"
>> }
>> '''
>>   }
>> }
>>
>> However, when I run the command on the server itself in the directory, 
>> all i get is 
>>
>>> yarn install v1.5.1
>>>
>>> yarn : warning package.json: No license field
>>>
>>> At line:1 char:19
>>>
>>> + try { yarn install --frozen-lockfile } catch {
 ...
>>>
>>> +   ~~
>>>
>>> + CategoryInfo  : NotSpecified: (warning package.json: No 
 license field:String) [], RemoteException
>>>
>>> + FullyQualifiedErrorId : NativeCommandError
>>>
>>>
 warning soe@0.0.0: No license field
>>>
>>> [1/4] Resolving packages...
>>>
>>> success Already up-to-date.
>>>
>>> Done in 2.16s.
>>>
>>> [blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
>>>
>>> 0
>>>
>>>
>> Seems to me that the powershell method is incorrectly interpreting the 
>> warning as a remote exception... The catch never gets hit, and even if I 
>> set the $global:LASTEXITCODE to zero after the yarn install line it still 
>> fails. 
>>
>> Any hints as to what else to try or consider would be greatly 
>> appreciated. Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell 
>> version 5.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/6b3b58f6-a870-43d6-800f-6396329ad8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Powershell Yarn Execution

2018-03-08 Thread Joe Cavanaugh
I didn't post the error message : 

ERROR: script returned exit code 1
Finished: FAILURE


On Wednesday, March 7, 2018 at 4:51:41 PM UTC-6, Joe Cavanaugh wrote:
>
> stage('Build') {
>   steps {
> powershell '''
> Write-Output "Starting Yarn Install"
> try {
> \$ErrorActionPreference = 'Stop'
> yarn install
> } catch {
> Write-Output "Install failed : \$PSItem"
> }
> '''
>   }
> }
>
> However, when I run the command on the server itself in the directory, all 
> i get is 
>
>> yarn install v1.5.1
>>
>> yarn : warning package.json: No license field
>>
>> At line:1 char:19
>>
>> + try { yarn install --frozen-lockfile } catch {
>>> ...
>>
>> +   ~~
>>
>> + CategoryInfo  : NotSpecified: (warning package.json: No 
>>> license field:String) [], RemoteException
>>
>> + FullyQualifiedErrorId : NativeCommandError
>>
>>
>>> warning soe@0.0.0: No license field
>>
>> [1/4] Resolving packages...
>>
>> success Already up-to-date.
>>
>> Done in 2.16s.
>>
>> [blwdsoabuild4]: PS C:\Jenkins\workspace\SOE.POC> echo $LASTEXITCODE
>>
>> 0
>>
>>
> Seems to me that the powershell method is incorrectly interpreting the 
> warning as a remote exception... The catch never gets hit, and even if I 
> set the $global:LASTEXITCODE to zero after the yarn install line it still 
> fails. 
>
> Any hints as to what else to try or consider would be greatly appreciated. 
> Yarn Version is 1.5.2 and Node is LTS (8.9.4) with Powershell version 5.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/e1bd6e18-3b45-4a10-a6ce-d722e9634a35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins hangs after executing SSH Command

2018-03-08 Thread stefan . schumacher . netfed
Hello

I have a Jenkins job which is supposed to execute a command after uploading 
to the webserver. It's a simple script which kills the current npm process, 
writes the date to a file and restarts the server. 

#!/bin/bash
kill $(ps faux | grep server.js | grep node | cut -f2 -d' ')
cd /var/www/chatbot
date >> chatbot.log
nohup npm start &

When I execute it as user www-data on the console everything works fine. 
Unfortunately this is not the case when running from Jenkins. Jenkins 
executes the command, receives the following output and then stalls 
until I kill the build manually. How can I force Jenkins to disconnect and 
consider the build a success after executing server-neustart?

SSH: EXEC: STDOUT/STDERR from command [/usr/local/bin/server-neustart] ...
> NetFed-Chatbot@0.1.1 start /var/www/chatbot
> node server.js


Yours Sincerely
Stefan

-- 
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/5ca619de-71d9-466d-9207-606c05955155%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does anybody maintain thinBackup plugin?

2018-03-08 Thread Oleg Nenashev
Pinged the maintainer in GitHub: 
https://github.com/jenkinsci/thin-backup-plugin/pull/9
So far there is no evidence that the plugin is not maintained. I usually 
judge by GitHub (stale pull requests), not by JIRA.

On Wednesday, March 7, 2018 at 5:13:31 PM UTC+1, Emil Wypych wrote:
>
> Hello everyone!
>
> I wonder if anybody maintains the thinBackup plugin. I see a lot of 
> untaken issues in JIRA and don't have any idea where should I report that. 
> The last official version was released on 25 Nov 2016. There is no 
> information about "ready for adoption". Issues are not being resolved (even 
> issues with many watchers and vote on them). Does anyone know anything 
> 'bout that?
>
> Thanks in advance for any feedback.
>
> Regards,
> Emil Wypych
>

-- 
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/a27fa0df-69a0-4fbe-9b5f-a612e30e5d58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Pipeline: Resource Locking Plugin hangs

2018-03-08 Thread Reinhold Füreder
Very naïve thought(s):

While “Do not know why nodeName1 acquired the lock before nodeName released.“ 
might be just a matter of output flushing/buffering, “The entire build hangs 
and goes no further.” sounds really frightening to me.

Maybe it is the usage of lock inside parallel step and/or some CPS 
transformation reason, or some little resource misconfiguration issue!?

Ignoring CPS transformations (due to parallel step) I assume/hope the lock 
plugin does unit testing the “normal” parallelization usage of locking 
resources?

-- 
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/VI1P190MB025507E38826DF5579877B8CF7DF0%40VI1P190MB0255.EURP190.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Pipeline: Resource Locking Plugin hangs

2018-03-08 Thread Sverre Moe
Lockable Resource Plugin
Lockable Resources Manager
  Lockable Resources
 resource: testing1-repository, labels:testing-repository
 resource: testing2-repository, labels:testing-repository
 resource: testing3-repository, labels:testing-repository


Configured these 3 resources in Jenkins. Different resource name and same 
label on all three resources.

Pipeline script:
def stepsForParallel = [:]
stepsForParallel["nodeName1"] = transformIntoStep("nodeName1")
stepsForParallel["nodeName2"] = transformIntoStep("nodeName2")
stepsForParallel["nodeName3"] = transformIntoStep("nodeName3")
stepsForParallel["nodeName4"] = transformIntoStep("nodeName4")

parallel stepsForParallel

def transformIntoStep(nodeName) {
   return {
   node("master") {
   if (nodeName.equals("nodeName4")) {
   lock(label: "testing-repository") {
   println "Testing lock label"
   sleep 20
   }
   } else {
   sleep 5 /* to make sure nodeName4 aquires its lock first. */
   if (nodeName.equals("nodeName1")) {
   lock(resource: 'testing1-repository') {
   println "Testing lock resource"
   sleep 10
   }   
}

if (nodeName.equals("nodeName2")) {
   lock(resource: 'testing2-repository') {
   println "Testing lock resource"
   sleep 10
   }   
}

if (nodeName.equals("nodeName3")) {
   lock(resource: 'testing3-repository') {
   println "Testing lock resource"
   sleep 10
   }   
}
   }
   }
   }
}


[Pipeline] parallel
[Pipeline] [nodeName1] { (Branch: nodeName1)
[Pipeline] [nodeName2] { (Branch: nodeName2)
[Pipeline] [nodeName3] { (Branch: nodeName3)
[Pipeline] [nodeName4] { (Branch: nodeName4)
[Pipeline] [nodeName1] node
[nodeName1] Running on Jenkins in /var/lib/jenkins/workspace/pipeline-test
[Pipeline] [nodeName2] node
[nodeName2] Running on Jenkins in /var/lib/jenkins/workspace/pipeline-test@2
[Pipeline] [nodeName3] node
[nodeName3] Running on Jenkins in /var/lib/jenkins/workspace/pipeline-test@3
[Pipeline] [nodeName4] node
[Pipeline] [nodeName1] {
[Pipeline] [nodeName2] {
[Pipeline] [nodeName3] {
[nodeName4] Running on Jenkins in /var/lib/jenkins/workspace/pipeline-test@4
[Pipeline] [nodeName1] sleep
[nodeName1] Sleeping for 5 sec
[Pipeline] [nodeName2] sleep
[nodeName2] Sleeping for 5 sec
[Pipeline] [nodeName3] sleep
[nodeName3] Sleeping for 5 sec
[Pipeline] [nodeName4] {
[Pipeline] [nodeName4] lock
[nodeName4] Trying to acquire lock on [Label: testing-repository]
[nodeName4] Lock acquired on [Label: testing-repository]
[Pipeline] [nodeName4] {
[Pipeline] [nodeName4] echo
[nodeName4] Testing lock label
[Pipeline] [nodeName4] sleep
[nodeName4] Sleeping for 20 sec
[Pipeline] [nodeName1] lock
[nodeName1] Trying to acquire lock on [testing1-repository]
[nodeName1] Found 0 available resource(s). Waiting for correct amount: 1.
[nodeName1] [testing1-repository] is locked, waiting...
[Pipeline] [nodeName2] lock
[nodeName2] Trying to acquire lock on [testing2-repository]
[nodeName2] Found 0 available resource(s). Waiting for correct amount: 1.
[nodeName2] [testing2-repository] is locked, waiting...
[Pipeline] [nodeName3] lock
[nodeName3] Trying to acquire lock on [testing3-repository]
[nodeName3] Found 0 available resource(s). Waiting for correct amount: 1.
[nodeName3] [testing3-repository] is locked, waiting...
[nodeName1] Lock acquired on [testing1-repository]
[Pipeline] [nodeName4] }
[nodeName4] Lock released on resource [Label: testing-repository]
[Pipeline] [nodeName1] {
[Pipeline] [nodeName4] // lock
[Pipeline] [nodeName4] }
[Pipeline] [nodeName1] echo
[nodeName1] Testing lock resource
[Pipeline] [nodeName1] sleep
[nodeName1] Sleeping for 10 sec
[Pipeline] [nodeName4] // node
[Pipeline] [nodeName4] }
[Pipeline] [nodeName1] }
[nodeName1] Lock released on resource [testing1-repository]
[Pipeline] [nodeName1] // lock
[Pipeline] [nodeName1] }
[Pipeline] [nodeName1] // node
[Pipeline] [nodeName1] }


Does not work as I expected it to.
When nodeName4 releases the testing-repository which contains 3 resources, 
then the other can acquire the lock on their resources. However only one of 
them does so, the others do not. The entire build hangs and goes no 
further. 

[nodeName1] Lock acquired on [testing1-repository]
[nodeName4] Lock released on resource [Label: testing-repository]
[nodeName1] Lock released on resource [testing1-repository]

Do not know why nodeName1 acquired the lock before nodeName released.

This is the output I expected:
[nodeName4] Trying to acquire lock on [Label: testing-repository]
[nodeName4] Lock acquired on [Label: testing-repository]
[nodeName4] Lock released on resource [Label: testing-repository]
[nodeName1]