Document steps for deploying ci-jobs
[releng/global-jjb.git] / README.md
1 # Global JJB
2
3 The purpose of this repository is store generically define reusable JJB
4 templates that can be deployed across LF projects.
5
6 The following variables are necessary to be defined in the Jenkins server as
7 global environment variables as scripts in this repo expect these variables to
8 be available.
9
10 For example:
11
12 ```
13 GIT_URL=ssh://jenkins-$SILO@git.opendaylight.org:29418
14 JENKINS_HOSTNAME=jenkins092
15 LOGS_SERVER=https://logs.opendaylight.org
16 NEXUS_URL=https://nexus.opendaylight.org
17 SILO=releng
18 ```
19
20 ## Jenkins Plugin Requirements
21
22 **Required**
23
24 - Config File Provider
25 - Description Setter
26 - Gerrit Trigger
27 - Post Build Script
28 - SSH Agent
29 - Workspace Cleanup
30
31 **Optional**
32
33 - Mask Passwords
34 - MsgInject
35 - OpenStack Cloud
36 - Timestamps
37
38 ## Installing global-jjb
39
40 global-jjb should be deployed in the ci-management repository's jjb directory as
41 a submodule. global-jjb is versioned and tagged in Gerrit so installing,
42 upgrading, and rolling back changes should be simple via the Gerrit tag system.
43
44 ```
45     # Choose a global-jjb version to install
46     GLOBAL_JJB_VERSION=v0.1.0
47
48     # Add the new submodule to ci-management's jjb directory.
49     # Note: Only needs to be performed once per ci-management repo.
50     cd jjb/
51     git submodule add https://gerrit.linuxfoundation.org/infra/releng/global-jjb
52
53     # Checkout the version of global-jjb you wish to deploy.
54     cd global-jjb
55     git checkout $GLOBAL_JJB_VERSION
56
57     # Commit global-jjb version to the ci-management repo.
58     cd ../..
59     git add jjb/global-jjb
60     git commit -sm "Install global-jjb $GLOBAL_JJB_VERSION"
61
62     # Push the patch to ci-management for review
63     git review
64 ```
65
66 ## Parameters stored in defaults.yaml
67
68 There are a few project specific parameters that should be stored in the
69 ci-management repo's defaults.yaml file.
70
71 **gerrit-server-name**: The name of the Gerrit Server as defined in Gerrit
72 Trigger global configuration.
73
74 **jenkins-ssh-credential**: The name of the Jenkins Credential to use for ssh
75 connections.
76
77 defaults.yaml:
78
79 ```
80 - defaults:
81     name: global
82
83     # lf-infra defaults
84     jenkins-ssh-credential: opendaylight-jenkins-ssh
85     gerrit-server-name: OpenDaylight
86 ```
87
88 ## Config File Management
89
90 ### Logs
91
92 The logs account requires a Maven Settings file created called
93 **jenkins-log-archives-settings** with a server ID of **logs** containing the
94 credentials for the logs user in Nexus.
95
96 ## Deploying ci-jobs
97
98 The CI job group contains multiple jobs that should be deployed in all LF
99 Jenkins infra. The minimal configuration needed to deploy the ci-management
100 jobs is as follows which deploys the **{project-name}-ci-jobs** job group as
101 defined in **lf-ci-jobs.yaml**.
102
103 ci-management.yaml:
104
105 ```
106 - project:
107     name: ci-jobs
108
109     jobs:
110       - '{project-name}-ci-jobs'
111
112     project: ci-management
113     project-name: ci-management
114     build-node: centos7-basebuild-2c-1g
115 ```
116
117 Required parameters:
118
119 **project**: is the project repo as defined in Gerrit.
120 **project-name**: is a custom name to call the job in Jenkins.
121 **build-node**: is the name of the builder to use when building (Jenkins label).
122
123 Optional parameters:
124
125 **branch**: is the git branch to build from.
126 **jjb-version**: is the version of JJB to install in the build minion.