Accessing a Private Repo
Before chaining jobs, note how to connect a private GitHub repo:
- Install Git on the AWS terminal:
yum install git -y
- On GitHub: Profile Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token, and select the
repo scope.
- In Jenkins: Credentials → Add credentials → select Username & Password → Username = GitHub username, Password = the generated token → Description =
github-credentials → Save.
What Are Linked Jobs?
Linked jobs are used when one job needs to trigger another job as part of a larger execution sequence.
- An upstream job is a configured project that triggers another project as part of its execution.
- A downstream job is a configured project that gets triggered as part of another job's execution.
Example Chain
JOB-1 → JOB-2 → JOB-3 → JOB-4
- For Job-1, Job-2 is downstream.
- For Job-2, upstream is Job-1; downstream is Job-3 & Job-4.
- For Job-3, upstream is Job-1 & Job-2; downstream is Job-4.
- For Job-4, all of Job-1, Job-2 & Job-3 are upstream.
Upstream/downstream chaining lets you orchestrate the exact order of execution for different operations.
How to Configure
- Create Job-1 and save.
- Create Job-2 → Configure → Build Triggers → check "Build after other projects are built" → type
task-1 under "Projects to watch" → choose the trigger condition (only if stable, even if unstable, even if fails, or always).
- Repeat similarly for Job-3 and Job-4, watching the correct previous jobs.
Once Job-1 is built successfully, all the linked downstream jobs build automatically in sequence. Opening any job shows its Upstream Projects and Downstream Projects sections.