jenkins-scriptler

Replacement for Jenkins Scriptler plugin?

被刻印的时光 ゝ 提交于 2020-02-02 05:17:21
问题 It looks like the Jenkins Scriptler plugin is no longer available, due to security reasons: https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin "Distribution of This Plugin Has Been Suspended" Is there a similar plugin that I could use to run saved Groovy scripts? 回答1: Hi you can store your groovy scripts in Managed Files and pass the parameters to groovy script through Extended Choice Parameters Plugin. Or else you can download Scriptler plugin source code and add it to your /var

Working with jenkins credentials

杀马特。学长 韩版系。学妹 提交于 2020-01-02 00:49:24
问题 I want to know how to Create the credentials that can be used by Jenkins and by jobs running in Jenkins to connect to 3rd party services. 回答1: You should specify which 3rd party service you will work on. Below is an example of credentials with bitbucket I am now working with Jenkins ver. 1.568. By default, there's Credentials feature. So, if you want to add a credential, just click on Add Credentials . For example, I'd like to add SSH Username with password , so I can use it in checking out

jenkins Slave API setLabelString adds to User list

痞子三分冷 提交于 2019-12-25 05:25:34
问题 I have the following script under a JOB, which when run adds the userId to the label of the slave. import jenkins.model.Jenkins import hudson.model.User import hudson.security.Permission import hudson.EnvVars EnvVars envVars = build.getEnvironment(listener); def userId= envVars .get('BUILD_USER_ID') def nodeName= envVars .get('NODE_NAME') def nodeOffpool= envVars .get('NODE_GOING_OFFPOOL') allUsers = User.getAll() println allUsers println "" // add userid as a label if doesnot exist for

Jenkins Groovy: What triggered the build

六月ゝ 毕业季﹏ 提交于 2019-12-18 05:12:24
问题 I was thinking of using a Groovy script for my build job in Jenkins because I have some conditions to check for that might need access to Jenkins API. Is it possible to find out who or what triggered the build from a Groovy script? Either an SCM change, another project or user. I have just begun reading a little about Groovy and the Jenkins API. I want to check for the following conditions and build accordingly. Some Pseudocode: def buildTrigger JenkinsAPI.thisBuild.Trigger if (buildTrigger =

How to increase jenkins build number automatically?

眉间皱痕 提交于 2019-12-12 08:12:25
问题 How to increase jenkins build number automatically or by using shell script?? For now i am doing the same using configure option, and increasing manually. i want to do it automatically. 回答1: What you are asking for (i.e. keeping the build number same between multiple jobs) is simply impossible in Jenkins. This is done by design (as noted by Jenkins creator himself): "[JENKINS] assumes that the build number is unique and monotonic.". You can change it to a higher value, but changing it to same

cloudbees, groovy, jobs, folders: How to determine the job result, if the job is within a cloudbees folder?

删除回忆录丶 提交于 2019-12-10 11:34:15
问题 Problem : I'm using a script to determine if a certain amount of jobs are in SUCCESS state. It worked fine as long as I was not using cloudbees folder plugin. I could easily get the list of projects and get the project result. But after I moved the jobs to the cloudbee folder, the jobs and therefore the job results are no longer available! Q : Does anybody now how to get the job results with groovy from jobs which are located in a Cloudbees folder? 回答1: def job = Jenkins.instance

How to change a Git URL in all Jenkins jobs

耗尽温柔 提交于 2019-12-10 10:11:52
问题 I have more than 100 jobs in Jenkins and I have to change a Git URL in each and every job since we changed the git server. I must traverse each job and change the Git URL. Can anyone help me with a groovy script? I was able to traverse each job, but not able to get the Git URL or change it: import hudson.plugins.emailext.* import hudson.model.* import hudson.maven.* import hudson.maven.reporters.* import hudson.tasks.* // For each project for(item in Hudson.instance.items) { println("JOB : "

how can I add git submodule into git repo as normal directory?

南楼画角 提交于 2019-12-09 06:32:00
问题 Let's see what it is Create two git repo sub & test mkdir test sub cd test && git init && touch README && git add README && git commit -m "initialize the git repo" && cd .. cd sub && git init && touch README && git add README && git commit -m "initialize the sub git repo" && cd .. Move the sub repo into test mv sub test cd test git add sub git commit -m "add sub directory" I want to treat them as one git repo and push them remotely, but now the files under sub directory can not be included ?

jenkins cli with checkout Subversion using groovy script

我怕爱的太早我们不能终老 提交于 2019-12-08 06:35:58
问题 Is there a way to check out any Subversion project using Jenkins-Cli by executing a groovy script on the master? I can get to the point of creating SVN client manager[org.tmatesoft.svn.core.wc.SVNClientManager], but can't really understand how to employ that in checking out an SVN project from the URL. 回答1: After a lot of hit and trials I have come up with this, might be useful for someone else: import jenkins.*; import jenkins.model.*; import hudson.*; import hudson.model.*; import hudson

jenkins cli with checkout Subversion using groovy script

蹲街弑〆低调 提交于 2019-12-06 21:44:41
Is there a way to check out any Subversion project using Jenkins-Cli by executing a groovy script on the master? I can get to the point of creating SVN client manager[org.tmatesoft.svn.core.wc.SVNClientManager], but can't really understand how to employ that in checking out an SVN project from the URL. After a lot of hit and trials I have come up with this, might be useful for someone else: import jenkins.*; import jenkins.model.*; import hudson.*; import hudson.model.*; import hudson.slaves.SlaveComputer; import hudson.scm.SubversionSCM; import hudson.remoting.Channel; import hudson.FilePath;