Merge ~cjdc/ubuntu-docker-images/+git/templates:supp-python-lt-3.5 into ~ubuntu-docker-images/ubuntu-docker-images/+git/templates:main

Proposed by Cristovao Cordeiro
Status: Merged
Merged at revision: 0f3e5e68efb240a435c40a5dbc650276a4d2425f
Proposed branch: ~cjdc/ubuntu-docker-images/+git/templates:supp-python-lt-3.5
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/templates:main
Diff against target: 71 lines (+16/-5)
4 files modified
docs/public.ecr.aws/ubuntu/ubuntu.md (+3/-3)
generate_ubuntu_yaml.py (+3/-1)
requirements.txt (+5/-0)
tests/test_generate_ubuntu_yaml.py (+5/-1)
Reviewer Review Type Date Requested Status
Tomáš Virtus Approve
ROCKS Developers Pending
Review via email: mp+434361@code.launchpad.net

Commit message

feat: add future_fstrings coding
Some of our existing pipelines run the Ubuntu yaml generation
Python script, which uses f strings. Older pipelines (like
bionic) run with Python <=3.5, which doesn't support f strings.
This MP adds a requirements file and an additional requirement,
future_fstrings, to allow the execution of the Python script, as
is, on older Python versions.

To post a comment you must log in.
Revision history for this message
Tomáš Virtus (virtustom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/docs/public.ecr.aws/ubuntu/ubuntu.md b/docs/public.ecr.aws/ubuntu/ubuntu.md
2index c4e9c01..336f7e6 100644
3--- a/docs/public.ecr.aws/ubuntu/ubuntu.md
4+++ b/docs/public.ecr.aws/ubuntu/ubuntu.md
5@@ -19,9 +19,9 @@ Up to 10 years customer security maintenance `from canonical/ubuntu`. [Request a
6
7 | Channel Tags | | | | Currently | Architectures |
8 |---|---|---|---|---|---|
9- | **`22.10_stable`** | **`22.10`, `22.10_beta`, `22.10_candidate`, `22.10_edge`, `22.10_stable`, `kinetic`, `kinetic-22.10_edge`, `latest`** | - | [-](https://gallery.ecr.aws/lts/ubuntu) | Ubuntu 22.10 "Kinetic Kudu" | `arm`, `amd64`, `arm64`, `ppc64le`, `s390x` |
10+ | **`22.10_stable`** | **`22.10`, `22.10_beta`, `22.10_candidate`, `22.10_edge`, `22.10_stable`, `kinetic`, `kinetic-22.10_edge`, `latest`** | - | [-](https://gallery.ecr.aws/lts/ubuntu) | Ubuntu 22.10 "Kinetic Kudu" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
11 | `22.04_stable` | `22.04`, `22.04_beta`, `22.04_candidate`, `22.04_edge`, `22.04_stable`, `jammy`, `jammy-22.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2027 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2032 | Ubuntu 22.04 LTS "Jammy Jellyfish" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
12- | `20.04_stable` | `20.04`, `20.04_beta`, `20.04_candidate`, `20.04_edge`, `20.04_stable`, `focal`, `focal-20.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2025 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2030 | Ubuntu 20.04 LTS "Focal Fossa" | `arm`, `amd64`, `arm64`, `ppc64le`, `s390x` |
13+ | `20.04_stable` | `20.04`, `20.04_beta`, `20.04_candidate`, `20.04_edge`, `20.04_stable`, `focal`, `focal-20.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2025 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2030 | Ubuntu 20.04 LTS "Focal Fossa" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
14 | `18.04_stable` | `18.04`, `18.04_beta`, `18.04_candidate`, `18.04_edge`, `18.04_stable`, `bionic`, `bionic-18.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2023 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2028 | Ubuntu 18.04 LTS "Bionic Beaver" | `arm`, `arm64`, `386`, `s390x`, `amd64`, `ppc64le` |
15 | `23.04_edge` | `23.04`, `23.04_edge`, `edge`, `lunar`, `lunar-23.04_edge` | - | [-](https://gallery.ecr.aws/lts/ubuntu) | Ubuntu 23.04 "Lunar Lobster" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
16 | _`track_risk`_ |
17@@ -31,7 +31,7 @@ _The following tags might not be available in public.ecr.aws/ubuntu/ubuntu, but
18 | Channel Tags | | | | Currently | Architectures |
19 |---|---|---|---|---|---|
20 | _**`22.04_stable`**_ | **`22.04`, `22.04_beta`, `22.04_candidate`, `22.04_edge`, `22.04_stable`, `jammy`, `jammy-22.04_edge`** | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2027 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2032 | Ubuntu 22.04 LTS "Jammy Jellyfish" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
21- | _`20.04_stable`_ | `20.04`, `20.04_beta`, `20.04_candidate`, `20.04_edge`, `20.04_stable`, `focal`, `focal-20.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2025 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2030 | Ubuntu 20.04 LTS "Focal Fossa" | `arm`, `amd64`, `arm64`, `ppc64le`, `s390x` |
22+ | _`20.04_stable`_ | `20.04`, `20.04_beta`, `20.04_candidate`, `20.04_edge`, `20.04_stable`, `focal`, `focal-20.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2025 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2030 | Ubuntu 20.04 LTS "Focal Fossa" | `amd64`, `arm64`, `arm`, `ppc64le`, `s390x` |
23 | _`18.04_stable`_ | `18.04`, `18.04_beta`, `18.04_candidate`, `18.04_edge`, `18.04_stable`, `bionic`, `bionic-18.04_edge` | [![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2023 | [![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)](https://gallery.ecr.aws/lts/ubuntu) until 04/2028 | Ubuntu 18.04 LTS "Bionic Beaver" | `arm`, `arm64`, `386`, `s390x`, `amd64`, `ppc64le` |
24 | _`16.04_stable`_ &nbsp;&nbsp; | | - | ![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17) until 04-2026 | Ubuntu Xenial Xerus 16.04 ESM | `amd64`, `arm`, `arm64`, `s390x`, `ppc64le` |
25 | _`14.04_stable`_ &nbsp;&nbsp; | | - | ![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17) until 04-2024 | Ubuntu Trusty Tahr 14.04 ESM | `amd64`, `arm`, `arm64`, `s390x` , `ppc64le`|
26diff --git a/generate_ubuntu_yaml.py b/generate_ubuntu_yaml.py
27index 87efc95..37a840f 100755
28--- a/generate_ubuntu_yaml.py
29+++ b/generate_ubuntu_yaml.py
30@@ -1,4 +1,5 @@
31 #!/usr/bin/env python3
32+# -*- coding: future_fstrings -*-
33
34 import argparse
35 import base64
36@@ -168,7 +169,8 @@ class GenerateUbuntuYaml:
37 out = subprocess.run(
38 command,
39 **kwargs,
40- capture_output=True,
41+ stdout=subprocess.PIPE,
42+ stderr=subprocess.PIPE,
43 check=True,
44 universal_newlines=True,
45 )
46diff --git a/requirements.txt b/requirements.txt
47new file mode 100644
48index 0000000..27cda10
49--- /dev/null
50+++ b/requirements.txt
51@@ -0,0 +1,5 @@
52+awscli
53+boto3
54+future-fstrings
55+pyyaml
56+requests
57diff --git a/tests/test_generate_ubuntu_yaml.py b/tests/test_generate_ubuntu_yaml.py
58index 60aa350..21c3192 100644
59--- a/tests/test_generate_ubuntu_yaml.py
60+++ b/tests/test_generate_ubuntu_yaml.py
61@@ -297,7 +297,11 @@ def test_process_run_work(
62 mock_subprocess.return_value.stdout = run_output
63 assert mock_generate_ubuntu_yaml.process_run(mock_input) == expected
64 mock_subprocess.assert_called_once_with(
65- mock_input, capture_output=True, check=True, universal_newlines=True
66+ mock_input,
67+ stdout=subprocess.PIPE,
68+ stderr=subprocess.PIPE,
69+ check=True,
70+ universal_newlines=True,
71 )
72
73

Subscribers

People subscribed via source and target branches