Add submodule-disable for submodule operations
[releng/global-jjb.git] / docs / jjb / lf-c-cpp-jobs.rst
1 ##########
2 C/C++ Jobs
3 ##########
4
5 Job Templates
6 =============
7
8 CMake Sonar
9 -----------
10
11 Sonar job which runs cmake && make then publishes to Sonar.
12
13 This job purposely runs on the master branch as there are configuration needed
14 to support multi-branch.
15
16 :Template Names:
17
18     - {project-name}-cmake-sonar
19     - gerrit-cmake-sonar
20     - github-cmake-sonar
21
22 :Comment Trigger: run-sonar
23
24 :Required parameters:
25
26     :build-node: The node to run build on.
27     :jenkins-ssh-credential: Credential to use for SSH. (Configure in
28         defaults.yaml)
29     :sonar-scanner-version: Version of sonar-scanner to install.
30     :sonarcloud-project-key: SonarCloud project key.
31     :sonarcloud-project-organization: SonarCloud project organization.
32     :sonarcloud-api-token: SonarCloud API Token.
33
34 :Optional parameters:
35
36     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
37     :build-timeout: Timeout in minutes before aborting build. (default: 60)
38     :cmake-opts: Parameters to pass to cmake. (default: '')
39     :cron: Cron schedule when to trigger the job. This parameter also
40         supports multiline input via YAML pipe | character in cases where
41         one may want to provide more than 1 cron timer.  (default: '@daily')
42     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
43     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
44         (default: $BUILD_DIR/output)
45
46         .. code-block:: bash
47            :caption: Example
48
49            install-prefix: |
50                #!/bin/bash
51                echo "Hello World."
52
53     :make-opts: Parameters to pass to make. (default: '')
54     :pre-build: Shell script to run before performing build. Useful for
55         setting up dependencies. (default: '')
56     :submodule-recursive: Whether to checkout submodules recursively.
57         (default: true)
58     :submodule-timeout: Timeout (in minutes) for checkout operation.
59         (default: 10)
60     :submodule-disable: Disable submodule checkout operation.
61         (default: false)
62
63     :gerrit_sonar_triggers: Override Gerrit Triggers.
64
65 CMake Stage
66 -----------
67
68 Stage job which runs cmake && make && make install and then packages the
69 project into a tar.xz tarball to produce a release candidate.
70
71 :Template Names:
72
73     - {project-name}-cmake-stage-{stream}
74     - gerrit-cmake-stage
75     - github-cmake-stage
76
77 :Comment Trigger: stage-release
78
79 :Required parameters:
80
81     :build-node: The node to run build on.
82     :jenkins-ssh-credential: Credential to use for SSH.
83         (Configure in defaults.yaml)
84     :nexus-group-id: The Maven style Group ID for the namespace of the project
85         in Nexus.
86     :staging-profile-id: The unique Nexus Staging Profile ID for the project.
87         Contact your infra admin if you do not know it.
88
89 :Optional parameters:
90
91     :branch: Git branch to fetch for the build. (default: master)
92     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
93     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
94     :build-timeout: Timeout in minutes before aborting build. (default: 60)
95     :cmake-opts: Parameters to pass to cmake. (default: '')
96     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
97     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
98         (default: $BUILD_DIR/output)
99
100         .. code-block:: bash
101            :caption: Example
102
103            install-prefix: |
104                #!/bin/bash
105                echo "Hello World."
106
107     :make-opts: Parameters to pass to make. (default: '')
108     :pre-build: Shell script to run before performing build. Useful for
109         setting up dependencies. (default: '')
110     :stream: Keyword that to represent a release code-name.
111         Often the same as the branch. (default: master)
112     :submodule-recursive: Whether to checkout submodules recursively.
113         (default: true)
114     :submodule-timeout: Timeout (in minutes) for checkout operation.
115         (default: 10)
116     :submodule-disable: Disable submodule checkout operation.
117         (default: false)
118     :version: (default: '') Project version to stage release as. There are 2
119         methods for using this value:
120
121         1) Defined explicitly here.
122         2) Leave this value blank and set /tmp/artifact_version
123
124         Use method 2 in conjunction with 'pre-build' configuration to
125         generate the artifact_version automatically from files in the
126         project's repository. For example with pre-build script:
127
128         .. code-block:: bash
129
130            #!/bin/bash
131            MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
132            MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
133            PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
134            echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
135
136 CMake Verify
137 ------------
138
139 Verify job which runs cmake && make && make install to test a project build..
140
141 :Template Names:
142
143     - {project-name}-cmake-verify-{stream}
144     - gerrit-cmake-verify
145     - github-cmake-verify
146
147 :Comment Trigger: recheck|reverify
148
149 :Required parameters:
150
151     :build-node: The node to run build on.
152     :jenkins-ssh-credential: Credential to use for SSH.
153         (Configure in defaults.yaml)
154
155 :Optional parameters:
156
157     :branch: Git branch to fetch for the build. (default: master)
158     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
159     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
160     :build-timeout: Timeout in minutes before aborting build. (default: 60)
161     :cmake-opts: Parameters to pass to cmake. (default: '')
162     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
163     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
164         (default: $BUILD_DIR/output)
165
166         .. code-block:: bash
167            :caption: Example
168
169            install-prefix: |
170                #!/bin/bash
171                echo "Hello World."
172
173     :make-opts: Parameters to pass to make. (default: '')
174     :pre-build: Shell script to run before performing build. Useful for
175         setting up dependencies. (default: '')
176     :stream: Keyword that to represent a release code-name.
177         Often the same as the branch. (default: master)
178     :submodule-recursive: Whether to checkout submodules recursively.
179         (default: true)
180     :submodule-timeout: Timeout (in minutes) for checkout operation.
181         (default: 10)
182     :submodule-disable: Disable submodule checkout operation.
183         (default: false)
184
185     :gerrit_verify_triggers: Override Gerrit Triggers.
186     :gerrit_trigger_file_paths: Override file paths which to filter which file
187         modifications will trigger a build.