Fix API breakage caused by OS Plugin version scan
[releng/global-jjb.git] / docs / install.rst
1 #######
2 Install
3 #######
4
5 global-jjb requires configuration in 2 places; ``Jenkins`` and the
6 :term:`ci-management` repository.
7
8 .. _jenkins-config:
9
10 Jenkins configuration
11 =====================
12
13 On the Jenkins side, we need to prep ``environment variables`` and
14 ``plugins`` required by the jobs in global-jjb before we can start our first
15 jobs.
16
17 .. _jenkins-install-plugins:
18
19 Install Jenkins plugins
20 -----------------------
21
22 Install the following required Jenkins plugins and any optional ones as
23 necessary by the project.
24
25 **Required**
26
27 - `Config File Provider <https://plugins.jenkins.io/config-file-provider>`_
28 - `Description Setter <https://plugins.jenkins.io/description-setter>`_
29 - `Environment Injector Plugin <https://plugins.jenkins.io/envinject>`_
30 - `Git plugin <https://plugins.jenkins.io/git>`_
31 - `Post Build Script <https://plugins.jenkins.io/postbuildscript>`_
32 - `SSH Agent <https://plugins.jenkins.io/ssh-agent>`_
33 - `Workspace Cleanup <https://plugins.jenkins.io/ws-cleanup>`_
34
35 **Required for Gerrit connected systems**
36
37 - `Gerrit Trigger <https://plugins.jenkins.io/gerrit-trigger>`_
38
39 **Required for GitHub connected systems**
40
41 - `GitHub plugin <https://plugins.jenkins.io/github>`_
42 - `GitHub Pull Request Builder <https://plugins.jenkins.io/ghprb>`_
43
44 **Optional**
45
46 - `Mask Passwords <https://plugins.jenkins.io/mask-passwords>`_
47 - `MsgInject <https://plugins.jenkins.io/msginject>`_
48 - `OpenStack Cloud <https://plugins.jenkins.io/openstack-cloud>`_
49 - `Timestamper <https://plugins.jenkins.io/timestamper>`_
50
51 .. _jenkins-envvars:
52
53 Environment Variables
54 ---------------------
55
56 The :ref:`lf-global-jjb-jenkins-cfg-merge` job can manage environment variables
57 job but we must first bootstrap them in Jenkins so that the job can run and
58 take over.
59
60 **Required**::
61
62     GIT_URL=ssh://jenkins-$SILO@git.opendaylight.org:29418
63     JENKINS_HOSTNAME=jenkins092
64     NEXUS_URL=https://nexus.opendaylight.org
65     SILO=production
66     SONAR_URL=https://sonar.opendaylight.org
67
68 **Gerrit**::
69
70     GERRIT_URL=https://git.opendaylight.org/gerrit
71
72 **GitHub**::
73
74     GIT_URL=https://github.com
75     GIT_CLONE_URL=git@github.com:
76
77 .. note::
78
79    Use ``GIT_CLONE_URL`` for GitHub projects as this will be different from the
80    URL used in the properties configuration.
81
82 **Optional**::
83
84     LOGS_SERVER=https://logs.opendaylight.org
85
86 Steps
87
88 #. Navigate to https://jenkins.example.org/configure
89 #. Configure the environment variables as described above
90 #. Configure the same environment variables in the :term:`ci-management` repo
91
92 .. _jenkins-ci-management:
93
94 ci-management
95 =============
96
97 :term:`ci-management` is a git repository containing :term:`JJB` configuration
98 files for Jenkins Jobs. Deploying Global JJB here as a submodule allows us easy
99 management to install, upgrade, and rollback changes via git tags. Install
100 Global JJB as follows:
101
102 #. Install Global JJB
103
104    .. code-block:: bash
105
106       GLOBAL_JJB_VERSION=v0.1.0
107       git submodule add https://github.com/lfit/releng-global-jjb.git jjb/global-jjb
108       cd jjb/global-jjb
109       git checkout $GLOBAL_JJB_VERSION
110       cd ../..
111       git add jjb/global-jjb
112       git commit -sm "Install global-jjb $GLOBAL_JJB_VERSION"
113
114    .. note::
115
116       We are purposely using github for production deploys of global-jjb so that
117       uptime of LF Gerrit does not affect projects using global-jjb. In a test
118       environment we can use
119       https://gerrit.linuxfoundation.org/infra/releng/global-jjb if desired.
120
121 #. Setup ``jjb/defaults.yaml``
122
123    Create and configure the following parameters in the
124    ``jjb/defaults.yaml`` file as described in the
125    `defaults.yaml configuration docs <defaults-yaml>`.
126
127    Once configured commit the modifications:
128
129    .. code-block:: bash
130
131       git add jjb/defaults.yaml
132       git commit -sm "Setup defaults.yaml"
133
134 #. Push patches to Gerrit / GitHub using your favourite push method
135
136 At this point global-jjb installation is complete in the :term:`ci-management`
137 repo and is ready for use.
138
139 .. _deploy-ci-jobs:
140
141 Deploy ci-jobs
142 ==============
143
144 The CI job group contains jobs that should deploy in all LF
145 Jenkins infra. The minimal configuration to deploy the
146 **{project-name}-ci-jobs** job group as defined in **lf-ci-jobs.yaml** is as
147 follows:
148
149 jjb/ci-management/ci-management.yaml:
150
151 .. code-block:: yaml
152
153    - project:
154        name: ci-jobs
155
156        jobs:
157          - '{project-name}-ci-jobs'
158
159        project: ci-management
160        project-name: ci-management
161        build-node: centos7-builder-2c-1g
162
163 **Required parameters**:
164
165 :project: The project repo as defined in source control.
166 :project-name: A custom name to call the job in Jenkins.
167 :build-node: The name of the builder to use when building (Jenkins label).
168
169 **Optional parameters**:
170
171 :branch: The git branch to build from. (default: master)
172 :jjb-version: The version of JJB to install in the build minion. (default:
173     <defined by the global-jjb project>)
174
175 .. _deploy-packer-jobs:
176
177 Deploy packer-jobs
178 ==================
179
180 The packer job group contains jobs to build custom minion images. The minimal
181 configuration needed to deploy the packer jobs is as follows which deploys the
182 **{project-name}-packer-jobs** job group as defined in **lf-ci-jobs.yaml**.
183
184 jjb/ci-management/packer.yaml:
185
186 .. code-block:: yaml
187
188    - project:
189        name: packer-builder-jobs
190
191        jobs:
192          - '{project-name}-packer-jobs'
193
194        project: ci-management
195        project-name: ci-management
196        branch: master
197        build-node: centos7-builder-2c-1g
198
199        platforms:
200          - centos
201          - ubuntu-16.04
202
203        templates: builder
204
205    - project:
206        name: packer-docker-jobs
207
208        jobs:
209          - '{project-name}-packer-jobs'
210
211        project: ci-management
212        project-name: ci-management
213        branch: master
214        build-node: centos7-builder-2c-1g
215
216        templates: docker
217
218        platforms:
219          - centos
220          - ubuntu-16.04
221
222 **Required parameters**:
223
224 :project: The project repo as defined in source control.
225 :project-name: A custom name to call the job in Jenkins.
226 :build-node: The name of the builder to use when building (Jenkins label).
227 :platforms: A list of supported platforms.
228 :templates: A list of templates to build. We recommend setting one template per
229     ``project`` section so that we can control which platforms to build for
230     specific templates.
231
232 **Optional parameters**:
233
234 :branch: The git branch to build from. (default: master)
235 :packer-version: The version of packer to install in the build minion,
236     when packer is not available. (default: <defined by global-jjb>)