Skip to content

Commit

Permalink
AzureConfigBuilderV2: gracefully handle dot in release versions
Browse files Browse the repository at this point in the history
An osbuild-composer PR#3887 [1] introduces "dot-notation" for distro
versions, meaning that a dot will be used to separate major and minor
version in distro names. For backward compatibility, distro names
without a dot will be still accepted for distros which used to accept
it.

The CIV code parsing a VHD name was not expecting the version to contain
any dot. This results in failures such as [2].

Modify the regular expression to gracefully handle potential dot in the
version string.

[1] osbuild/osbuild-composer#3887
[2] https://gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/-/jobs/5943494707#L3695

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Feb 7, 2024
1 parent 1672285 commit a384881
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cloud/terraform/azure_config_builder_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ def __parse_vhd_name(self, vhd_uri):
r"(?P<date>\d{4}\d{2}\d{2})\.\b(?:sp\.)?(?P<build_nr>\d+)\.(?P<arch>\S*)\.\bvhd"
)

# thozza NB: the 'version' number may contain dot to separate the major and minor version
azure_vhd_regex_image_builder = (
r"https:\/\/(?P<storage_account>.*)\.blob.*\/image-(?P<product_name>.*)-"
r"(?P<version>\d+)-(?P<arch>x86_64|aarch64).*.vhd"
r"(?P<version>(?:[\d]+\.)?\d+)-(?P<arch>x86_64|aarch64).*.vhd"
)

matches = re.match(azure_vhd_regex, vhd_uri, re.IGNORECASE)
Expand Down

0 comments on commit a384881

Please sign in to comment.