The issue appears when running jagger-jenkins plugin in parallel with single Jenkins instance OR with master-slave topology.
To Reproduce
Run Jenkins job with Jagger-Jenkins plugin in parallel, configured with different parameters (f.e. different java options)
Expected:
Plugin log execution script according to the configuration of the plugin.
The same script as logged is executed.
Actual:
Plugin log execution script according to the configuration of the plugin.
The script from the current workspace is executed.
Details
How plugin works today:
- On "prepare" stage, Jenkins-master creates a script according to the configuration and put it into the current workspace. (master workspace if single node; slave workspace in master-slave mode)
- On "run" stage, Jenkins master executes the script from "current" workspace.
- Between 1. and 2. many other plugins can take place, so those stages are separate in time.
From this point we have 2 issues:
-
In single Jenkins node mode:
If you run the job in parallel, the second job will override the jagger-deploy.sh script in the workspace. So both jobs will execute the same jagger-deploy.sh script of the latest job.
-
In Master-Member mode:
Jenkins master resolves "current" workspace, as a workspace of the Jenkins slave where the job was most recently executed.
It means, that in the scope of both parallel jobs, Jenkins master will execute the same script, which presents in the latest Jenkins slave which was used to run the job.
Suggestions to fix issues:
- Introduce timestamps to the script name. f.e. jagger-deploy-yyyy-MM-ddTHH:mm:ss:iii.sh
In order to mitigate an issue in single Jenkins mode scenario
- Execute jagger-deploy.sh script not from current workspace, but from the same workspace, which was used to store the script in "prepare" stage.
Class to ammend: JaggerEasyDeployPlugin
p.s. Refactorings are very welcome.
The issue appears when running jagger-jenkins plugin in parallel with single Jenkins instance OR with master-slave topology.
To Reproduce
Run Jenkins job with Jagger-Jenkins plugin in parallel, configured with different parameters (f.e. different java options)
Expected:
Plugin log execution script according to the configuration of the plugin.
The same script as logged is executed.
Actual:
Plugin log execution script according to the configuration of the plugin.
The script from the current workspace is executed.
Details
How plugin works today:
From this point we have 2 issues:
In single Jenkins node mode:
If you run the job in parallel, the second job will override the jagger-deploy.sh script in the workspace. So both jobs will execute the same jagger-deploy.sh script of the latest job.
In Master-Member mode:
Jenkins master resolves "current" workspace, as a workspace of the Jenkins slave where the job was most recently executed.
It means, that in the scope of both parallel jobs, Jenkins master will execute the same script, which presents in the latest Jenkins slave which was used to run the job.
Suggestions to fix issues:
In order to mitigate an issue in single Jenkins mode scenario
Class to ammend: JaggerEasyDeployPlugin
p.s. Refactorings are very welcome.