Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Bump images and add upload all script #18

Merged
merged 10 commits into from
Mar 27, 2024
Merged

ENH: Bump images and add upload all script #18

merged 10 commits into from
Mar 27, 2024

Conversation

DavidFair
Copy link
Collaborator

Description

  • Bumps all images and rotates out the EOL - 2 images
  • Add a script to upload all images with the correct naming....etc.

See each commit for further details.

Testing

  • Follow the README in cluster-api to prep for an image build
  • Run scripts/build-all.sh to build your images
  • Prep a clouds.yaml file
  • Run scripts/upload-all.sh to upload all the images as per the instructions to a scratch space

@DavidFair DavidFair force-pushed the Feb_24_bump branch 4 times, most recently from 271cec6 to 412d392 Compare February 13, 2024 16:18
The old submodule was still hanging around, clean-up this and bump the
one used to the latest copy
- Drop 1.24 as this is n-2 EOL versions behind
- Bump 1.25 to latest EOL version to allow people to upgrade
- Bump all images including new n-1 versions from latest release
Since we now have a number of images to manage, add a Python script to
automatically upload these with the appropriate names...etc. using the
OpenStack SDK

Longer-term it would be nice to drive the builds with Python but small
incremental steps first
Now we have two scripts, lets call this scripts otherwise it's a bit
confusing
Adds standard CI suite for our new Python scripts, including formatting
and pylint
Adds black to the list of available pre-commit runners and reformat the
existing files
Resolve and suppress newly found pylint warnings on CI job
The previous v1.25 image wasn't supported so adding it back introduced
an older version to people we're trying to upgrade up
@DavidFair DavidFair marked this pull request as ready for review March 1, 2024 11:09
Copy link
Contributor

@anish-mudaraddi anish-mudaraddi left a comment

Choose a reason for hiding this comment

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

small changes. Mostly just change prints to logging

scripts/upload_all.py Outdated Show resolved Hide resolved
scripts/test/test_upload_all.py Outdated Show resolved Hide resolved
assert mocked_upload_single_image.call_count == 0


def _expected_args_helper(file: Path, visibility: str) -> Dict:
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be a fixture?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I keep forgetting we have pytest 🤦‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I remember why

In test_upload_images_to_openstack_real_run I want to simulate two images being created, the problem is the struct holds the filename for each.

This means I need to generate two fixture objects with different paths or simply use list comprehension and a factory pattern like we did here:

    expected = [
        call(args.os_cloud, _expected_args_helper(file, "public"))
        for file in expected_files
    ]

Do you know of an easy way to use fixtures with a pattern a little bit like:

def test_upload_images_to_openstack_real_run(fixture_1, fixture_2, [Path(file_1), Path(file_2)]):

Since most of the solutions I can see multiple the boilerplate?

Switches to logging instead of print statements
Use assert_* methods instead of manually emulating similar effects by
using call_count and arg_list parameters with assert
Fixtures explicitly map onto lifetime and makes it clear how the object
is used within a test.

By switching to it, we've brought this in-line with other unit testing
patterns across projects
@DavidFair DavidFair merged commit 42b8868 into main Mar 27, 2024
9 checks passed
@DavidFair DavidFair deleted the Feb_24_bump branch March 27, 2024 12:40
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.

3 participants