jenkins-pipeline

Git push using jenkins credentials from declarative pipeline

浪子不回头ぞ 提交于 2020-05-15 09:39:20
问题 I'm using jenkins pipeline (declarative synthax) and I want to push a commit to my remote repository. Is there any way to accomplish this using the git plugin? Here is what I'm currently trying: withCredentials([usernamePassword(credentialsId: "${GIT_CREDENTIAL_ID}", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { sh "git add ${BRANCH_RENAME}.bundle" sh "echo ${GIT_USERNAME}|||||||${GIT_PASSWORD}" sh "git tag -a backup -m 'Backup branch ${BRANCH} from vega-salesforce

Jenkins Pipelines: How to use withCredentials() from a shared-variable script

荒凉一梦 提交于 2020-05-15 04:15:19
问题 I'd like to use a withCredentials() block in a shared-variable ("vars/") script rather than directly in the Jenkins pipeline because this is a lower-level semantic of a particular library, and also may or may not be required depending on the situation. However, withCredentials (or, at least, that signature of it) doesn't appear to be in scope. script: def credentials = [ [$class: 'UsernamePasswordMultiBinding', credentialsId: '6a55c310-aaf9-4822-bf41-5500cd82af4e', passwordVariable: 'GERRIT

Jenkins pipeline - How to give choice parameters dynamically

﹥>﹥吖頭↗ 提交于 2020-05-12 04:44:37
问题 pipeline { agent any stages { stage("foo") { steps { script { env.RELEASE_SCOPE = input message: 'User input required', ok: 'Release!', parameters: [choice(name: 'RELEASE_SCOPE', choices: 'patch\nminor\nmajor', description: 'What is the release scope?')] } echo "${env.RELEASE_SCOPE}" } } } } In this above code, The choice are hardcoded (patch\nminor\nmajor) -- My requirement is to dynamically give choice values in the dropdown. I get the values from calling api - Artifacts list (.zip) file

Jenkins pipeline - How to give choice parameters dynamically

点点圈 提交于 2020-05-12 04:43:30
问题 pipeline { agent any stages { stage("foo") { steps { script { env.RELEASE_SCOPE = input message: 'User input required', ok: 'Release!', parameters: [choice(name: 'RELEASE_SCOPE', choices: 'patch\nminor\nmajor', description: 'What is the release scope?')] } echo "${env.RELEASE_SCOPE}" } } } } In this above code, The choice are hardcoded (patch\nminor\nmajor) -- My requirement is to dynamically give choice values in the dropdown. I get the values from calling api - Artifacts list (.zip) file

How can I have unique build numbers across branches with Jenkins & the Pipeline Multibranch Plugin

醉酒当歌 提交于 2020-05-10 09:40:17
问题 We are using Jenkins Pipeline Multibranch Plugin with Blue Ocean. Through my reading, I believe it is quite common to tie your project's build number to the Jenkins run, as this allows traceability from an installed application through to the CI system, then to the change in source control, and then onto the issue that prompted the change. The problem is that for each branch, the run number begins at 0. For a project with multiple branches, it seems impossible to guarantee a unique build

How can I have unique build numbers across branches with Jenkins & the Pipeline Multibranch Plugin

谁说我不能喝 提交于 2020-05-10 09:38:27
问题 We are using Jenkins Pipeline Multibranch Plugin with Blue Ocean. Through my reading, I believe it is quite common to tie your project's build number to the Jenkins run, as this allows traceability from an installed application through to the CI system, then to the change in source control, and then onto the issue that prompted the change. The problem is that for each branch, the run number begins at 0. For a project with multiple branches, it seems impossible to guarantee a unique build

Jenkins Docker Pipeline Plugin not working when run inside a Jenkins Slave Docker Container

百般思念 提交于 2020-05-09 05:42:32
问题 Here's the situation: Have a docker container (jenkins). I've mounted the sockets to my container so that I can perform docker commands inside my jenkins container. Everything is setup correctly, and I have a Jenkins slave that is itself an Ubuntu docker container. I'd like to run a command inside a separate docker container created by the Jenkinsfile. The Docker Pipeline plugin promises to offer a solution to this common requirement. Here's my Jenkinsfile: pipeline { agent any stages { stage

Jenkins pipeline, how can I copy artifact from previous build to current build?

本小妞迷上赌 提交于 2020-04-30 10:41:20
问题 In Jenkins Pipeline, how can I copy the artifacts from a previous build to the current build? I want to do this even if the previous build failed. 回答1: Stuart Rowe also recommended to me on the Pipeline Authoring Sig Gitter channel that I look at the Copy Artifact Plugin, but also gave me some sample Jenkins Pipeline syntax to use. Based on the advice that he gave, I came up with this fuller Pipeline example which copies the artifacts from the previous build into the current build, whether

Jenkins pipeline, how can I copy artifact from previous build to current build?

﹥>﹥吖頭↗ 提交于 2020-04-30 10:41:11
问题 In Jenkins Pipeline, how can I copy the artifacts from a previous build to the current build? I want to do this even if the previous build failed. 回答1: Stuart Rowe also recommended to me on the Pipeline Authoring Sig Gitter channel that I look at the Copy Artifact Plugin, but also gave me some sample Jenkins Pipeline syntax to use. Based on the advice that he gave, I came up with this fuller Pipeline example which copies the artifacts from the previous build into the current build, whether

NotSerializableException in jenkinsfile

会有一股神秘感。 提交于 2020-04-29 15:30:11
问题 I'm working on a jenkinsfile and I'm getting and exception in the third stage: an exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@7bbae4fb in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.CaseEnv@6896a2e3 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@605ccbbc in field com.cloudbees.groovy.cps