-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue for distinct revisions when vulnerabilities are found (#295)
* feat: report vul scan findings by revisions and affected tags * fix: install pydantic dep * feat: add from-release and summary * ci: automatically update oci/mock-rock/_releases.json, from https://github.com/canonical/oci-factory/actions/runs/11958857638 * fix: boolean conditioning * ci: automatically update oci/mock-rock/_releases.json, from https://github.com/canonical/oci-factory/actions/runs/11973170999 * chore: code cleanup * chore: use issue-title for consistency * ci: automatically update oci/mock-rock/_releases.json, from https://github.com/canonical/oci-factory/actions/runs/11974360191 * fix: include revision in the issue title * TEST: mock the cont. testing workflow with dispatch * fix: ture to be bool * fix: boolean conditioning * fix: issue body formatting * Revert "TEST: mock the cont. testing workflow with dispatch" This reverts commit 721ce40. * chore: apply suggestions from Clay * ci: automatically update oci/mock-rock/_releases.json, from https://github.com/canonical/oci-factory/actions/runs/12012655556 --------- Co-authored-by: zhijie-yang <zhijie-yang@localhost>
- Loading branch information
1 parent
21bfda1
commit 44b7e9c
Showing
5 changed files
with
185 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import pytest | ||
|
||
from src.shared.release_info import * | ||
|
||
|
||
def test_get_revision_to_release_plain(): | ||
all_releases = { | ||
"3.8-20.04": { | ||
"end-of-life": "2025-03-31T00:00:00Z", | ||
"edge": {"target": "43"}, | ||
"stable": {"target": "43"}, | ||
"candidate": {"target": "43"}, | ||
"beta": {"target": "43"}, | ||
} | ||
} | ||
assert get_revision_to_released_tags(all_releases) == { | ||
43: [ | ||
"3.8-20.04_beta", | ||
"3.8-20.04_candidate", | ||
"3.8-20.04_edge", | ||
"3.8-20.04_stable", | ||
] | ||
} | ||
|
||
|
||
def test_get_revision_to_release_circular(): | ||
all_releases = { | ||
"1.19.0-22.04": { | ||
"end-of-life": "2024-11-26T00:00:00Z", | ||
"stable": {"target": "1"}, | ||
"candidate": {"target": "1.19.0-22.04_beta"}, | ||
"beta": {"target": "1.19.0-22.04_candidate"}, | ||
"edge": {"target": "5"}, | ||
} | ||
} | ||
|
||
with pytest.raises(BadChannel, match=r"Tag .* was caught in a circular dependency, following tags that follow themselves. Cannot pin a revision."): | ||
get_revision_to_released_tags(all_releases) | ||
|
||
|
||
def test_get_revision_to_release_alias(): | ||
all_releases = { | ||
"1.19.0-22.04": { | ||
"end-of-life": "2024-11-26T00:00:00Z", | ||
"stable": {"target": "1"}, | ||
"candidate": {"target": "5"}, | ||
"beta": {"target": "1.19.0-22.04_candidate"}, | ||
"edge": {"target": "5"}, | ||
}, | ||
"1-22.04": { | ||
"end-of-life": "2025-05-12T00:00:00Z", | ||
"stable": {"target": "4"}, | ||
"candidate": {"target": "1-22.04_stable"}, | ||
"beta": {"target": "1-22.04_candidate"}, | ||
"edge": {"target": "1-22.04_beta"}, | ||
}, | ||
} | ||
|
||
assert get_revision_to_released_tags(all_releases) == { | ||
1: ["1.19.0-22.04_stable"], | ||
4: ["1-22.04_beta", "1-22.04_candidate", "1-22.04_edge", "1-22.04_stable"], | ||
5: ["1.19.0-22.04_beta", "1.19.0-22.04_candidate", "1.19.0-22.04_edge"], | ||
} |