summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Jenkinsfile.kernel-example9
-rw-r--r--doc/jenkins-cpp-build.md38
2 files changed, 47 insertions, 0 deletions
diff --git a/doc/Jenkinsfile.kernel-example b/doc/Jenkinsfile.kernel-example
index f0ed164..92e3f05 100644
--- a/doc/Jenkinsfile.kernel-example
+++ b/doc/Jenkinsfile.kernel-example
@@ -1,12 +1,21 @@
// Example Jenkinsfile for building the Linux kernel
// Uses the custom kernel-builder image (jenkins/kernel-builder/Dockerfile)
// Build the image first: docker build -t kernel-builder jenkins/kernel-builder/
+//
+// NOTE: When using "Pipeline script from SCM", Jenkins clones the repo
+// automatically before running this file. No checkout stage is needed.
+// Configure shallow clone + extended timeout in the job's SCM settings
+// for large repos (see doc/jenkins-cpp-build.md, section 4).
pipeline {
agent {
docker { image 'kernel-builder' }
}
+ options {
+ timeout(time: 4, unit: 'HOURS')
+ }
+
stages {
stage('Build') {
steps {
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