-
This is by design for job dependency: when a downstream job is triggered, all dependency jobs needs to be triggered against same commit. This is necessary to ensure integrity (make sure all jobs are run against same commit).
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Issue Votes (0)
Hi Robin,
I'd like to ask a question about the job triggering logic.
I have jobs setup for building assets and libraries. My deploy script depends on these jobs to finish first. See the screenshot (ignore the imported job "Vendor Build").
The build jobs "Setup Assets" and "Setup Vendor" each only run when their specific files are touched in the PR; here is the config of the "Setup Assets" job:
"Setup Vendor" has its own touched files condition.
When I push a change in file "package-lock.json" into my PR, the "Setup Assets" job is triggered correctly. But when it finishes, the other job "Setup Vendor" is also triggered - why is that? The trigger condition for this job is not met.
I assume it has something to do with the fact that both the build jobs "Setup Assets" and "Setup Vendor" are used as dependencies for the "Deploy" job. So when "Setup Assets" finishes, it hits "Deploy", but that has another dependency that needs to be fired beforehand too so it triggers "Setup Vendor" as well. However, that is not expected. It seems wrong that something that is not being hit by the trigger logic is run regardless.
I would expect that "Setup Assets" job runs and the "Setup Vendor" job is skipped/not triggered. When "Setup Assets" job finishes it hits "Deploy" job and that runs normally as the valid dependencies have finished (the skipped dependency is not taken into account here).
I get that maybe dependencies are considered mandatory for the subsequent job, i.e. the artefacts are expected to be needed, so that is why they all need to trigger. But in this case it is not mandatory: "Deploy" job has logic that uploads the resulting artefact folder to the server, and if the folder is not present then nothing is uploaded. The dependency artefacts are not strictly required in this case. With this behavior the wannabe skipped job runs unnecessarily and the artefact folder is also uploaded to the server without change unnecessarily.
If the dependencies are to blame for such behavior I thought to remove them and let the jobs run independently, but in that case "Deploy" would trigger before build is complete. It also uses the artefacts if present. So I have to keep the dependencies in place.
Please advise how I could solve this and if this is the correct behavior.
Cheers.
Vaclav