|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | """
|
3 |
| -This script automates the release process for the nginx-dataadog module, |
4 |
| -ingress-nginx init container and the installer. |
| 3 | +This script automates the release process for the nginx-dataadog module and |
| 4 | +ingress-nginx init container.. |
5 | 5 |
|
6 | 6 | Usage:
|
7 | 7 | ======
|
|
10 | 10 |
|
11 | 11 | To release ingress-nginx docker init containers:
|
12 | 12 | ./release.py --ci-token <CI_TOKEN> --version-tag v1.3.1 --workflow-id <CI_RELEASE_WORKFLOW_ID> ingres-nginx
|
13 |
| -
|
14 |
| -To release the installer: |
15 |
| -./release.py --ci-token <CI_TOKEN> --version-tag v0.3.3 --workflow-id <CI_RELEASE_WORKFLOW_ID> installer |
16 | 13 | """
|
17 | 14 |
|
18 | 15 | import re
|
@@ -172,29 +169,6 @@ def sign_package(package_path: str) -> None:
|
172 | 169 | run(command, check=True)
|
173 | 170 |
|
174 | 171 |
|
175 |
| -def prepare_installer_release_artifact(work_dir, build_job_number, arch): |
176 |
| - artifacts = send_ci_request_paged( |
177 |
| - f"/project/gh/DataDog/nginx-datadog/{build_job_number}/artifacts") |
178 |
| - module_url = None |
179 |
| - for artifact in artifacts: |
180 |
| - name = artifact["path"] |
181 |
| - if name == "nginx-configurator": |
182 |
| - module_url = artifact["url"] |
183 |
| - |
184 |
| - if module_url is None: |
185 |
| - raise Exception( |
186 |
| - f"Job number {build_job_number} doesn't have an 'nginx-configurator' build artifact." |
187 |
| - ) |
188 |
| - |
189 |
| - module_path = work_dir / "nginx-configurator" |
190 |
| - download_file(module_url, module_path) |
191 |
| - |
192 |
| - # Package and sign |
193 |
| - tarball_path = work_dir / f"nginx-configurator-{arch}.tgz" |
194 |
| - package(module_path, out=tarball_path) |
195 |
| - sign_package(tarball_path) |
196 |
| - |
197 |
| - |
198 | 172 | def prepare_release_artifact(work_dir, build_job_number, flavor, version, arch,
|
199 | 173 | waf):
|
200 | 174 | flavor_prefix = f"{flavor}-"
|
@@ -242,61 +216,6 @@ def prepare_release_artifact(work_dir, build_job_number, flavor, version, arch,
|
242 | 216 | sign_package(debug_tarball_path)
|
243 | 217 |
|
244 | 218 |
|
245 |
| -def release_installer(args) -> int: |
246 |
| - """ |
247 |
| - This subcommand function downloads installer artifacts from the release workflow |
248 |
| - and publishes them to a GitHub release. |
249 |
| -
|
250 |
| - Requirements: |
251 |
| - - You must be logged into the GitHub CLI (gh) to authenticate and publish the release. |
252 |
| - """ |
253 |
| - jobs = get_workflow_jobs(args.workflow_id) |
254 |
| - if not jobs: |
255 |
| - return 1 |
256 |
| - |
257 |
| - with tempfile.TemporaryDirectory() as work_dir: |
258 |
| - for job in jobs: |
259 |
| - if job["name"].startswith("build installer "): |
260 |
| - # name should be something like "build installer on arm64" |
261 |
| - match = re.match(r"build installer on (amd64|arm64)", |
262 |
| - job["name"]) |
263 |
| - if match is None: |
264 |
| - raise Exception( |
265 |
| - f'Job name does not match regex "{re}": {job}') |
266 |
| - arch = match.groups()[0] |
267 |
| - prepare_installer_release_artifact(work_dir, job["job_number"], |
268 |
| - arch) |
269 |
| - |
270 |
| - pubkey_file = os.path.join(work_dir, "pubkey.gpg") |
271 |
| - run([gpg_exe, "--output", pubkey_file, "--armor", "--export"], |
272 |
| - check=True) |
273 |
| - |
274 |
| - # We've tgz'd and signed all of our release modules. |
275 |
| - # Now let's send them to GitHub in a release via `gh release create`. |
276 |
| - release_files = itertools.chain( |
277 |
| - Path(work_dir).glob("*.tgz"), |
278 |
| - Path(work_dir).glob("*.tgz.asc"), |
279 |
| - (pubkey_file, ), |
280 |
| - ) |
281 |
| - |
282 |
| - command = [ |
283 |
| - gh_exe, |
284 |
| - "release", |
285 |
| - "create", |
286 |
| - options.version_tag, |
287 |
| - "--prerelease", |
288 |
| - "--draft", |
289 |
| - "--generate-notes", |
290 |
| - "--verify-tag", |
291 |
| - "--repo", |
292 |
| - "DataDog/nginx-datadog", |
293 |
| - *release_files, |
294 |
| - ] |
295 |
| - run(command, check=True) |
296 |
| - |
297 |
| - return 0 |
298 |
| - |
299 |
| - |
300 | 219 | def release_ingress_nginx(args: typing.Any) -> int:
|
301 | 220 | """
|
302 | 221 | This subcommand function retrieves the modules from the CI workflow, builds the ingress-nginx init container,
|
@@ -351,6 +270,7 @@ def release_ingress_nginx(args: typing.Any) -> int:
|
351 | 270 | collected_images[image_no_arch].append(args.image_name)
|
352 | 271 | collected_images[f"{args.registry}:{version}"].append(
|
353 | 272 | args.image_name)
|
| 273 | + print(collected_images) |
354 | 274 |
|
355 | 275 | create_multiarch_images(collected_images)
|
356 | 276 |
|
@@ -444,16 +364,6 @@ def release_module(args) -> int:
|
444 | 364 | "nginx-module", help="Release the NGINX module")
|
445 | 365 | nginx_module_parser.set_defaults(func=release_module)
|
446 | 366 |
|
447 |
| - # installer subcommand |
448 |
| - installer_parser = subparsers.add_parser( |
449 |
| - "installer", help="Release the NGINX installer") |
450 |
| - installer_parser.set_defaults(func=release_installer) |
451 |
| - installer_parser.add_argument( |
452 |
| - "--installer", |
453 |
| - help="Release the NGINX installer", |
454 |
| - action=argparse.BooleanOptionalAction, |
455 |
| - ) |
456 |
| - |
457 | 367 | # ingress-nginx subcommand
|
458 | 368 | ingress_nginx_parser = subparsers.add_parser(
|
459 | 369 | "ingress-nginx", help="Release ingress-nginx init containers")
|
|
0 commit comments