jenkins-job-dsl

Jenkins Job DSL Git Plugin - How to merge before build

大憨熊 提交于 2019-12-13 02:54:40
问题 First off, this is not a duplicate question of "merge before build" feature. I googled and reviewed whatever I found regarding this feature. But none talks about my problem. We've got Bitbuck Server + Jenkins and I wrote a job for our PRs on Bitbucket: job('pull-request-job') { scm { git { remote { name 'origin' credentials 'jenkins-ssh' url 'ssh://git@stash.example.com/my/repository.git' refspec '+refs/pull-requests/*/from:refs/remotes/*' } branch '**/pull-requests/**' extensions {

How can I trigger a Jenkins job upon completion of a set of other jobs?

﹥>﹥吖頭↗ 提交于 2019-12-12 13:15:32
问题 The simple case where you just have one job depending on the completion of a set of other jobs is easy: either use a multijob or use the build flow plugin with parallel { ... } . The case I am trying to solve is more general, for example: JobA depends on JobX and JobZ JobB depends on JobY and JobZ SuperJob depends on JobA and JobB I want each of these jobs to trigger as soon as, and only when their prerequisites complete. It would appear that neither the build flow plugin, nor the join plugin

I pull the branch with tag in the groovy

我的梦境 提交于 2019-12-12 10:17:19
问题 I want to pull specified branch with tag. So i write job as following job('abc'){ scm{ git('ssh://git@abc.git', 'refs/tags/test-tag1') } } But it does not work. I inputted branch Name or commit into 2nd param, it will pull the specified branch. It can work with tag from the document of [Jenkins Job DSL Plugin]. I want to know why it doesn't work, Or my job is wrong. 回答1: You just need to specify the tag name. This works for me: job('example'){ scm { git('https://github.com/jenkinsci/job-dsl

Jenkins DSL pipeline syntax for wrappers or publishers

孤街醉人 提交于 2019-12-11 15:52:27
问题 I am using DSL Plugin 1.64. I have DSL script for generating jobs. generating pipeline jobs, somehow wrappers and publishers syntax are not working. I have already asked one question for wrappers, now I am trying to use publishers and its not working in pipeline job. I can not see for example groovyPostBuild step. even I can not not see a postbuild action in pipeline job, I don`t want to put this is pipeline jenkinsfile. pipelineJob('Dump_File_Verification ') { parameters { stringParam('DUMP

job-dsl-core jar version updated to 1.44 & githubPullRequest closure is not working

放肆的年华 提交于 2019-12-11 12:36:31
问题 We are planning to update job-dsl-core version to 1.44 from 1.42, but in the latest version pullRequest{} closure is deprecated and replaced with githubPullRequest{} closure as detailed in the migration document here https://github.com/jenkinsci/job-dsl-plugin/wiki/Migration#github-pull-request-builder. When I try to update our code with the above recommendation, I am getting following error: No signature of method: javaposse.jobdsl.dsl.helpers.triggers.TriggerContext.githubpullRequest() is

Jenkins seed job that executes only DSL scripts modified since the last run?

人盡茶涼 提交于 2019-12-11 06:08:17
问题 I have several source code repositories containing various bits of code built by Jenkins, with a one-to-one mapping between Jenkins jobs and source repositories. Separate from these, I have a single repository containing Job DSL scripts for creating/updating the Jenkins jobs that build the other repos. The situation looks something like this: I had hoped to find a way to store the Job DSL scripts inside the individual source repositories, right alongside the code, and have a single seed job

Inject passwords to the build as environment variables

怎甘沉沦 提交于 2019-12-11 00:07:12
问题 I am trying to set a password in jenkins through an option in 'build environments' section which can be used in my test to get the password and use it. This is the option i am checking in "Inject passwords to the build as environment variables". Problem is i am loosing these values once the seed job runs. So my values added are disappearing after seed job runs. Did anybody faced this problem? How to make it permanent so every time i can retrieve those pwds in my test code? 回答1: After running

Jenkins DSL Plugin: How to create a job in an existing jenkins View?

五迷三道 提交于 2019-12-10 16:17:50
问题 I found the following question regarding job creation and adding to a newly created view with the DSL plugin. Adding job to newly created view. How can i add a created job to an existing view with the DSL plugin? I couldn´t find any hint in the documentation. Maybe it is too obvious that i can´t see the solution? Although i read, that creating a view will cause a re-creation if the view already exists. What means that for the existing projects under this view? Thanks for your help. 回答1: You

How to put jobs inside a folder in jenkins?

雨燕双飞 提交于 2019-12-10 14:36:23
问题 I'm trying to put jobs inside a folder using jenkins DSL script Now i create a listView and i put inside my jobs here the code i'm using listView('MyJobsList') { jobs { map.each{ name((it.key).trim()) } } columns{ status() weather() name() lastSuccess() lastFailure() lastDuration() buildButton() } } i want to do the same thing but this time i want to put the jobs in a folder !! 回答1: Please refer the below Job-DSL documentation to create a folder in Jenkins through Job-DSL. Folder folder(

Migrate from Jenkins Multijob to Pipeline plug-in

与世无争的帅哥 提交于 2019-12-10 13:37:36
问题 Currently we are using Jenkins CI 1.643 (I believe) with the Multijob plugin and Job DSL. A collection of jobs is generated using Job DSL, as well as a multijob that contains all the other jobs in a specific order (build, analysis, unit test, integration test, etc.). I'm interested in upgrading to Jenkins 2 and using the Pipeline plug-in (previously known as the Workflow plug-in). The Pipeline plug-in offers a nice graphical representation and also offers some more advanced features that we