Re: Reserving a display on each node

2023-05-28 Thread opayq-gg
Hi,

have you considered naming the resource "${NODE_NAME}-display"?

AFAIK you dont need to create them beforehand, lockable resources plugin 
creates missing resources automatically (temporarily).

BR

On 28 May 2023 11:33:10 CEST, "list+io.jenkins.users via Jenkins Users" 
 wrote:
>Hello!
>
>I have a few build nodes on physical machines. Each machine has a
>GPU/display. I have a large set of projects (100+). For each project,
>each commit is built on all nodes using a pipeline (so there's a stage
>for "build on Linux", "build on Windows", etc). Some projects require
>access to a display in order to run automated tests for UIs, but most
>don't. When a build _does_ require access to a display, it really
>needs to be the only build using that display at any given time so that
>tests running in multiple projects don't trample on each other.
>
>It sounds like what I want is a lockable resource; when a project is
>configured to require a display, it should use a pipeline that locks a
>display resource and then gives it back at the end of the build. That
>way, two builds on the same node don't interfere with each other's UI
>tests, and that builds don't require access to a display can still
>execute concurrently on the node.
>
>The problem: It doesn't seem like lockable resources are associated
>with nodes. It's not really clear to me how I can declare that each
>node has exactly one lockable display resource, and how I can express
>in each pipeline "lock the display resource available on this node".
>
>Is there some way to do this? Are lockable resources actually what I
>need? Maybe there's some other plugin better suited to this.
>
>-- 
>Mark Raynsford | https://www.io7m.com
>
>-- 
>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/20230528093310.535e8312%40workstation01.int.arc7.info.

-- 
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/CBFEBB41-2405-4B09-8726-8A2ACB4B5E9E%40chsc.de.


Re: nexusUser and nexusPassword

2023-01-21 Thread opayq-gg
Hi,

if you use nexusUser and nexusPassword in build.gradle like that, you can 
(ab)use environment variables to inject the credentials from Jenkins to Gradle 
as project properties (which you can access the same way as gradle properties).

https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties

> If the environment variable name looks like 
> ORG_GRADLE_PROJECT_prop=somevalue, then Gradle will set a prop property on 
> your project object, with the value of somevalue. 

Note _prop is case-sensitive, i.e. it would be ORG_GRADLE_PROJECT_nexusUser, 
*not* _NEXUSUSER.

https://plugins.jenkins.io/credentials-binding/ (should be installed by default)
https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-secure-guide/injecting-secrets
 (cloudbees is the company behind jenkins)

BR

On 21 January 2023 19:54:14 CET, 'Martin Schmude' via Jenkins Users 
 wrote:
>You should make use of the Jenkins credentials store.
>https://www.jenkins.io/doc/book/using/using-credentials/
>Several kinds of secrets can be stored there. Type "User and password" 
>suits your needs.
>
>How to use that in your pipeline script:
>https://www.jenkins.io/doc/pipeline/steps/credentials-binding/
>
>
>mats...@gmail.com schrieb am Freitag, 20. Januar 2023 um 21:37:38 UTC+1:
>
>> Hi,
>>
>> Here is my build.gradle:
>>
>> repositories {
>> mavenLocal()
>> mavenCentral()
>> // nexus credentials (nexusUser and nexusPassword) are stored in 
>> ~/.gradle/gradle.properties
>> maven {
>> url "${nexusRepoUrl}/repository/maven-public/"
>> credentials {
>> username = nexusUser
>> password = nexusPassword
>> }
>> }
>> }
>>
>> How can I provide nexusUser and nexusPassword to the job (ideally 
>> globally)?
>>
>> Regards, Sunil
>>
>>
>
>-- 
>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/696d22d9-16ad-4a97-877a-ff9510a6be74n%40googlegroups.com.

-- 
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/0E83DF9A-1454-429F-8DB5-DA47171F6A3B%40chsc.de.


Re: Groovy Script

2022-12-13 Thread opayq-gg
How exactly do you pass the properties to ant?

On 12 December 2022 22:16:36 CET, "eric@gmail.com"  
wrote:
>Can someone please give me some println's I can put in there to figure out 
>why it's not setting the build_result variable?  It doesn't make any sense 
>to me that it works on one server but not another.  Thanks!
>
>On Monday, December 12, 2022 at 8:46:27 AM UTC-7 eric@gmail.com wrote:
>
>> That's interesting.  The println looks like it should be correct:
>>
>> upstream result: success
>>
>> Later when I try to use the variable in an ant call, it just shows the 
>> variable instead of the value of it:
>>
>> -Dbuild_result=${build_result}
>>
>> I put it in the properties of the ant call:
>>
>> full.buildnumber=${full.buildnumber}
>> build.time=${build.time}
>> pk_build=${pk_build}
>> build_result=${build_result}
>>
>> This has always worked in the past, just not since this latest upgrade of 
>> jenkins.  I'm now on 2.375.1.
>>
>> On Friday, December 9, 2022 at 9:50:34 PM UTC-7 opay...@chsc.de wrote:
>>
>>> Hi,
>>>
>>> you mean upstreamResult/build_result?
>>>
>>> What does the println for upstreamResult say?
>>> Which Jenkins version are you on?
>>>
>>> BR :)
>>>
>>>
>>> On 9 December 2022 22:56:29 CET, "eric@gmail.com"  
>>> wrote:

 Hi!  Not sure what's going on but I have a groovy script that has been 
 setting the variable build_status for ages but it stopped working.  
  Doesn't set the variable any longer.  Any ideas?  Here's the script:

 import hudson.model.*

 import jenkins.model.*

   

 def resolver = Thread.currentThread().executable.buildVariableResolver

 def parent_job = resolver.resolve("upstream_job")

 def parent_build_number = resolver.resolve("upstream_bn")

  

 def upstreamResult = 
 Hudson.instance.getJob("${parent_job}").getLastBuild().result

  

 if(upstreamResult.equals(hudson.model.Result.FAILURE)) {

   upstreamResult = "fail"

 } else {

   upstreamResult = "${upstreamResult}".toLowerCase()  

 }

 println "upstream result: ${upstreamResult}"

  

 def newParams = null

 def pl = new ArrayList()

  

 pl.add(new StringParameterValue('build_result', upstreamResult))

  

 def oldParams = build.getAction(ParametersAction.class)

 if(oldParams != null) {

   newParams = oldParams.createUpdated(pl)

   build.actions.remove(oldParams)

 } else {

   newParams = new ParametersAction(pl)

 }

  

 build.addAction(newParams)


 Thanks,
 Eric


>
>-- 
>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/d32ec4bf-dd3f-416f-820a-c6eb8296f40fn%40googlegroups.com.

-- 
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/E22837D1-E4E1-4356-8AAC-AE2C7B9A9B58%40chsc.de.


Re: Groovy Script

2022-12-09 Thread opayq-gg
Hi,

you mean upstreamResult/build_result?

What does the println for upstreamResult say?
Which Jenkins version are you on?

BR :)

On 9 December 2022 22:56:29 CET, "eric@gmail.com"  
wrote:
>Hi!  Not sure what's going on but I have a groovy script that has been 
>setting the variable build_status for ages but it stopped working.  
> Doesn't set the variable any longer.  Any ideas?  Here's the script:
>
>import hudson.model.*
>
>import jenkins.model.*
>
>  
>
>def resolver = Thread.currentThread().executable.buildVariableResolver
>
>def parent_job = resolver.resolve("upstream_job")
>
>def parent_build_number = resolver.resolve("upstream_bn")
>
> 
>
>def upstreamResult = 
>Hudson.instance.getJob("${parent_job}").getLastBuild().result
>
> 
>
>if(upstreamResult.equals(hudson.model.Result.FAILURE)) {
>
>  upstreamResult = "fail"
>
>} else {
>
>  upstreamResult = "${upstreamResult}".toLowerCase()  
>
>}
>
>println "upstream result: ${upstreamResult}"
>
> 
>
>def newParams = null
>
>def pl = new ArrayList()
>
> 
>
>pl.add(new StringParameterValue('build_result', upstreamResult))
>
> 
>
>def oldParams = build.getAction(ParametersAction.class)
>
>if(oldParams != null) {
>
>  newParams = oldParams.createUpdated(pl)
>
>  build.actions.remove(oldParams)
>
>} else {
>
>  newParams = new ParametersAction(pl)
>
>}
>
> 
>
>build.addAction(newParams)
>
>
>Thanks,
>Eric
>
>-- 
>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/696cf40d-52da-40db-b7da-0bd974551104n%40googlegroups.com.

-- 
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/CCA79DCC-D33F-47B0-9430-DC7483BF969B%40chsc.de.


Re: Need to re trigger if the Jenkins job fail for scheduled job

2022-12-05 Thread opayq-gg
Hi,

you could check if a Conditional Build Step helps you (you might need to 
install the corresponding plugin): Jenkins sets an environment variable with 
the trigger cause, you might be able to use that.

On 5 December 2022 09:37:36 CET, Praju  wrote:
>Hi,
>To achieve (Re trigger if the Jenkins job fail when it is  scheduled job  ) 
>this one I am Enabling *Retry build after failure in *post build action but 
>it will re trigger if we run manually also. Can any one suggest how to re 
>trigger job if fail when it is scheduler.  
>
>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/fc7f9e0a-d44b-4bc7-a94e-081fb8b3dbc3n%40googlegroups.com.

-- 
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/BD1A0B48-D5C1-41D6-8F93-BB175A684B9C%40chsc.de.