1

I have a Jenkins (non-declarative) pipeline build, with several stages. The build consists of several components, that are all built from the same git repository. One of the stages (building Linux kernel) is quite slow, and rarely changes.

How can I skip a stage when there are no changes to a specific subdirectory?

(Artifactory is used for transferring the binaries between the stages)

For example: If there is a change to the directory Linux: 1. Execute stage "build Linux", upload to artifactory 2. Execute rest of the pipeline, the newly built Linux image from artifactory is downloaded

If the are no changes to the Linux directory: 1. No change, skip stage "build Linux" 2. Execute rest of the pipeline, the latest built Linux image from artifactory is downloaded

Eloff
  • 668
  • 7
  • 22

1 Answers1

0

Check if you can make a pipeline sparse checkout of just the subfolder you want: if that content changes, then trigger a sub-job with the rest of the process.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the suggestion. Any idea on how to check for changes since last build? – Eloff Apr 19 '18 at 04:32
  • @Eloff the idea (to be tested) is that the entry job configured with a sparse checked out repo would only be triggered if elements of that folder changes. – VonC Apr 19 '18 at 04:34
  • I don't think it works that way. Previously, before pipelines, I used sparse checkouts, but also had to configure: "polling ignores commits in certain paths" to avoid _triggering_ the job. If I trigger a sub-job from the pipeline, I think this check would be ignored – Eloff Apr 19 '18 at 04:50