Reputation: 53
I have a maven project which has some other projects as dependencies and those dependencies might have some other projects as dependencies.
Proj1 (Proj2 as dependency) |----> Proj2 (Proj3 as dependency) |----> Proj3 (Projn as dependency)
So I need to make set of Jenkins jobs which runs one by one as per dependency tree:
Job3 (Runs 1st) |----> Job2 (Runs 2nd) |----> Job1 (Runs last)
To add to the woes I have gerrit in between as review tool. In a single check in we may have multiple project code as patch set. so all jobs should get latest checked in code from patch set while running if available. In such scenario trigger is also bit tricky.
Is it possible? If yes, How?
Note - I am not an expert in these activities.
Upvotes: 2
Views: 856
Reputation: 6842
Have you tried using the Other jobs on which this job depends, this can be found under the advanced options of the Gerrit trigger. I have not played around with this but according to the description below it should do what you require.
Insert all jobs on which this job actually depends (skips triggered in silent mode jobs). If a commit should trigger both a dependency and this job, the dependency will be built first. Use commas to separate job names. Beware of cyclic dependencies. With this option enabled the parent builds are available as Env variables for the build
- TRIGGER_DEPENDENCY_KEYS="Space separated list of all key names of triggered parent projects"
- TRIGGER__BUILD_NAME="The build name of triggered project"
- TRIGGER__BUILD_NUMBER="The build number of triggered project"
- TRIGGER__BUILD_RESULT="The build result of triggered project" The project key name is produced from full project name using simple regular expression: replaceAll("[^a-zA-Z0-9]+", "_"). So, all non-alphanumerical characters will be replaced by "_".
Upvotes: 0