We're running a number of periodic jobs on a schedule and if Git is not available due to maintenance or an outage (clones from an on-network Github Enterprise instance), the jobs fail. Is there any way to configure jobs so that they can build from the existing workspace if Git is down or inaccessible? Thanks!
Asked
Active
Viewed 300 times
1 Answers
0
The first step is to make sure your periodic job does not cleanup the workspace after its build.
Second, split your pipeline into two stages:
- one for the
git ls-remote
, followed by, if it works, a workspace cleanup and a clone: you can also use try catch if the ls-remote fails, meaning the remote is not available: log a warning, and move on the the second stage - one for the job itself

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Thanks for your reply. This is a single freestyle job using the Git plugin so is the only way to do this with a pipeline? – Vincent Sep 18 '21 at 21:16
-
@Vincent Yes, pipelines (declarative or scripted) are better suited for that kind of workflow – VonC Sep 19 '21 at 00:09