Same workspace for multiple jobs

I have a job called "development" and another project called "code analysis". At the moment, we have two different workplaces and different workspaces, but the same code; Is there a way to use the same workspace for multiple jobs?
I checked the plugins available in Jenkins, but I did not find a suitable one.

+68
jenkins jenkins-plugins jenkins-cli
03 Feb '14 at 5:41
source share
4 answers

Suppose your Jenkins "development" workstation is /var/workspace/job1 . On the configuration page of the "Code Analysis" task, on the General tab, click Advanced... , select the Use custom workspace option and provide the same workspace /var/workspace/job1 as for your "development" work.

+77
03 Feb '14 at 8:27
source share
— -

There are Jenkins plugins that allow you to create a common workplace by setting them up for every job that needs files from this repository.

Use case:

Similar to what you need, first create two jobs from the same Git repository, then go to Jenkins Management and create a Shared Workspace . And point it out at every job you need to read from these files.

Jenkins plugin

https://wiki.jenkins-ci.org/display/JENKINS/Shared+workspace+plugin#




PS: you should study Known Issues that can help you solve your problems.

sometimes with a new copied task, when the URL parameter of the common space is not saved in the configuration the first time it is “saved”, it is necessary to save the task twice to be sure.

^^ This has not yet been decided, I tried and still happens. After a few saves (just to be sure) the job works fine.

+6
Mar 17 '16 at 18:16
source share

if you could not find Use custom workspace , you can find it under your project configure>General>Advanced>Use custom workspace

+5
Oct 18 '17 at 18:38 on
source share

I tried the inheritance plugin and wait! this thing is a sledgehammer, when all I have is a tiny nail.

I ended up adding “Post Build” “Parameterized Build on Other Projects” with “Build on Same Node” and “Predefined Parameter”. In a subsequent task, a parameter with the same name (WORKSPACE_PARENT) must be set, but you can leave it empty. Then you define the subsequent job using a custom workspace (under General> Advanced)

I chose the action after the build, because the actual success of the build job does not depend on the results of the subsequent build (at the moment). If you want to correlate the results of a subordinate task with the parent task, you need to add it as a build task, not an action after the build.

This works great for what I need.

Parent task after assembly: Parent's post-build task

Children's custom workspace: Child's custom workspace

0
Oct 02 '19 at 18:58
source share



All Articles