Skip to content

Commit 58ab1f3

Browse files
Ryan Egesdahlbalasankarc
authored andcommitted
Use XZ compression for DEB packages
We have been using the default Gzip compression method for DEB and RPM packages up to this point. However, XZ compression is available in every supported Linux distribution, which reduces the final package size by nearly 30%. We'll use XZ compression for DEB packages by default, with a documented variable to revert to the prior behavior in cases where XZ compression is not supported. We are not using XZ compression for RPM packages right now due to an unknown issue causing the packaging times to increase more that we can afford. https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/8222 is open to investigate more. Changelog: changed MR: https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7128
1 parent 1fe0e0b commit 58ab1f3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

config/projects/gitlab.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,25 @@
273273
package :rpm do
274274
vendor 'GitLab, Inc. <[email protected]>'
275275
signing_passphrase Gitlab::Util.get_env('GPG_PASSPHRASE')
276+
277+
# Enable XZ compression if selected
278+
compress_xz = Gitlab::Util.get_env('COMPRESS_XZ') || 'false'
279+
if compress_xz == 'true'
280+
compression_type :xz
281+
compression_level 6
282+
end
276283
end
277284

278285
package :deb do
279286
vendor 'GitLab, Inc. <[email protected]>'
280287
signing_passphrase Gitlab::Util.get_env('GPG_PASSPHRASE')
288+
289+
# Enable XZ compression if selected
290+
compress_xz = Gitlab::Util.get_env('COMPRESS_XZ') || 'true'
291+
if compress_xz == 'true'
292+
compression_type :xz
293+
compression_level 6
294+
end
281295
end
282296

283297
resources_path "#{Omnibus::Config.project_root}/resources"

doc/build/build_package.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ project's [Container Registry](https://gitlab.com/gitlab-org/gitlab-omnibus-buil
6464
export COMPILE_ASSETS=true
6565
```
6666

67+
1. By default, XZ compression is used to produce the final DEB package,
68+
which reduces the package size by nearly 30% in comparison to Gzip, with
69+
little to no increase in build time. However, the system's package
70+
manager must also support the format. If your system's package manager does
71+
not support XZ packages, set the `COMPRESS_XZ` environment variable to `false`:
72+
73+
```shell
74+
export COMPRESS_XZ=false
75+
```
76+
77+
NOTE: This is feature is disabled by default on RPM platforms due to an
78+
as-yet-unexplained increase in packaging time. It can be enabled by setting
79+
the `COMPRESS_XZ` environment variable to `true`.
80+
6781
1. Install the libraries and other dependencies:
6882

6983
```shell

0 commit comments

Comments
 (0)