02 – Triggering and chaining jobs into flows

02 – Triggering and chaining jobs into flows

This time I show you the most common job triggering methods, job parameters and environment variables.

This tutorial describes four jobs:

  • BT02-First
    • Input parameters: YES
    • Triggers: manual, remote
  • BT02-Second
    • Input patameters: YES
    • Triggers: called by BT02-First after BT02-First finish
  • BT02-Third
    • Input parameters: NO
    • Triggers: after BT02-First finish
  • BT02-Scheduled
    • Input parameters: NO
    • Triggers: schedule


BT02-First Job

Create new Freestyle project with name BT02-First (1). Select This build is parameterized and add parameter P_TEST_PARAM. Set “This is default value” as Default Value and “This is test parameter” as Description (2,3,4,5,6). Add Execute shell build step (7) with:

echo "Hello! I'am $JOB_NAME. Parameter P_TEST_PARAM=$P_TEST_PARAM"

As you can see there is two variables in the script:

  • JOB_NAME – project environment variable (Click: “See the list of available environment variables”  below Command field to see more)
  • P_TEST_PARAM – job defined parameter

Select Trigger builds remotely (8) and enter “mySecretToken” as Authentication Token (9).

Manual run

Run the job manually. A you can see Jenkins asks you for the P_TEST_PARAM.

Remote run

To run the job remotely open your browser in private mode and paste:


in my case:

If everything is OK, you will see a blank screen. Now go to the project and see the result.



BT02-Second Job

Create new BT02-Second job as copy of the BT02-First (1).



Triggering BT02-Second after BT02-First

Go to BT02-First project configuration and add Build other projects in Post-build Actions (1,2). Enter BT02-Second as Project to build property (3).

Run BT02-First job and see the result.

BT02-Third Job

Create new Freestyle project with name BT02-Third. Select Build after other projects are built and enter BT02-First as Projects to watch. Add Execute shell build step:

echo "Hello! I'am $JOB_NAME."


Run BT02-First job and see the result.

BT02-Scheduled – Job scheduling

Create new Freestyle project with name BT02-Scheduled. Add Execute shell build step:

echo "Hello! I'am $JOB_NAME."

Select Build periodically (1) and enter the schedule (2) (in this example every 2 minutes). For help click help button on the right (3) – it is really good guide (4).

H/2 * * * *


Save and wait 2 minutes for results (1).

The last one step is to disable unused project (2).


0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments