Skip to content

Commit d444238

Browse files
dmehaladgoffredo
andauthored
chore: add architecture in release process (#51)
* chore: add architecture in release process * Code review - Describe the purpose of `ARCH` in `release.py` and `nginx-version-info.example` * more review: touch up arch-related documentation * revert submodule change --------- Co-authored-by: David Goffredo <[email protected]>
1 parent 1f9a2c8 commit d444238

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ include the following:
2525

2626
Each release contains one zipped tarball per supported image above. The
2727
naming convention is
28-
`<base image with underscores><hyphen>ngx_http_datadog_module.so.tgz`,
29-
e.g. `nginx_1.23.1-alpine-ngx_http_datadog_module.so.tgz` or
30-
`amazonlinux_2.0.20230119.1-ngx_http_datadog_module.so.tgz`.
28+
`<base image with underscores>-<arch>-ngx_http_datadog_module.so.tgz`,
29+
e.g. `nginx_1.23.1-alpine-amd64-ngx_http_datadog_module.so.tgz` or
30+
`amazonlinux_2.0.20230119.1-arm64-ngx_http_datadog_module.so.tgz`.
31+
32+
Supported architectures (`<arch>`) are `amd64` and `arm64`.
3133

3234
The zipped tarball contains a single file, `ngx_http_datadog_module.so`, which
3335
is the Datadog tracing nginx module.

bin/docker_build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ usage:
1515
1616
Prompt the user for confirmation unless --yes is specified.
1717
18-
--platforms is a comma separated list of platforms to target. --platforms is required.
19-
Example: --platforms linux/amd64,linux/arm64
18+
--platforms is a comma separated list of platforms to target.
19+
--platforms is required. The option has the same format as --platform
20+
in `docker buildx build`.
21+
For example: --platforms linux/amd64,linux/arm64
2022
2123
If --push is specified, push the resulting image to DockerHub
2224
with a suitable tag.

bin/release.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,22 @@ def prepare_release_artifact(build_job_number, work_dir):
288288
module_path = work_dir / 'ngx_http_datadog_module.so'
289289
download_file(module_url, module_path)
290290

291-
# `nginx_version_info` will define BASE_IMAGE. That's that value that we
292-
# want to prefix the tarball name with, but with colons replaced by
293-
# underscores.
291+
# `nginx_version_info` serves to determine the values of BASE_IMAGE and ARCH.
292+
# These values are instrumental in constructing the tarball name according to
293+
# the specified convention: <BASE_IMAGE>-<ARCH>-ngx_http_datadog_module.so.tgz
294294
variables = parse_info_script(nginx_version_info)
295295
if 'BASE_IMAGE' not in variables:
296296
raise Exception(
297297
f"BASE_IMAGE not found in nginx-version-info: {nginx_version_info}"
298298
)
299+
if 'ARCH' not in variables:
300+
raise Exception(
301+
f"ARCH not found in nginx-version-info: {nginx_version_info}"
302+
)
303+
304+
arch = variables['ARCH']
299305
base_prefix = variables['BASE_IMAGE'].replace(':', '_')
300-
tarball_path = work_dir / f'{base_prefix}-ngx_http_datadog_module.so.tgz'
306+
tarball_path = work_dir / f'{base_prefix}-{arch}-ngx_http_datadog_module.so.tgz'
301307
command = [tar_exe, '-czf', tarball_path, '-C', work_dir, module_path.name]
302308
run(command, check=True)
303309

nginx-version-info.example

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,20 @@
3434
#
3535
# NGINX_MODULES_PATH is not required for the "build" or "build-in-docker"
3636
# make targets, but is required for the "test" and "lab" targets.
37+
#
38+
# ARCH
39+
# The docker image architecture to use. The following values are supported:
40+
#
41+
# - amd64
42+
# - arm64
43+
#
44+
# ARCH is not required by any of the make targets, but is used when
45+
# preparing releases.
3746

38-
ARCH=linux/amd64
3947
NGINX_VERSION=1.24.0
4048
BASE_IMAGE=nginx:1.24.0-alpine
4149
NGINX_MODULES_PATH=/usr/lib/nginx/modules
50+
ARCH=amd64
4251

4352
# NGINX_VERSION=1.14.1
4453
# BASE_IMAGE=nginx:1.14.1

0 commit comments

Comments
 (0)