Home > Blockchain >  Running multiple tests on the same jenkins pipeline
Running multiple tests on the same jenkins pipeline

Time:09-29

I have a pipeline where I run tests on the main branch of the GitHub Project. Now I want to run a diff. branch as well let us say okta branch(the build should trigger automatically since I run them at odd times). Can I do this in the same pipeline, there is a plugin known as multi-branch pipeline but it includes all the branches and I don't want that since our project contains lots of branches. Also, I want them to be running at diff. times for this I am using the parameterized scheduler plugin. Can someone please tell me how to run two branches in the same pipeline?

CodePudding user response:

You can simply create a Multibranch Pipeline and add a Branch filter to filter the branches you need. You can either use, Filter by name (with regular expression) or Filter by name (with wildcards) options for this.

enter image description here

CodePudding user response:

You can add a parameter like BRANCHNAME, and use it on git checkout like so: ${BRANCHNAME}. This way, you can run the pipeline (using parametrized scheduler) to run different branches on different schedules:

30 0 * * * %BRANCHNAME=okta
30 6 * * * %BRANCHNAME=auth0
30 12 * * * %BRANCHNAME=master
  • Related