0
請幫助我,我試圖改變jenkins上的執行者數量。當我運行此代碼,它的工作原理:Groovy腳本集執行者數
import jenkins.model.Jenkins
Jenkins jenkins = Jenkins.getInstance()
jenkins.setNumExecutors(4)
jenkins.save()
當我使用下面的函數:
void set_executors(int number) {
Jenkins jenkins = Jenkins.getInstance()
jenkins.setNumExecutors(number)
jenkins.save()
}
運行:
java -jar jenkins-cli.jar -s http://localhost:8080 groovy /var/lib/jenkins/executor.groovy set_executors 4
我越來越:
groovy.lang.MissingMethodException: No signature of method:
Actions.set_executors() is applicable for argument types
(java.lang.String) values: [4]
Possible solutions: set_executors(int)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
請幫忙!
不應該只是:'jenkins.setNumExecutors(number)'? – bdkosher
是的,這是錯誤的複製粘貼,我修復了原始消息 – BigBoss
你可以顯示set_executors被調用的代碼嗎? – bdkosher