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

[v0.9] Fixes panic when imagescan uses prereleases and * #2183

Merged
merged 1 commit into from Feb 29, 2024

Conversation

0xavi0
Copy link
Contributor

@0xavi0 0xavi0 commented Feb 27, 2024

When using pre-releases in imagescan combined with

semver:
  range: *

it failed because semver ignores pre-releases unless they're explicitly described in the semver.range.

For example:

semver:
  range: ">= 0.0.0-40"

works fine because it is explicitly using a pre-release.

This fixes the * case by checking if there's any version found (lastVersion != nil)

It also adds e2e tests for the following imagescans cases:

  • Deploy gitrepo with imagescan using semver.range = ">= 0.0.0-40" deploying image 0.0.0-40 and after that pushing image 0.0.0-50
  • Same as above but for the case that whis branch fixed (using semver.range = "*" with pre-releases.

Refers to: #2181

@0xavi0 0xavi0 added this to the v2.8.3 milestone Feb 27, 2024
@0xavi0 0xavi0 self-assigned this Feb 27, 2024
@0xavi0 0xavi0 requested a review from a team as a code owner February 27, 2024 12:57
e2e/single-cluster/imagescan_test.go Outdated Show resolved Hide resolved
When using pre-releases in imagescan combined with
```yaml
semver:
  range: *
```
it failed because `semver` ignores pre-releases unless they're
explicitly described in the `semver.range`.

For example:
```yaml
semver:
  range: ">= 0.0.0-40"
```
works fine because it is explicitly using a pre-release.

This fixes the `*` case by checking if there's any version found
(lastVersion != nil)

It also adds `e2e` tests for the following imagescans cases:

* Deploy gitrepo with imagescan using `semver.range = ">= 0.0.0-40"`
  deploying image `0.0.0-40` and after that pushing image `0.0.0-50`
* Same as above but for the case that whis branch fixed (using
  `semver.range = "*"` with pre-releases.

Refers to: rancher#2096

Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
@0xavi0 0xavi0 force-pushed the 0.9-2060-imagescans-prerelease branch from 3330410 to 82aebea Compare February 29, 2024 14:37
@0xavi0 0xavi0 merged commit 71706b1 into rancher:release/v0.9 Feb 29, 2024
10 checks passed
@kkaempf kkaempf modified the milestones: v2.8.3, v2.8-Next1 Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants