Skip to content

image_name regex patterns do not work #78

Description

@b-dean

The readme says that you can use a regex pattern in image_name to use the latest image that matches that pattern. For example

driver:
  image_name: "example-ol-8-.*"

notice I'm leaving off any start/end of line anchors in the expression, but I'd expect that to behave the same as:

driver:
  image_name: "^example-ol-8-.*$"

In Kitchen::Driver::Oci::Models::Compute#image_id_by_name it does a select over all the images to find ones where the display name matches the pattern:

image_list = images.select { |i| i.display_name.match(/#{image_name}/) }

This actually works as expected and I've looked at the list returned and they do match what I'm looking for. However, the next part of that same method calls filter_image_list which adds on an additional pattern:

image_list.select { |i| i.display_name.match(/#{image_name}-[0-9]{4}\.[0-9]{2}\.[0-9]{2}/) }

And none of my images match that because why would they. It's effectively making my pattern into:
example-ol-8-.*-[0-9]{4}\.[0-9]{2}\.[0-9]{2}
or if I add the anchors it's even worse:
^example-ol-8-.*$-[0-9]{4}\.[0-9]{2}\.[0-9]{2}

I assume that's a YYYY-mm-dd pattern for date that is at the end of some official Oracle Linux image display names, but it certainly isn't on all OCI images.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions