'Run multiple Jenkins jobs from the single Jenkinsfile?

I have two jobs that kind of upload the file to the server. Both jobs are the same except they upload to different remote URLs. Currently, I am using two Jenkins files in the same git repository for these jobs. But these files are almost the same except server URLs are different. I tried to use the single Jenkins file and passing the server URL as a parameter from a new parent job. These two children's jobs are running concurrently and one of them is succeeding while another one is failing.

So, My question is can we run multiple jobs pointing to the single Jenkinsfile?



Solution 1:[1]

My approach works fine but I was making silly mistakes of not passing the workspace name as a parameter and thus both child jobs were sharing a workspace. After setting the workspace name through a parameter, this approach works fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user2719152