I am currently creating a multibranch pipeline from BitBucket, which will build all branches automatically. That would be extremely helpful for pull requests and overall save a lot of time. However this specific project is a little bit different - it is a web application and it is built with 2 different Jenkins jobs:
Job 1: Checkout files from Version Control (Subversion and Git) and if successfull trigger Job 2 (from the job configuration).
Job 2: Transfer the files from Job 1 to node, and execute the deployment scripts. There is a lot of extra configuration in the job, which I do not need to explain. If this job is successful, the web application is deployed.
However, how the multibranch pipeline works is that it points to the Jenkinsfile of each branch (which starts Job 1) and builds that. Everytime is successful, however it doesn't trigger Job 2. Also in BitBucket it shows up as successfull build for all branches, because it only looks for this specific job.
Is there a way I can make individual rules for the branch jobs, so that they trigger another job, and that BitBucket looks for that job as a reference if a build has passed or failed? I would very much not like to combine the whole functionality in a single JenkinsFile, because it would be a massive change. Thank you.