Jenkins

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:/

Jenkins uptime - how long since last restart

安稳与你 提交于 2021-02-06 11:26:18
问题 Is it possible to see how long a Jenkins instance/master has been running? I've tried looking around in "Manage Jenkins" but can't find it there. I know I could log in and check the process on the machine, but is it possible to do it in Jenkins web UI? This URL shows a white line when it was restarted... but it's not that intuitive. <jenkins-url>/monitoring?part=graph&graph=usedMemory&period=mois 回答1: You can run groovy script on Jenkins web-ui from: Manage Jenkins > Script Console, and use

Jenkins uptime - how long since last restart

旧城冷巷雨未停 提交于 2021-02-06 11:25:20
问题 Is it possible to see how long a Jenkins instance/master has been running? I've tried looking around in "Manage Jenkins" but can't find it there. I know I could log in and check the process on the machine, but is it possible to do it in Jenkins web UI? This URL shows a white line when it was restarted... but it's not that intuitive. <jenkins-url>/monitoring?part=graph&graph=usedMemory&period=mois 回答1: You can run groovy script on Jenkins web-ui from: Manage Jenkins > Script Console, and use

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

Jenkins uptime - how long since last restart

我只是一个虾纸丫 提交于 2021-02-06 11:23:59
问题 Is it possible to see how long a Jenkins instance/master has been running? I've tried looking around in "Manage Jenkins" but can't find it there. I know I could log in and check the process on the machine, but is it possible to do it in Jenkins web UI? This URL shows a white line when it was restarted... but it's not that intuitive. <jenkins-url>/monitoring?part=graph&graph=usedMemory&period=mois 回答1: You can run groovy script on Jenkins web-ui from: Manage Jenkins > Script Console, and use

Jenkins uptime - how long since last restart

允我心安 提交于 2021-02-06 11:22:28
问题 Is it possible to see how long a Jenkins instance/master has been running? I've tried looking around in "Manage Jenkins" but can't find it there. I know I could log in and check the process on the machine, but is it possible to do it in Jenkins web UI? This URL shows a white line when it was restarted... but it's not that intuitive. <jenkins-url>/monitoring?part=graph&graph=usedMemory&period=mois 回答1: You can run groovy script on Jenkins web-ui from: Manage Jenkins > Script Console, and use

How to copy Jenkins secret files

限于喜欢 提交于 2021-02-06 09:44:31
问题 I have already added 2 secret files to Jenkins credentials with names PRIVATE-KEY and PUBLIC-KEY . How can I copy those 2 files to /src/resources directory inside a job? I have the following snippet withCredentials([file(credentialsId: 'PRIVATE_KEY', variable: 'my-private-key'), file(credentialsId: 'PUBLIC_KEY', variable: 'my-public-key')]) { //how to copy, where are those files to copy from? } 回答1: Ok, I think I managed to do it. my-private-key variable is a path to the secret, so I had to