1
votes

I have 4 chained freestyle jobs in Jenkins (A to D) which are used for Continuous delivery. Chained jobs currently start with job A whenever a change is pushed to my Git repostiroy.

The last job (job D) is running my Selenium tests, by default against firefox browser.. but now I'm planning to execute the same tests against Chrome browser, on a nightly basis.. Confusing part is how to configure jobs to execute tests against Chrome browser

For example: (jobs chaining)

A --> B --> C --> D

In my case i'would like to run job A every night but I want to be able to specify the target browser as a parameter when triggering job D.

Any help much appreciated!!

1
Do you mean that A/B/C/D are actually stages of your pipeline job ?Pom12
yes.. these projects required for the pipeline!!Ranjith's
I'm not sure I understand, when you are talking about pipelines do you mean that you are chaining 4 different Jenkins, freestyle jobs, or are you actually using one and only one Jenkins pipeline job, i.e. written with Groovy code ?Pom12
sorry for that.. i mean 4 different freestyle jobs as part of pipelineRanjith's
Ok, Pipelines have a very specific meaning in Jenkins context, in your case you don't have "pipelines" per say, what you have is 4 different jobs, chained together to make a workflow.Pom12

1 Answers

1
votes

You somehow have to pass the target browser as a parameter to your job D.

Passing browser parameter from A to D

You could add two jobs before job A that will react to your different configurations. Say you add jobs A1 and A2 :

Job A1 will be configured for your Git pushes, and will trigger job A with a parameter targetBrowser = firefox and job A2 will be configured for your nightly builds, and will trigger job A with parameter targetBrowser = chrome. You would then pass this browser parameter to each job until job D, that will use this parameter when launching Selenium tests.

So you would have :

enter image description here

Going bottom-up instead of up-bottom

Instead triggering from job A, you could start the triggering from job D and call previous job each time before executing your action.

Job D1 will be configured for your Git pushes and job D2 will be configured for your nightly builds. Both will execute your Selenium tests (D1 against Firefox, D2 against Chrome), but before doing that they will call job C, which will in turn call job B before doing its actions, and so on.

Schema would look like this :

enter image description here