diff options
Diffstat (limited to 'doc/jenkins-cpp-build.md')
| -rw-r--r-- | doc/jenkins-cpp-build.md | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/jenkins-cpp-build.md b/doc/jenkins-cpp-build.md index d60ffe9..6449ffd 100644 --- a/doc/jenkins-cpp-build.md +++ b/doc/jenkins-cpp-build.md @@ -123,6 +123,44 @@ On the job configuration page: 6. **Script Path**: leave as `Jenkinsfile` (default) 7. Click **Save** +### Large repositories + +For large repos (e.g., the Linux kernel), the default 10-minute fetch timeout +is too short. In the SCM config, click **Additional Behaviours** > **Advanced +clone behaviours** and set: + +- **Fetch tags**: uncheck +- **Timeout (in minutes) for clone and fetch**: `120` (or more) +- **Shallow clone**: check +- **Shallow clone depth**: `1` + +Shallow clone fetches only the latest commit, reducing clone size significantly. + +### Automatic SCM checkout + +When using **Pipeline script from SCM**, Jenkins automatically clones the +repository before running the Jenkinsfile (the "Declarative: Checkout SCM" +step). The workspace already contains the code, so you do **not** need a +`checkout` or `git clone` stage in your Jenkinsfile — adding one would clone +the repo a second time. Just use the files directly in your build stages: + +```groovy +pipeline { + agent { + docker { image 'gcc:latest' } + } + + stages { + stage('Build') { + steps { + // Source code is already in the workspace from SCM checkout + sh 'g++ -o my_app main.cpp' + } + } + } +} +``` + ## 5. Run the build |
