Project

General

Profile

Debian Packaging » History » Version 10

Dominic Cleal, 11/28/2013 01:18 PM

1 1 Greg Sutcliffe
h1. Debian Packaging
2
3
{{toc}}
4
5
h2. Artifacts
6
7 7 Greg Sutcliffe
The following artifacts are generated from the Deb build process and form part of any release:
8 1 Greg Sutcliffe
9
* foreman, including database and compute resource subpackages
10
* foreman-installer
11
* foreman-proxy
12 2 Greg Sutcliffe
* dependencies
13 1 Greg Sutcliffe
14 6 Greg Sutcliffe
h2. Jenkins
15 1 Greg Sutcliffe
16
Jenkins is used to automate the package builds, using the jobs:
17
18 6 Greg Sutcliffe
* http://ci.theforeman.org/view/Packaging/job/packaging_build_deb_dependency (for gems)
19
* http://ci.theforeman.org/view/Packaging/job/packaging_build_deb_coreproject (for core/proxy/installer)
20
21
These jobs rely on matching the branching structure of the core projects to the branching in foreman-packaging.
22
23 8 Greg Sutcliffe
In addition these matrix jobs build regular 'scratch' packages from the develop HEAD
24 1 Greg Sutcliffe
* http://ci.theforeman.org/view/Packaging/job/packaging_build_foreman_matrix
25
* http://ci.theforeman.org/view/Packaging/job/packaging_build_foreman-proxy_matrix
26
27 6 Greg Sutcliffe
The matrix jobs only presently build the nightly packages, thus RC/Stable releases will be queued manually using the basic jobs. The configuration depends on the build you want:
28 1 Greg Sutcliffe
29 9 Dominic Cleal
h3. Scratch build parameters
30 1 Greg Sutcliffe
31 9 Dominic Cleal
h4. Want to test your own branch?
32
33 6 Greg Sutcliffe
Push your packaging updates to your fork of foreman-packaging:deb/develop
34
Change repoowner to your GitHub account
35
Select project (core/proxy/installer)
36
Select OS ('all', or a specific target)
37 1 Greg Sutcliffe
branch should be 'develop'
38 8 Greg Sutcliffe
leave PR field blank
39 6 Greg Sutcliffe
gitrelease should be ticked
40
41 10 Dominic Cleal
The packages will be on stagingdeb.theforeman.org/<os>/<your github user>.  To use in apt, add this to sources.list:
42
43
    deb http://stagingdeb.theforeman.org/ <os>/<username> .
44 1 Greg Sutcliffe
45
h4. Want to test a PR?
46 9 Dominic Cleal
47 8 Greg Sutcliffe
repoowner must be theforeman
48
Select project (core/proxy/installer)
49
Select OS ('all', or a specific target)
50
branch must be x.y (e.g 1.3) - this is both the branch of foreman-packaging _and_ the target component on deb.theforeman.org
51
set PR field to the number of the PR (e.g 113)
52
gitrelease must be ticked
53
54
Final packages will be pushed to stagingdeb.theforeman.org/<os>/theforeman and marked with the string "pr(#number)"
55 1 Greg Sutcliffe
56 8 Greg Sutcliffe
h4. Release (RC or final) build parameters
57 9 Dominic Cleal
58 6 Greg Sutcliffe
This should only be done by the release nanny.
59
60
Make necessary merges from theforeman/foreman-packaging:deb/develop to deb/<release> (e.g. '1.3')
61
repoowner must be theforeman
62
Select project (core/proxy/installer)
63 1 Greg Sutcliffe
Select OS ('all', or a specific target)
64 6 Greg Sutcliffe
branch must be x.y (e.g 1.3) - this is both the branch of foreman-packaging _and_ the target component on deb.theforeman.org
65 1 Greg Sutcliffe
leave PR field blank
66
gitrelease must be unticked
67
68
Final packages will be pushed to deb.theforeman.org/<os>/<branch>
69
70 9 Dominic Cleal
h3. Nightly build parameters
71
72 8 Greg Sutcliffe
These are triggered normally by other jobs in Jenkins, e.g. the test_develop job triggers the Deb matrix job with the following parameters.
73 6 Greg Sutcliffe
74 8 Greg Sutcliffe
repoowner will be theforeman
75
project is determined by the upstream job (eg test_develop will trigger project=foreman)
76
branch will be develop
77
pr be blank
78
gitrelease will be ticked
79 6 Greg Sutcliffe
80
h2. Tooling
81 1 Greg Sutcliffe
82
h3. Pbuilder
83
84
"Pbuilder":http://www.netfort.gr.jp/~dancer/software/pbuilder-doc/pbuilder-doc.html is the system used internally by jenkins to build the packages for each of the architectures. It should just work, but if there are problems, you can look at the pbuilder module in foreman-infra for more detail.
85 6 Greg Sutcliffe
86
h3. Jenkins
87
88
Jenkins is used to prepare the package sources, and the upstream sources, execute the appropriate pbuilder OS environment, and then upload the resulting packages to the appropriate deb repo.
89
90
h3. Freight
91
92
Freight is used to add individual debs to the overall repo. The following actions are performed:
93
94
* Packages are rsync'ed to (staging)deb.theforeman.org from the Jenkins package build
95
* Freight-add <debs> apt/<os>/<repo> is used to stage the debs for adding
96
* Freight-cache apt/<os> is used to rebuild the repo and publish it
97
98
There are cron jobs which clean out old nightly, and scratch debs after 7 days.
99
100
This should all happen automatically, this information is only provided for background. See foreman-infra/puppet/modules/freight for more code.
101 1 Greg Sutcliffe
102
h2. Project sources
103
104
h3. foreman
105 6 Greg Sutcliffe
106 1 Greg Sutcliffe
Foreman{,proxy,installer} is built from the packaging constructs in the foreman-packaging repo:
107 6 Greg Sutcliffe
108 1 Greg Sutcliffe
* https://github.com/theforeman/foreman-packaging/tree/deb/develop (or 1.2/1.3/etc)
109
110
This repo is pulled in by Jenkins, thefore build preparation consists of appropriately updating this repo before queueing the Jenkins jobs.
111
112
h4. Initial tests
113 6 Greg Sutcliffe
114 1 Greg Sutcliffe
The nightly repo tracks the develop branch. At the point when a release candidate is forked, nightly will most likely be at the same commit, and will already be built (as it is triggered by a commit to develop). Thus, if the nightly packages work, one can conclude the packaging constructs in deb/nightly are probably sane. Minimal testing using a scratch build from your own repo is recommended, as above.
115
116
h4. Release candidate
117
118
The following steps are used to step up a release candidate build from nightly
119 4 Greg Sutcliffe
120 6 Greg Sutcliffe
* Cherry-pick appropriate commits from deb/develop into deb/<version> (e.g. deb/1.3)
121 1 Greg Sutcliffe
* Update the UPSTREAM variable in <package>/build_vars.sh to point to correct git-tag for the release (e.g. UPSTREAM=1.3.0-RC1) (TODO: make this a jenkins option like the rpms?)
122 8 Greg Sutcliffe
* Create a new dir for the new release (e.g. 1.3) and add an "rc" symlink to it (eg staged/apt/<os>/1.3 and staged/apt/<os>/rc -> 1.3)
123 6 Greg Sutcliffe
* Add any new dependencies from nightly to <version> (these will have been built during the previous release cycle for nightly, so at release it's just a matter of importing the debs) (TODO: improve this, server login should not be needed)
124 1 Greg Sutcliffe
** Log in to server2
125 4 Greg Sutcliffe
** su -u freight -
126 1 Greg Sutcliffe
** Use freight-add / freight cache to add new deps to rc repo, e.g:
127
*** freight add staged/apt/wheezy/nightly/*sinatra* apt/wheezy/rc                    
128
*** freight cache -v
129 8 Greg Sutcliffe
** Alternatively, just rebuild the deps using the deb_dependency job above
130 1 Greg Sutcliffe
* Update the changelog with a block announcing the release candidate, e.g:
131 6 Greg Sutcliffe
<pre>
132 1 Greg Sutcliffe
foreman (1.3.0~rc1-1) stable; urgency=low
133 6 Greg Sutcliffe
134 1 Greg Sutcliffe
  * Release 1.3.0 RC1
135
136
 -- Greg Sutcliffe <greg.sutcliffe@gmail.com>  Fri, 12 Sep 2013 16:31:00 +0100
137 6 Greg Sutcliffe
138 7 Greg Sutcliffe
</pre>
139 1 Greg Sutcliffe
** Note the Debian changelog is _extremely_ sensitive to format and syntax. If in doubt, do this on a debian box and use the "dch -i" tool to add the entry
140
** Use <release-in-three-parts>~rc<rc-version>-1<packaging-release> as the release to ensure the first stable release can use "-1"
141
* PR / Commit the git changes to foreman-packaging:deb/<version>
142
* Queue the Jenkins jobs!
143
* Test the resulting packages
144
145
h4. Stable release
146
147
The stable release is almost identical to the rc release, with good reason ;)
148 6 Greg Sutcliffe
149
* Foreman-packaging/deb/1.3 should already be up-to-date
150 1 Greg Sutcliffe
* Update the UPSTREAM variable in <package>/build_vars.sh to point to correct git-tag for the release (e.g. UPSTREAM=1.3.0)
151 8 Greg Sutcliffe
* Add any new dependencies from rc to stable (most should already be present, as RCs and Stable release share a numbered repo)
152
** Same process on server2, but also update the symlinks for "stable" to point to the new release, and delete the rc symlinks
153 1 Greg Sutcliffe
* Update the changelog with a block announcing the release, e.g:
154 6 Greg Sutcliffe
<pre>
155 1 Greg Sutcliffe
foreman (1.3.0-1) stable; urgency=low
156
(as above for the rest)
157 7 Greg Sutcliffe
</pre>
158 1 Greg Sutcliffe
* PR / Commit the git changes to foreman-packaging:deb/1.3
159
* Queue the Jenkins jobs!
160
* Test the resulting packages
161 6 Greg Sutcliffe
162 1 Greg Sutcliffe
Foreman-packaging/deb/<version> remains as a branch for point-releases on old versions
163 5 Greg Sutcliffe
164
h3. foreman-proxy
165
166
The exact same process above is used to release the proxy.
167
168
h3. foreman-installer
169 6 Greg Sutcliffe
170 5 Greg Sutcliffe
The exact same process above is used to release the proxy.
171 6 Greg Sutcliffe
172 1 Greg Sutcliffe
h3. Dependencies
173 6 Greg Sutcliffe
174 1 Greg Sutcliffe
Gem dependencies can be built from the same foreman-packaging/<version|develop> repo as the core packages, using the 'packaging_build_deb_dependency' job. Currently only gems can be built, using a modified gem2deb command which replaces the auto-generated debian/ dir with the one from our git repo during the build.
175 6 Greg Sutcliffe
176 1 Greg Sutcliffe
TODO(13/9/13): Non-gem dependencies cannot currently be built automatically, this will be fixed at some point.
177 6 Greg Sutcliffe
178 7 Greg Sutcliffe
If you need to manually build
179 1 Greg Sutcliffe
Foreman's Debian dependencies should all be present in the nightly repo in order to make the nightly builds work. Work is underway to store the appropriate packaging constructs in the foreman-packaging repo, such that they can be rebuilt if needed. The packages are built using pbuilder manually. Rough notes on performing this build are:
180 6 Greg Sutcliffe
181 7 Greg Sutcliffe
* Log in to server9 (the debian slave node)
182 6 Greg Sutcliffe
* Clone foreman-packaging:deb/develop
183 1 Greg Sutcliffe
* cd to the appropriate package and prepare the sources
184 6 Greg Sutcliffe
* run pdebuild-<os_arch> (eg. pdebuild-squeeze32) to generate a package for that OS/Arch
185 1 Greg Sutcliffe
* Upload to server2 and use freight to add to the repo
186
187
TODO: Document this properly.
188
189
h2. Nightly Builds
190
191 6 Greg Sutcliffe
Nightly builds are fully automated. Next time they break I'll document what I did to fix them. Full automation is possible because of the fact that the Debian packages use gem vendoring to ship a cache of prebuilt gems to the user; thus, they are far less susceptible to changes in the Gemfile (downside: they'll never be accepted upstream)
192
193 1 Greg Sutcliffe
Work has begun to start building the foreman packages using proper system gems, see http://etherpad-domcleal.rhcloud.com/p/debian-packaging for how it's going. Currently we build the installer (based on kafo) using proper system gems. Foreman itself is targeted for 1.4