jenkins-pipeline

Jenkinsfile: permission denied when running sh step in Docker container

此生再无相见时 提交于 2021-02-06 20:43:47
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We

jenkins multibranch pipeline disable auto node checkout

时间秒杀一切 提交于 2021-02-06 16:17:40
问题 Currently declarative pipeline will do checkout scm automatically when hitting first stage. What I want is to checkout scm within subdirectory only. (so it won't checkout same thing in root directory) Since it needs jenkinsfile it already checkout once. Plus directory & subdirectory I checkout thrice total... Is it possible to disable auto checkout in multibranch pipeline using declarative syntax? 回答1: Add options { skipDefaultCheckout() } if you use Declarative pipeline 来源: https:/

jenkins multibranch pipeline disable auto node checkout

一曲冷凌霜 提交于 2021-02-06 16:01:33
问题 Currently declarative pipeline will do checkout scm automatically when hitting first stage. What I want is to checkout scm within subdirectory only. (so it won't checkout same thing in root directory) Since it needs jenkinsfile it already checkout once. Plus directory & subdirectory I checkout thrice total... Is it possible to disable auto checkout in multibranch pipeline using declarative syntax? 回答1: Add options { skipDefaultCheckout() } if you use Declarative pipeline 来源: https:/

How to set Jenkinsfile for upload maven artifact to Artifactory

匆匆过客 提交于 2021-02-06 11:24:49
问题 I've my .Jenkinsfile like this: properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'gitlab@srv']]) node { env.JAVA_HOME = tool 'JDK 7' def mvnHome = tool 'Maven 3.2.2' def nodeJS = tool 'IA_NodeJS' env.PATH = "${mvnHome}/bin:${nodeJS}/bin:${env.JAVA_HOME}/bin:${env.PATH}" stage ('checkout') { checkout scm } stage ('build') { gitlabCommitStatus("build") { // your build steps sh 'mvn clean install -Denv=dev -P !faster' } } stage ('upload') { gitlabCommitStatus("upload") { def

How to set Jenkinsfile for upload maven artifact to Artifactory

╄→尐↘猪︶ㄣ 提交于 2021-02-06 11:24:04
问题 I've my .Jenkinsfile like this: properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'gitlab@srv']]) node { env.JAVA_HOME = tool 'JDK 7' def mvnHome = tool 'Maven 3.2.2' def nodeJS = tool 'IA_NodeJS' env.PATH = "${mvnHome}/bin:${nodeJS}/bin:${env.JAVA_HOME}/bin:${env.PATH}" stage ('checkout') { checkout scm } stage ('build') { gitlabCommitStatus("build") { // your build steps sh 'mvn clean install -Denv=dev -P !faster' } } stage ('upload') { gitlabCommitStatus("upload") { def

Define and access a variable in multiple steps of a jenkins pipeline

徘徊边缘 提交于 2021-02-05 11:16:48
问题 I came here from this post Defining a variable in shell script portion of Jenkins Pipeline My situation is the following I have a pipeline that is updating some files and generating a PR in my repo if there are changes in the generated files (they change every couple of weeks or less). At the end of my pipeline I have a post action to send the result by email to our teams connector. I wanted to know if I could somehow generate a variable and include that variable in my email. It looks

Define and access a variable in multiple steps of a jenkins pipeline

浪尽此生 提交于 2021-02-05 11:16:17
问题 I came here from this post Defining a variable in shell script portion of Jenkins Pipeline My situation is the following I have a pipeline that is updating some files and generating a PR in my repo if there are changes in the generated files (they change every couple of weeks or less). At the end of my pipeline I have a post action to send the result by email to our teams connector. I wanted to know if I could somehow generate a variable and include that variable in my email. It looks

Jenkins Triggering of a Build Step/Stage(not the entire job) at a given interval

自古美人都是妖i 提交于 2021-02-05 09:45:34
问题 I am trying to build a pipeline where i would need to chain multiple jobs and some of them has to start at a certain time. Ex: Job1(starts at Midnight) -> Job2 -> Job3 ->Job4(starts at 4 PM) Using Declarative Syntax: pipeline { agent any stages{ stage('Fetch Latest Code-1') { steps{ build job: 'Get Latest - All Nodes', quietPeriod: 60 } } stage('CI Day - 1') { parallel { stage('ANZ CI'){ steps{ build job: 'ANZ - CI', quietPeriod: 120 } } stage('BRZ CI'){ steps{ build job: 'BRZ_CI',

How to Direct the Cmd line output to jenkins

风流意气都作罢 提交于 2021-02-05 07:41:19
问题 Stage("execution") { Steps { bat 'start cmd.exe /c c:\\users\\doc\\sample.bat' } } The above script is just opening the cmd prompt and executing it. It's not taking the output of the execution. Even if the execution fails, the stage is shown as successful and it moves to the next stage for deployment. I want to develop it so that the output in the cmd prompt should be taken as input by Jenkins and stage should go on. If the stage fails during execution, the stage should show failure and if

Getting jenkinsfile parallel branch run status

∥☆過路亽.° 提交于 2021-02-04 21:09:01
问题 I got multiple parallel branches job, each branch contains numerous stages. def build_jobs = [:] build_jobs['1'] = { stage ('A'){} stage ('B'){} } build_jobs['2'] = { stage ('A'){} stage ('B'){} } build_jobs['3'] = { stage ('A'){} stage ('B'){} } parallel build_jobs Thru the API I can find only separate stage status and whole build status.(using /api/json and /wfapi) I need a way to reach at the end of each build the branch name and it status. [Pipeline] { (Branch: 1) - status ? [Pipeline] {