Skip to content

Commit

Permalink
Merge pull request #406 from camptocamp/fix
Browse files Browse the repository at this point in the history
Versions: Fix version for Docker
  • Loading branch information
sbrunner authored Jun 28, 2024
2 parents 6f23dc9 + 1d2c456 commit abded13
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
12 changes: 8 additions & 4 deletions github_app_geo_project/module/versions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,14 @@ def _build_internal_dependencies(
continue
dependency_package_data = dependency_data.by_package[full_dependency_name]
dependency_minor = _canonical_minor_version(datasource_name, dependency_version)
support = dependency_package_data.status_by_version.get(
dependency_minor,
"Unsupported",
)
if datasource_name == "docker":
assert len(dependency_package_data.status_by_version) == 1
support = list(dependency_package_data.status_by_version.values())[0]
else:
support = dependency_package_data.status_by_version.get(
dependency_minor,
"Unsupported",
)
clean_dependency_version = _clean_version(dependency_version)
dependencies_branch.forward.append(
_Dependency(
Expand Down
60 changes: 60 additions & 0 deletions tests/test_module_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,66 @@ def test_get_transversal_dashboard_repo_forward_docker() -> None:
)


def test_get_transversal_dashboard_repo_forward_docker_2() -> None:
versions = Versions()
context = Mock()
context.status = _TransversalStatus(
repositories={
"camptocamp/test": _TransversalStatusRepo(
versions={
"1.0": _TransversalStatusVersion(
support="27/06/2027",
dependencies_by_datasource={
"docker": _TransversalStatusNameInDatasource(
versions_by_names={
"ghcr.io/osgeo/gdal": _TransversalStatusVersions(
versions=["ubuntu-small-3.8.5"]
),
}
)
},
)
},
),
"camptocamp/other": _TransversalStatusRepo(
versions={
"2.0": _TransversalStatusVersion(
support="Best effort",
names_by_datasource={
"docker": _TransversalStatusNameByDatasource(
names=[
"osgeo/gdal:ubuntu-small-3.8.5",
"ghcr.io/osgeo/gdal:ubuntu-small-3.8.5",
]
)
},
)
},
),
}
)
context.params = {"repository": "camptocamp/test"}
output = versions.get_transversal_dashboard(context)
assert output.data["dependencies_branches"] == _DependenciesBranches(
by_branch={
"1.0": _Dependencies(
support="27/06/2027",
forward=[
_Dependency(
name="ghcr.io/osgeo/gdal",
datasource="docker",
version="ubuntu-small-3.8.5",
support="Best effort",
color="--bs-danger",
repo="camptocamp/other",
)
],
reverse=[],
)
}
)


def test_get_transversal_dashboard_repo_forward_docker_double() -> None:
versions = Versions()
context = Mock()
Expand Down

0 comments on commit abded13

Please sign in to comment.