Skip to content

Commit

Permalink
api: show latest version of all branches
Browse files Browse the repository at this point in the history
Not only show latest stable branches but the latest version for every
branch supported. Clients should figure out on their own if an upgrade
is required.

* Stable releases don't require an upgrade to the same stable release
* Release SNAPSHOTS can be upgraded to release SNAPSHOTS ,RCs or release
* SNAPSHOTS only upgrade to SNAPSHOTS

Signed-off-by: Paul Spooren <mail@aparcar.org>
  • Loading branch information
aparcar committed Apr 26, 2021
1 parent 30a229d commit a73863f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions asu/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ def get_latest() -> dict:
lambda b: b["versions"][0],
filter(
lambda b: b.get("enabled"),
filter(
lambda b: not b.get("snapshot"),
current_app.config["BRANCHES"],
),
current_app.config["BRANCHES"],
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def app(redis):
{
"name": "19.07",
"enabled": True,
"versions": ["19.07.6", "19.07.5"],
"versions": ["19.07.7", "19.07.6"],
"git_branch": "openwrt-19.07",
"path": "releases/{version}",
"path_packages": "releases/packages-{branch}",
Expand Down
4 changes: 3 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def test_api_build(client):

def test_api_latest_default(client):
response = client.get("/api/latest")
assert response.json == {"latest": ["19.07.6"]}
assert "19.07.7" in response.json["latest"]
assert "21.02.0-rc1" in response.json["latest"]
assert "SNAPSHOT" in response.json["latest"]
assert response.status == "200 OK"


Expand Down

0 comments on commit a73863f

Please sign in to comment.