Re: Restrict on which node a scripted pipeline executes

2018-04-14 Thread srivathsa . puliyala
You can use:

*node ('Jenkins_slaveName'){*
*   *
*}*

On Monday, April 9, 2018 at 4:52:57 AM UTC-4, F'nale wrote:
>
> Hi All,
> I have a pipeline that schedules various jobs. Each job runs on a specific 
> node.
> The problem occurs after the pipeline has been started and the first job 
> was scheduled. The pipeline takes the node on which the first job needs to 
> execute. I end up with a loop where the first job is waiting for its node, 
> on which the pipeline is executing while the pipeline waits for the first 
> job to execute.
> My pipeline is scripted. I need a way to restrict it to one node.
> Help?
>
>

-- 
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/0b487c1b-4bb5-4222-8c54-c8eb66c585a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins not running on apache server

2018-04-14 Thread Mark Waite
 Jenkins does not support jdk 10. Use jdk 8.

Mark Waite

On Fri, Apr 13, 2018, 5:11 PM Vikas Gupta  wrote:

> Hi all,
> I am getting the below error while starting the tomcat server , trying to
> run jenkins on tomcat server, how do i troubleshoot this problem?
> i am using JAVA 10 and tomcat 8.5.3
> Please help me.
>
>
> 14-Apr-2018 02:36:21.129 WARNING [Jenkins initialization thread]
> hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to
> instantiate Key[type=org.jenkinsci.main.modules.sshd.ItemListenerImpl,
> annotation=[none]]; skipping this component
>  com.google.inject.ProvisionException: Unable to provision, see the
> following errors:
>
> 1) null returned by binding at
> hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:508)
>  but org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd is not @Nullable
>   while locating org.jenkinsci.main.modules.sshd.SSHD
> for field at
> org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd(ItemListenerImpl.java:14)
>
> 1 error
> at
> com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
> at
> com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
> at
> hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
> at
> com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
> at
> com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
> at
> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
> at
> com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
> at
> hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
> at
> hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
> at
> hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:482)
> at hudson.ExtensionList.load(ExtensionList.java:366)
> at hudson.ExtensionList.ensureLoaded(ExtensionList.java:304)
> at hudson.ExtensionList.iterator(ExtensionList.java:158)
> at jenkins.model.Jenkins.(Jenkins.java:967)
> at hudson.model.Hudson.(Hudson.java:85)
> at hudson.model.Hudson.(Hudson.java:81)
> at hudson.WebAppMain$3.run(WebAppMain.java:233)
> 14-Apr-2018 02:36:21.129 INFO [Jenkins initialization thread]
> hudson.WebAppMain$3.run Jenkins is fully up and running
> 14-Apr-2018 02:36:25.936 WARNING [Monitoring thread for Free Swap Space
> started on Sat Apr 14 02:36:25 IST 2018]
> hudson.node_monitors.AbstractAsyncNodeMonitorDescriptor.monitor Failed to
> monitor master for Free Swap Space
>  java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError:
> Could not initialize class com.sun.jna.Pointer
> at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
> at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
> at hudson.remoting.LocalChannel$2.get(LocalChannel.java:81)
> at
> hudson.node_monitors.AbstractAsyncNodeMonitorDescriptor.monitor(AbstractAsyncNodeMonitorDescriptor.java:96)
> at
> hudson.node_monitors.AbstractNodeMonitorDescriptor$Record.run(AbstractNodeMonitorDescriptor.java:305)
> Caused by: java.lang.NoClassDefFoundError: Could not initialize class
> com.sun.jna.Pointer
> at com.sun.jna.Structure.(Structure.java:2078)
> at org.jvnet.hudson.Windows.monitor(Windows.java:42)
> at
> hudson.node_monitors.SwapSpaceMonitor$MonitorTask.call(SwapSpaceMonitor.java:124)
> at
> hudson.node_monitors.SwapSpaceMonitor$MonitorTask.call(SwapSpaceMonitor.java:114)
> at hudson.remoting.LocalChannel$1.call(LocalChannel.java:52)
> at
> jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
> at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.base/java.lang.Thread.run(Unknown Source)
>
> --
> 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/f7404b07-848d-4061-8a70-ffc91d2e32fb%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 

Re: println in "call()" in "vars/xx.groovy" shows in console, but println in defed method in class in "vars/xx.groovy" is just ignored

2018-04-14 Thread Ilguiz Latypov


On Saturday, 11 February 2017 00:49:42 UTC-5, David Karr wrote:
>
> I'm seeing some odd behavior with "println" calls in shared library 
> methods, and a perhaps related issue with printing a shared library object 
> in a Jenkinsfile.
>

Nice to see an answer to this by Jon S a month later where he suggested to 
pass the "this" reference to the "src" class instance (apparently it has an 
interface Script).  Calling script.echo("...") in a method of that instance 
will work.  (Without binding to the script object, my bare "echo" in an 
"src" instance method resulted in a silent termination of the step).

Jon S also suggested to add a @NonCPS annotation to the "src" instance 
methods and declare the "src" class Serializable to allow executing the 
method from the context of a slave node.

https://stackoverflow.com/questions/42149652/println-in-call-method-of-vars-foo-groovy-works-but-not-in-method-in-class

-- 
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/bf532834-56f4-450b-ade9-3757cc481311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access environment variable in email ext template using Jenkins pipeline

2018-04-14 Thread srivathsa . puliyala
Didn't help when I replaced with *ENV(var="PROJNAME") *in template file*. *I 
received the email as:
##
This is a Heading

Job is ENV(var="PROJNAME")
##


On Friday, April 13, 2018 at 7:12:58 PM UTC-4, slide wrote:
>
> You can use ENV(var="PROJNAME") when using a script template. This should 
> work for all tokens.
>
> On Fri, Apr 13, 2018 at 4:11 PM  
> wrote:
>
>> I am trying to attach the template file using Jenkins pipeline, emailext. 
>> Variable (PROJNAME) is not accessible in the template file and I am 
>> receiving exceptions as an email:
>>
>> *Exception raised during template rendering: No such property: env for 
>> class: SimpleTemplateScript21 groovy.lang.MissingPropertyException: No such 
>> property: env for class: SimpleTemplateScript21 at 
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
>>  
>> at 
>> org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
>>  
>> at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
>>  
>> at SimpleTemplateScript21.run(SimpleTemplateScript21.groovy:1) at 
>> groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.java:168)
>>  
>> at 
>> groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine.java:180)
>>  
>> at 
>> hudson.plugins.emailext.plugins.content.ScriptContent.renderTemplate(ScriptContent.java:151)
>>  
>> at 
>> hudson.plugins.emailext.plugins.content.ScriptContent.evaluate(ScriptContent.java:82)
>>  
>> at 
>> org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:208)
>>  
>> at org.jenkinsci.plugins.tokenmacro.Parser.processToken(Parser.java:308) at 
>> org.jenkinsci.plugins.tokenmacro.Action$KiHW1UeqOdqAwZul.run(Unknown 
>> Source) at 
>> org.parboiled.matchers.ActionMatcher.match(ActionMatcher.java:96) at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39) 
>> at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at 
>> org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) 
>> at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at 
>> org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72) 
>> at 
>> org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86)
>>  
>> at 
>> org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66)
>>  
>> at 
>> org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:81)
>>  
>> at 
>> org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:76)
>>  
>> at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68) at 
>> org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:204) at 
>> org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:234) 
>> at 
>> hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:80)
>>  
>> at 
>> hudson.plugins.emailext.ExtendedEmailPublisher.addContent(ExtendedEmailPublisher.java:862)
>>  
>> at 
>> hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:741)
>>  
>> at 
>> hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:451)
>>  
>> at 
>> hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:224)
>>  
>> at 
>> hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:163)
>>  
>> at 
>> org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
>>  
>> at hudson.security.ACL.impersonate(ACL.java:260) at 
>> 

Re: Jenkins Pipeline to be generic

2018-04-14 Thread Srivathsa Reddy
For multiple usages of withCredentials:

node {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
  credentialsId: "TokenID_1",
  usernameVariable: 'USERNAME_1',
  passwordVariable: 'PASSWORD_1']]) {

  stage('stage1'){

  

  }

}
withCredentials([[$class: 'UsernamePasswordMultiBinding',
  credentialsId: "TokenID_2",
  usernameVariable: 'USERNAME_2',
  passwordVariable: 'PASSWORD_2']]) {

  stage('stage2'){

  

  }

}
}




On Fri, Apr 13, 2018 at 6:12 PM,  wrote:

> You can use *withCredentials*
>
> https://jenkins.io/doc/pipeline/steps/credentials-binding/
>
>
> On Thursday, April 12, 2018 at 3:06:19 PM UTC-4, krish wrote:
>>
>> Hi,
>>
>> how can we use the multiple credentials into jenkins pipeline, in our
>> environment diff applications have diff userid and password, is their a
>> smarter way to define this in jenkins pipeline
>>
>> thank you
>>
> --
> 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/d8855c70-3343-4fce-862c-1293ffb3ce1a%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/CAFB%2B0W6VLjZc5NTkgoEgW6OBWw7Q2WZjn%3DFD%2BwOGkXD8S5pxeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: BlueOcean observations from user

2018-04-14 Thread Sverre Moe
lørdag 14. april 2018 01.04.29 UTC+2 skrev vivek følgende:
>
>
> What are branches sorted by? It is certainly not Branch, Completed or any 
>> of the other columns. It seems none of the visible columns are used for 
>> sort criteria.
>>
>
> ​We show pagin​ated list of branches. Branches are sorted thru different 
> criteria, more or less in this order:
>
> 1. Default branch (e.g. master on GitHub)
> 2. Favorites ordered by last run time
> 3. Branches ordered by  run finish time
> 4. Branches ordered by  run start time
>
> The code that does it is here: 
> https://github.com/jenkinsci/blueocean-plugin/blob/b640430ffc4931860d97088f9c69084e2b5abf0c/blueocean-pipeline-api-impl/src/main/java/io/jenkins/blueocean/rest/impl/pipeline/BranchContainerImpl.java#L182
>  
> 
>
> Perhaps add a custom filter/ordering to Branches. For us on Branches we 
want to see on top are master and our release branches, while the rest 
could be alphabetic and/or by favorites. Perhaps have it configurable what 
constitutes as default branch or branches.
Ordering by run time is pointless, as it has no value. Perhaps it has value 
for some, therefore a custom ordering would help all the others.


> I had to click "Show more" 7 times to find the master branch (all the way 
>> down to the bottom). Perhaps list the branches set by the user as favorites.
>> Our developers want the master branch and our release branches (could be 
>> achived by setting a filter to sort by) to the first branches they see 
>> information about.
>>
>
> ​If you have favorited brach​ it should appear as long as it is actively 
> built. If you identify different behavior than what is expected given the 
> ordering code, open a JIRA.
>
>>
>> The master branch was all the way down to the bottom, and it is the most 
built branch. My favorite branches was everywhere in between. 

-- 
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/8190da98-a1bf-46a6-945b-65361a8106f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.