Skip to content

Commit

Permalink
Merge pull request #1052 from camptocamp/dpkg-strict-gsgmf-1860
Browse files Browse the repository at this point in the history
More strict dpkg file found check
  • Loading branch information
sbrunner authored Mar 27, 2023
2 parents d6efc67 + 0902436 commit 25822d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions c2cciutils/lib/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ def get_dpkg_packages_versions(
return True, {f"{prefix}{k}": v for k, v in package_version.items()}


def get_versions_config() -> Dict[str, Dict[str, str]]:
def get_versions_config() -> Tuple[Dict[str, Dict[str, str]], bool]:
"""
Get the versions from the config file.
"""
if os.path.exists("ci/dpkg-versions.yaml"):
with open("ci/dpkg-versions.yaml", "r", encoding="utf-8") as versions_file:
return cast(Dict[str, Dict[str, str]], yaml.load(versions_file.read(), Loader=yaml.SafeLoader))
return {}
return (
cast(Dict[str, Dict[str, str]], yaml.load(versions_file.read(), Loader=yaml.SafeLoader)),
True,
)
return {}, False


def check_versions(
Expand Down
2 changes: 1 addition & 1 deletion c2cciutils/scripts/docker_versions_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main() -> None:
argparser.add_argument("images", help="The image to check", nargs="+")
args = argparser.parse_args()

versions_config = c2cciutils.lib.docker.get_versions_config()
versions_config, _ = c2cciutils.lib.docker.get_versions_config()
for image in args.images:

_, versions_image = c2cciutils.lib.docker.get_dpkg_packages_versions(
Expand Down
6 changes: 3 additions & 3 deletions c2cciutils/scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def main() -> None:
print("::endgroup::")
print("::error::With error")

versions_config = c2cciutils.lib.docker.get_versions_config()
versions_config, dpkg_config_found = c2cciutils.lib.docker.get_versions_config()
dpkg_success = True
for image in images_src and versions_config:
for image in images_src:
dpkg_success &= c2cciutils.lib.docker.check_versions(versions_config.get(image, {}), image)

if not dpkg_success:
Expand All @@ -363,7 +363,7 @@ def main() -> None:
print("Current versions of the Debian packages in Docker images:")
print(yaml.dump(current_versions_in_images, Dumper=yaml.SafeDumper, default_flow_style=False))

if versions_config:
if dpkg_config_found:
success = False

helm_config = cast(
Expand Down

0 comments on commit 25822d3

Please sign in to comment.