jenkins-workflow

Jenkins Build Pipeline - Restart At Stage

☆樱花仙子☆ 提交于 2019-12-17 10:26:48
问题 I have the following build pipeline set up as a job: Stage 1 - verify all dependencies exist Stage 2 - build the new jar Stage 3 - Run integration tests Stage 4 - Deploy to staging environment (manual step) Stage 5 - Deploy to production environment (manual step) I am looking for a way to start the build pipeline from a particular stage in case of a transient failure. For example, let's say there was a network issue when the user clicked to deploy to production. I don't think it makes sense

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

戏子无情 提交于 2019-12-17 04:11:45
问题 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 ? 回答1: 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

How to execute a command in a Jenkins 2.0 Pipeline job and then return the stdout

假如想象 提交于 2019-12-13 11:38:37
问题 Is there a better way to run a shell task in a Jenkins 2.0 pipeline and then return the stdout of the command. The only way I can get this to work is to pipe the output of the command to a file and then read the file in to a variable. sh('git config --get remote.origin.url > GIT_URL') def stdout = readFile('GIT_URL').trim() This seems like a really bad way to return the output. I was hoping I could do something like: def stdout = sh('git config --get remote.origin.url').stdout or def exitcode

Jenkins trigger build dependent on build parameters

核能气质少年 提交于 2019-12-13 02:11:49
问题 I have a jenkins pipeline set up as follows where Build A is the start of the pipeline and on completion triggers build B and so on (see below)..So far I have implemented Build A, B and C. I have used the Jenkins Parameterized Trigger plugin as a post build action to trigger my builds. Is there anyway that I can after Build B has completed depending on what parameters the build was kicked off with fork the build after build B as shown below. Build C and Build D are deployment builds which

How can I trigger a Jenkins job upon completion of a set of other jobs?

﹥>﹥吖頭↗ 提交于 2019-12-12 13:15:32
问题 The simple case where you just have one job depending on the completion of a set of other jobs is easy: either use a multijob or use the build flow plugin with parallel { ... } . The case I am trying to solve is more general, for example: JobA depends on JobX and JobZ JobB depends on JobY and JobZ SuperJob depends on JobA and JobB I want each of these jobs to trigger as soon as, and only when their prerequisites complete. It would appear that neither the build flow plugin, nor the join plugin

jenkins workflow “Build whenever a SNAPSHOT dependency is built”

穿精又带淫゛_ 提交于 2019-12-12 11:01:52
问题 I'm currently trying to construct my Maven Job with Jenkins Workflow plugin. In maven job it's possible to set Build Trigger options to "Build whenever a SNAPSHOT dependency is built" . Is there any way to translate this option to Workflow job? I really don't want to transcribe those dependencies manually (there are a lot of them). 回答1: Use Build pipeline plugin and create a view giving your top module as the initial job. It will automatically setup all the jobs according to it's dependencies

Jenkins workflow-multibranch with git - IllegalStateException

谁说我不能喝 提交于 2019-12-11 23:18:49
问题 I'm trying to create a multibranch job using the workflow-multibranch plugin to Jenkins with git. The credentials that work fine in a normal workflow job produces the following errors in the multibranch job when trying to index the branches: Started Setting origin to git@github.com:XXXXX/XXXXXXX.git Fetching origin... FATAL: Failed to recompute children of Branch Indexing java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection

how to configure job in jekins if first project is build successful then trigger another project and so on with “Multi-configuration project” job

孤街浪徒 提交于 2019-12-11 12:42:06
问题 I want to trigger project in jekins if first project is build successful then trigger another project and so on.. how can do it. I hava project1 , project2, and project3, project4, project5 so on. here I am configuring "Multi-configuration project" job. for exp:- project1->success then trigger project2->success then trigger project3 if any stage failed then doesn't trigger other project.This is "Multi-configuration project" job, because this single job, I am trigger on multiple slaves

How to get workspace of jenkins pipeline plugin job (WorkflowRun object java API )

我是研究僧i 提交于 2019-12-11 05:19:18
问题 In the java API, I can access to the workspace path from the Run.java object: (Until today, all objects were instance of hudson.model.AbstractBuild) hudson.model.AbstractBuild#getWorkspace() hudson.model.Run#getExecutor().getCurrentWorkspace() In Pipeline plugin I don’t have an access to the workspace, the run object is instance of org.jenkinsci.plugins.workflow.job.WorkflowRun and this object doesn’t link to any workspace. this call return null: hudson.model.Run#getExecutor()

Jenkins calling groovy script security errors

我只是一个虾纸丫 提交于 2019-12-11 04:33:14
问题 I'm currently working on running bentolor's idea-cli-inspector in my pipeline for static analysis. Unfortunately, I cannot find any documentation on how to allow parameters using the "load" command, and this command works by bringing in source anyway, so I made my own function, but unfortunately, it isn't quite working out (probably due to script security). Function: def callIdeaInspector() { String[] args = ['-i', '/Applications/Android\\ Studio.app/', '-p', '.idea/inspectionProfiles