jenkins-plugins

Jenkins 2 - How to get user role (Role Strategy Plugin) from Jenkins Workflow - Pipeline Plugin

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 06:58:37
问题 I would like to access the user role/roles, configured in Role Strategy Plugin in a Jenkins 2 pipeline (workflow): node { // Get the user Role } 回答1: import jenkins.model.Jenkins import com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy import com.michelin.cio.hudson.plugins.rolestrategy.Role node { stage('Get Role') { def user = Jenkins.getInstance().getUser( Jenkins.getInstance().getItemByFullName(env.JOB_BASE_NAME, Job.class).getBuildByNumber(env.BUILD_ID as int)

Jenkins Naginator plugin and regex

微笑、不失礼 提交于 2019-12-08 06:37:46
问题 Has anyone managed to get Jenkins Naginator plugin working with the use of a regex? I have the console output Build was aborted Aborted by xxxxxxxxx [htmlpublisher] Archiving HTML reports... [htmlpublisher] Archiving at BUILD level C:\xxxxxxxxx\workspace\testSuiteExecution\target\surefire-reports to /var/lib/jenkins/jobs/testSuiteExecution/builds/534/htmlreports/HTML_Report ERROR: Specified HTML directory 'C:\xxxxxx\workspace\testSuiteExecution\target\surefire-reports' does not exist. Started

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

How to call a build flow from a build flow passing different parameters?

风格不统一 提交于 2019-12-08 06:15:24
问题 I have 3 Jobs (let's name it as job1,job2,job3) which all accepts same parameters. I have a build flow calling these jobs Eg Build Flow:: build(job1, param1 : "value1", param2 : "value2" ) build(job2, param1 : "value1", param2 : "value2" ) build(job3, param1 : "value1", param2 : "value2" ) As you see in the example all the jobs accept same parameters. And I want to run the same sequence in the build flow (job1, job2, job3) with different parameter values. So Now I am having different build

How to configure Jenkins to send encrypted emails with gpg?

允我心安 提交于 2019-12-08 05:40:27
问题 I am looking for instructions on how to configure the jenkins email plugin (ext-mail) to encrypt notifications? The uncle google did not help me too much. 回答1: such feature is not out-of-box, you need custom ExtendedEmailPublisher for your needs. MimeMessage msg = createMail(mailType, build, listener); Address[] allRecipients = msg.getAllRecipients(); if (allRecipients != null) { StringBuilder buf = new StringBuilder("Sending email to:"); for (Address a : allRecipients) { buf.append(' ')

Define global environment variables from inside a stage

三世轮回 提交于 2019-12-08 04:37:56
问题 I have env vars defined in my environment directive at the top of the pipeline: environment { var1 = 'sdfsdfdsf' var2 = 'sssssss' } But there are some that I need to dynamically set or override in the stages. But if I use an environment{} directive in a stage the vars won't be accessible to other stages. Initially I thought I could define them all with default values in the top environment directive and overwrite them in the pipeline but this is the behavior I observed: Define var in

Jenkins sending notifications to the wrong commit id

有些话、适合烂在心里 提交于 2019-12-08 03:58:27
I have several Jenkins pipelines, all importing a shared library from Bitbucket for some utility methods, and I want to send build status notifications to each project's own Bitbucket repo. I installed the Bitbucket build status notifier plugin, but I'm experiencing a weird behavior: when bitbucketStatusNotify is being called in my pipeline, this happens: Sending build status INPROGRESS for commit <sha> to BitBucket is done! And that would be ok, but <sha> is the commit id of the last commit on the shared library, not on the actual project being built, so build status notifications are

How to get rid of dependency errors loading jenkins?

邮差的信 提交于 2019-12-08 03:36:29
问题 Just downloaded jenkins.war and did a java -jar jenkins.war (on windows 8.1) going to http://127.0.0.1:8080/manage, i see: There are dependency errors loading some plugins: Email Extension Plugin v2.47 JUnit Plugin v1.2-beta-4 is older than required. To fix, install v1.2 or later. GitHub plugin v1.20.0 Jenkins Git plugin v2.4.0 failed to load. Fix this plugin first. Jenkins Git plugin v2.5.3 Matrix Project Plugin v1.4.1 is older than required. To fix, install v1.6 or later. Jenkins Mailer

Unable to start container from jenkins

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:10:23
问题 In Jenkins I installed Docker build step plugin. In Jenkins, created job and in it, executed docker command selected build image. The image is created using the Dockerfile.The Dockerfile is : FROM ubuntu:latest #OS Update RUN apt-get update RUN apt-get -y install git git-core unzip python-pip make wget build-essential python-dev libpcre3 libpcre3-dev libssl-dev vim nano net-tools iputils-ping supervisor curl supervisor WORKDIR /home/wipro #Mongo Setup RUN curl -O http://downloads.mongodb.org

How to trigger a Jenkins job by another job at a certain time?

梦想与她 提交于 2019-12-08 03:00:13
问题 I have two jobs, JobA and JobB, JobA runs every day at 13.00 and registers some payments. I want JobA to trigger JobB which verifies the payments, if and only if JobA is successful and JobB needs to be run the next day at 04.00 Any idea how to do this? BR 回答1: I have not been able to find anything that will do this out of the box. You can, of course, schedule a job to build periodically, but that's not all that you want. You could try one of these 2 ideas (I have not implemented either myself