Skip to content

ci: add automated test coverage for image validation - #548

Open
nryanl wants to merge 2 commits into
canonical:mainfrom
nryanl:nryanl_541
Open

nryanl wants to merge 2 commits into
canonical:mainfrom
nryanl:nryanl_541

Conversation

@nryanl

@nryanl nryanl commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Update existing Ubuntu release metadata
  • Add automated integration tests validating Ubuntu release metadata
  • Add automated integration tests validating current cloud image offerings
  • Added CI workflow validating running release metadata and cloud image offerings weekly

Additional Context and Relevant Issues

Fixes #541

Test Steps

@nryanl
nryanl force-pushed the nryanl_541 branch 2 times, most recently from ce0339c to 6f852bf Compare November 30, 2026 22:45
Update UBUNTU_RELEASE_VERSION_MAP and LTS_RELEASES for active releases,
add integration tests validating release metadata and daily/released
image offerings per cloud, and add a scheduled workflow to run them weekly
@nryanl
nryanl marked this pull request as ready for review November 30, 2026 22:50
@nryanl
nryanl requested a review from blackboxsw November 30, 2026 22:51

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this @nryanl. Let's consolidate the LTS_* valiables in pycloudlib/util.py where we can and avoid having two hard-coded lists of distro release names where possible.

Comment thread pycloudlib/util.py
}

LTS_RELEASES = ["xenial", "bionic", "focal", "jammy", "noble"]
LTS_RELEASES = ["bionic", "focal", "jammy", "noble", "resolute"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's separate ESM_LTS_RELEASES from STANDARD_SUPPORT_LTS_RELEASES in this file instead of dropping "xenial" altogether. This will allow consumers to differentiate Pro-supported (ESM releases) from standard support releases in one place. I don't like that we are adding a separate set of lists to maintain in test_image_offerings as we now have two separate locations to updated release names instead of one. Please move related ACTIVE_RELEASES and STANDARD_LTS_RELEASES out of that unittest. Rename as you see fit.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've also made a good point that Xenial is actualy out of ESM now, so dropping it is reasonable. I still think differentiating ESM_LTS_RELEASES from LTS_RELEASES is a reasonable approach to help test lookups for PRO supported images (esm) vs standard support.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are dropping xenial test support from pycloudlib, let's make it official and drop support everywhere (ec2/azure/gce etc) and create a separate commit for it.

def test_ec2_image_offerings():
"""Verify EC2 daily_image and released_image resolve for supported image types."""
matrix = {
ImageType.GENERIC: [*STANDARD_LTS_RELEASES, "stonking"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than hard-coding "stonking" should we instead find a way to sort UBUNTU_RELEASE_VERSION_MAP based on XX.YY value and include every interim release name > LTS_RELEASES[-1]?

), f"Deprecated Azure URN {urn} ({release}, {image_type.name})"


@pytest.mark.ci

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want this run on every PR? I think we can limit this to running on main_check once a merge happens. I don't want to block on every PR due to image offering changes.

return active_map, active_lts, all_map


@pytest.mark.ci

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this test and others. Let's not block all PRs due to image changes, but rely on main_check runs to alert us side-channel to image/platform inconsistencies.

Comment on lines +33 to +48
_SETUP_ERRORS = (
ApiException,
BotoCoreError,
ClientAuthenticationError,
CloudSetupError,
ConfigFileNotFound,
FileNotFoundError,
GoogleAuthError,
IBMClassicException,
InvalidConfig,
KeyError,
MissingPrerequisiteError,
ProfileNotFound,
RuntimeError,
ValueError,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are generally skipping on any error whatsoever, which feels a bit like we are likely of overlook true runtime errors, valueerrors and keywerrors that represent mis-configuration. Can we dial this list down a bit to specific failures we are trying to avoid? I think only absence of configuration for the platform in pycloudlib.toml should be a valid condition. The rest of these excceptions feel like they are ignoring mis-configured or partially configured environments.

@contextmanager
def _cloud_or_skip(cloud_cls: type[BaseCloud]) -> Iterator[BaseCloud]:
"""Instantiate cloud_cls or skip the test if credentials/prerequisites are absent."""
try:

@blackboxsw blackboxsw Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth first checking if the cloud platform type [qemu] [lxd] [ec2] etc is defined in pycloudlib.toml and skip if unconfigured to avoid trying to catch all the other exceptions and instead provide a clear skip messages about missing config.

fi
if ! grep -q '^\[lxd\]' ~/.config/pycloudlib.toml 2>/dev/null; then
echo "[lxd]" >> ~/.config/pycloudlib.toml
fi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than trying to fix an incorrect/empty PYCOUDLIB_TOML. Let's make this PYCOUDLIB_TOML secret required (like we do in cloud-init github workflows). Then we can have a clear error when the repo doesn't contain such a secret.


jobs:
validate-images:
runs-on: ubuntu-24.04

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a conditional that prevents this workflow from running on any forked remotes. Limit it to run on canonical/pycloudlib repo (like we do in cloud-init scheduled workflows)

run: |
sudo apt-get update -q
sudo apt-get install -qy distro-info
sudo snap install lxd

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setup-lxd action does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: add automated test coverage asserting that all Ubuntu daily and release images are resolvable on each cloud: Azure, Ec2, GCE

2 participants