-
Bug
-
Resolution: Unresolved
-
Minor
-
None
I am implementing a system for use in our company, where a pipeline triggers different jobs depending on a configuration file. These jobs can have dependencies on other jobs, which means I have a construct like below.
The configuration file contains something like this:
steps:
firststep:
secondstep:
dependencies:
- firststep
thirdstep:
dependencies:
- secondstep
otherstep:
The pipeline has a part that looks somewhat like this:
def run_validation_steps() {
def parallel_steps = [:]
def all_validation_jobs = ...
def completed_steps = ...
for(int i = 0; i < all_validation_jobs.size(); i++) {
def validation_name = ...
def validation_config = ...
if(dependencies_are_done(validation_name, validation_config)) {
parallel_steps[validation_name] = {
def b = build(job: validation_name)
run_validation_steps()
}
}
}
}
This seems to work fine (and I don't think it should give concurrency issues, as pipelines are single-threaded), but it doesn't show anything in blue ocean.
Normally, I have:
- first part
- this validation part with dependencies
- final part
I would expect all 3 parts to be shown, but only the 'final part' (which follows this complicated setup) is shown in Blue Ocean.
Interestingly, it does work if I add a 'stage' for each of the steps.
In other words, I need to change from this:
parallel_steps[validation_name] = {
def b = build(job: validation_name)
run_validation_steps()
}
To this:
parallel_steps[validation_name] = {
stage(validation_name) {
def b = build(job: validation_name)
run_validation_steps()
}
}
Once I do that, the different validation steps are all shown as running in parallel in Blue Ocean.
This mostly solves my problem, but it's still a bit weird. Also, when the last step in the validation fails, the earlier steps also get marked as failed (probably because of the recursive 'run_validation_steps()' call). It would be nice if there was a way to avoid this (perhaps there is, but I haven't found it yet).