El domingo, 22 de septiembre de 2019, 23:37:27 (UTC+2), Rafael Rezende 
escribió:
>
> Do you do that remotely? Like injecting a script using the jenkins-cli.jar?


we use Go but you can use curl or any HTTP client, it is something like this

JENKINS_CRUMB=$(curl --silent 
"$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)")
curl --silent -X POST -H "${JENKINS_CRUMB}" -F "script=<script.groovy" 
${JENKINS_URL}/scriptText

--script.groovy
import hudson.model.*
def queue = Hudson.instance.queue
println "Queue contains ${queue.items.length} items"
queue.items.each{
  println it.toString()
  println "label: ${it.getAssignedLabel()}"
}


https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console

 

> I considered using the REST API to fetch the labels of the node referenced 
> in the "why" message, but that would be meaningful only if the node had a 
> single label.
> For multiple labels, again, I would be unable to tell which one is 
> required.
>
> I wonder how hard it would be to add this element to the REST API. It 
> might be worth checking.
>

yep, this data should be in the API, probably it is a matter of adding an 
annotation in the 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/10ed94b8-23a8-4388-8409-2df09a8bb906%40googlegroups.com.

Reply via email to