jenkins-workflow

Duplicate changelogs in jenkins pipeline script

╄→尐↘猪︶ㄣ 提交于 2019-12-11 00:47:46
问题 I am working on how to use the new Jenkins Pipeline Plugin with the Jenkinsfile in the scm of the project (we use GIT). The job script is loaded from the SCM ('Pipeline script from SCM' option) and in the Jenkinsfile script I do a checkout scm . The problem is that the commits are duplicated. In the build directory, there is 2 changelog.xml with the same commits and so the changes view can be very messy : Summary 1. FNC71010 - Ajout des traductions au launcher (details) Commit

how to download protected resources in a jenkins workflow?

旧城冷巷雨未停 提交于 2019-12-10 18:08:26
问题 Many times I have the need to download files (e.g. archives) from a remote repository (e.g. maven-repo) which is protected by username/password. Its easy to get such a file with curl or wget , but when I don't like to see the password on the logs, maybe there is a better/embedded way to do this from within a jenkins workflow? And how do I combine it with credentials managed by jenkins credential plugin? 回答1: Use the Credentials Binding plugin, which integrates with Workflow. 来源: https:/

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

大兔子大兔子 提交于 2019-12-08 08:50:29
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 flows to pass different values to the parameter: eg: Build flow1--- build(job1, param1 : "value1", param2

Replace classpath of a running Groovy Script (Jenkins Pipeline script)

耗尽温柔 提交于 2019-12-08 08:43:28
问题 In Jenkins Pipeline we have a CpsGroovyScript executed by CPSGroovyShell with a custom classpath which is appended with path to Global Library location. In order to be able to test my changes before making them available for all the Pipelines on my Jenkins instance I want to override classpath by unloading the classes and modifying the script's classpath from itself in runtime. My idea is to prepend current classpath with a new location so that changed classes found first. this.class

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

Jenkins Pipelines: Re-use workspace when loading an external Jenkins pipeline script

左心房为你撑大大i 提交于 2019-12-06 03:57:09
I have the following use case: Checkout/pull a certain Git revision, using written pipeline script (I need this because I retrieve the revision dynamically) From that revision, load a Jenkins-pipeline-file, located among the previously checked out files This file would rely on files from the same checked out revision (thus, from the same workspace) Problem: The loaded Jenkins-pipeline-file gets executed in a new workspace. But it is empty. I need that file to get executed in the same old workspace. I thought, perhaps it's because of surrounding node , because the node keyword creates

Docker Plugin for Jenkins error: Scripts not permitted to use method

别等时光非礼了梦想. 提交于 2019-12-05 14:42:34
I'm trying to publish to Docker from my Jenkins Pipeline but most things I try result in an error. My latest try was this: docker.withDockerRegistry('https://docker-registry.myco.com/lsacco/swagger-rest', 'docker-credential') { def image = docker.image(APPLICATION_NAME); image.tag("latest"); image.push() } When I run this, Jenkins outputs this error: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.jenkinsci.plugins.docker.workflow.Docker withDockerRegistry java

Jenkins Workflow Multibranch allow for specifying Jenkinsfile path

限于喜欢 提交于 2019-12-05 02:49:31
It seems like now you can only have a single Jenkinsfile in a single location in your project when using Multibranch type. Is there a way to configure so I can place the Jenkinsfile somewhere else than in the root of the project under the name Jenkinsfile. There's hope, as there's an option of Fixed Configuration, maybe this is a feature for the future, but I would much appreciate the option, as in the current situation I do not have the option to run everything as one nicely compiled pipeline due to the size of the repo. I'm thinking of having multiple Jenkins jobs against the same repository

Parsing an XML file within a Jenkins pipeline

旧城冷巷雨未停 提交于 2019-12-05 01:36:21
问题 I have an XML file which I'd like to use as input for a pipeline script. Problem is the XMLParser isn't serializable so I put it in a NonCPS function, but I lost the Node object because of that. This is the pipeline script: def buildPlanPath = 'C:\\buildPlan_test.xml' @NonCPS groovy.util.Node getBuildPlan(path) { new XmlParser().parseText(readFile(path)) } node { //def buildPlan = new XmlParser().parseText(readFile(buildPlanPath)) groovy.util.Node buildPlan = getBuildPlan(buildPlanPath)

Updating Jira tickets from Jenkins workflow (jenkinsfile)

流过昼夜 提交于 2019-12-05 01:08:15
问题 How can I update a jira issue from within a Jenkinsfile (jenkins-worflow/pipeline)? Is there a way I could use the Jira Issue Updater plugin as a step in the Jenkinsfile? I know I could use the Jira RestAPI, but I'm trying to figure out if I can re-use the functionality provided by the jira-updater-issue. What I'm looking for is a something similar to the example below calling Junit archiver, and atifact archiver, but calling jira updater. node { git url: 'https://github.com/jglick/simple