Jenkins

Use special agent for whole pipeline when a condition is met

北城余情 提交于 2021-01-29 07:30:21
问题 There is declarative pipeline. In the beginning of pipeline block the agent selection is made using agent directive. Label-based selection is being conducted. Agent selected this way is the standard/default agent. How to set for whole pipeline a special agent when certain condition is met? The plan is to do condition check based on pipeline's one parameter >> can that work? What are the points the chosen approach needs to address? Current solution blueprint: Groovy code prior to pipeline

Disable automatic trigger build jenkins multibranch

☆樱花仙子☆ 提交于 2021-01-29 06:29:18
问题 I have a multibranch project in jenkins, and every time I press Scan Repository Now it queue a new build just because ‘Jenkinsfile’ found Met criteria What I'd like to do is whenever I scan the repository, it only add Pull Request to the project without triggering a build. And also, if I turn on scan repository trigger, periodically if not otherwise run, every time it branch indexing, it also build the pull request even after I turn on Skip initial build on first branch indexing . What I'd

Disable automatic trigger build jenkins multibranch

我的未来我决定 提交于 2021-01-29 06:22:30
问题 I have a multibranch project in jenkins, and every time I press Scan Repository Now it queue a new build just because ‘Jenkinsfile’ found Met criteria What I'd like to do is whenever I scan the repository, it only add Pull Request to the project without triggering a build. And also, if I turn on scan repository trigger, periodically if not otherwise run, every time it branch indexing, it also build the pull request even after I turn on Skip initial build on first branch indexing . What I'd

How to add values in Jenkins dropdown parameter based on another params?

ε祈祈猫儿з 提交于 2021-01-29 06:01:05
问题 I want know how to add values to Jenkins dropdown parameter based another parameter value. I referred below link - Active Choices Reactive Reference Parameter in jenkins pipeline This is my Jenkins file #!groovy def date = new Date().format('MM/dd/yy').toString() properties([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [ [$class : 'ChoiceParameterDefinition',choices : 'master\nhotfix/18.3.0.35_Vol3',description: '',name: 'branchName'], [$class: 'ChoiceParameter', choiceType:

How to remove timestamp from artifacts uploaded to maven2 repository on nexus?

梦想与她 提交于 2021-01-29 05:57:38
问题 I am uploading a few artifacts through a Jenkins pipeline on a Nexus repository, the repository is maven2 hosted. I use the following block in Jenkins to upload artifacts: nexusArtifactUploader ( artifacts: [ [artifactId: 'artifact-part1', classifier: '', file: "build/libs/artifact-part1.jar", type: 'jar'], [artifactId: 'artifact-part2', classifier: '', file: "build/libs/artifact-part2.jar", type: 'jar'] ], credentialsId: 'nexus_cred', groupId: "$group", nexusUrl: "$nexusUrl:8082",

Trigger Jenkins job remotely from Azure Functions / Azure VM

匆匆过客 提交于 2021-01-29 05:26:22
问题 Am pretty new with Jenkins and just simply can't get this to work. I have been browsing the net for an answer but have not found an answer, or might not have understood what I should do. I have Jobs in Jenkins that are currently scheduled (Python scripts). But one of these needs to be converted to be triggered remotely via URL. This I have been able to achieve and everything works fine when I am using the URL to trigger the Job from within our network at the office (Python, CMD, Browser,

jenkins pipeline : How to execute a function on a list of agents in parallel?

本小妞迷上赌 提交于 2021-01-29 05:22:48
问题 I have a bunch of nodes serving labels rhel6 , rhel7 . How do I execute myFunc() on any 2 nodes of rhel6 and any 3 nodes rhel7 - in parallel ? def slaveList = ['rhel6', 'rhel6', 'rhel7', 'rhel7', 'rhel7'] def stageFunc (String slaveLabel) { return { // Run this stage on any available node serving slaveLabel agent { label "${slaveLabel}" } // Error shown here. stage { myFunc() } } } pipeline { agent any stages { stage('Start') { steps { script { def stageMap = [:] def i = 0 slaveList.each { s

Override environment variable created locally in Jenkins

我的未来我决定 提交于 2021-01-29 04:24:22
问题 I have 2 properties files that I wish send their content via mail. What I do is so: Read those files with EnvInject Use those varibles as so to send the via mail: Those config files are containing different link and date I see in email the same output: Android Mobile Client Release Notes CH Link: ftp://testlink_CH Date: 28/06/2016 Android Mobile Client Release Notes PL Link: ftp://testlink_CH Date: 28/06/2016 Whitch meanns when ${Link} is set its not oveeriden even if I try "unset" command.

How to setup a multiline parametrized cron job in Jenkins Scripted Pipeline?

被刻印的时光 ゝ 提交于 2021-01-29 02:49:50
问题 So this is working fine: properties([ //https://stackoverflow.com/questions/35370810/how-do-i-use-jenkins-pipeline-properties-step parameters([ //note here that the default will be the element you have as a first choice in the array choice(name: 'environmentName', choices: ['PROD', 'STAGE'], description: 'Choose the environment you want to run automation tests'), ]), //explained here: https://stackoverflow.com/questions/44113834/trigger-hourly-build-from-scripted-jenkinsfile //recall that ANY

How to get a reference to form elements in a Jenkins jelly script for a Builder configuration when the form loads?

蹲街弑〆低调 提交于 2021-01-29 02:12:01
问题 I am writing a Jenkins Builder, and in the jelly script for its configuration in the build configuration page I have some Javascript that I want to run when the form is loaded, to do a server lookup and get some information to help the user out with their configuration, which will also be performed when the user changes the form's values. Previously I have got references to the form elements by passing this in to functions in onchange or onkeyup attributes. However, now I want to run some