jenkinsfile

How can I use the Jenkins Copy Artifacts Plugin from within the pipelines (jenkinsfile)?

百般思念 提交于 2019-11-27 22:45:59
I am trying to find an example of using the Jenkins Copy Artifacts Plugin from within Jenkins pipelines (workflows). Can anyone point to a sample Groovy code that is using it? If builds are not running in the same pipeline you can use direct CopyArtifact plugin, here is example: https://www.cloudbees.com/blog/copying-artifacts-between-builds-jenkins-workflow and example code: node { // setup env.. // copy the deployment unit from another Job... step ([$class: 'CopyArtifact', projectName: 'webapp_build', filter: 'target/orders.war']); // deploy 'target/orders.war' to an app host } With a

How do I prevent two pipeline jenkins jobs of the same type to run in parallel on the same node?

耗尽温柔 提交于 2019-11-27 18:27:44
I want not to allow two jobs of the same type (same repository) not to run in parallel on the same node. How can I do this using groovy inside Jenkinsfile? hypery2k You got at the disableConcurrentBuilds property: properties properties: [ ... disableConcurrentBuilds(), ... ] Then the job would wait the older one to finish first The answer provided in https://stackoverflow.com/a/43963315/6839445 is deprecated. The current method to disable concurrent builds is to set options: options { disableConcurrentBuilds() } Detailed description is available here: https://jenkins.io/doc/book/pipeline

Jenkinsfile with two git repositories

泄露秘密 提交于 2019-11-27 15:47:38
问题 I'm using the Jenkins pipeline plugin with a Jenkinsfile. In one repository, called vms.git, I have the Jenkinsfile and an application it builds. I have another repository called deploy.git, which contains scripts I want to use to deploy the application in vms.git. At the moment my Jenkinsfile just looks like this node { stage 'build' checkout scm and I am defining the vms.git repo in the job configuration. So what I would like to do is check out both repositories, then use the Jenkinsfile in

Jenkins: Trigger Multi-branch pipeline on upstream change

依然范特西╮ 提交于 2019-11-27 10:20:59
问题 I am currently testing the pipeline approach of Jenkins 2.0 to see if it works for the build environment I am using. First about the environment itself. It currently consists of multiple SCM repositories. Each repository contains multiple branches, for the different stages of the development and each branch is build with multiple configurations. Not all configurations apply to every repository. Currently every repository/branch is setup as a Matrix Project for the different configurations.

How to do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

落花浮王杯 提交于 2019-11-26 21:23:34
I have something like this on a Jenkinsfile (Groovy) and I want to record the stdout and the exit code in a variable in order to use the information later. sh "ls -l" How can I do this, especially as it seems that you cannot really run any kind of groovy code inside the Jenkinsfile ? G. Roggemans The latest version of the pipeline sh step allows you to do the following; // Git committer email GIT_COMMIT_EMAIL = sh ( script: 'git --no-pager show -s --format=\'%ae\'', returnStdout: true ).trim() echo "Git committer email: ${GIT_COMMIT_EMAIL}" Another feature is the returnStatus option. // Test

How do I prevent two pipeline jenkins jobs of the same type to run in parallel on the same node?

不想你离开。 提交于 2019-11-26 15:44:27
问题 I want not to allow two jobs of the same type (same repository) not to run in parallel on the same node. How can I do this using groovy inside Jenkinsfile? 回答1: The answer provided in https://stackoverflow.com/a/43963315/6839445 is deprecated. The current method to disable concurrent builds is to set options: options { disableConcurrentBuilds() } Detailed description is available here: https://jenkins.io/doc/book/pipeline/syntax/#options 回答2: You got at the disableConcurrentBuilds property: