From 41063a4c7806c5b4d9ee8a8d1635e1ea9c78b62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 6 Jun 2024 13:50:22 +0200 Subject: [PATCH 1/2] Fix watch dog --- Dockerfile | 4 ++++ github_app_geo_project/scripts/process_queue.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 341113b143f..02d7c00f4b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -163,5 +163,9 @@ RUN --mount=type=cache,target=/root/.cache \ COPY scripts/* /usr/bin/ +RUN mkdir -p /var/run/ghci \ + && chmod a+rwx /var/run/ghci + + # Set runner as final FROM runner diff --git a/github_app_geo_project/scripts/process_queue.py b/github_app_geo_project/scripts/process_queue.py index a69929c1811..81994756014 100644 --- a/github_app_geo_project/scripts/process_queue.py +++ b/github_app_geo_project/scripts/process_queue.py @@ -802,7 +802,7 @@ async def __call__(self, *args: Any, **kwds: Any) -> Any: async def _watch_dog() -> None: while True: _LOGGER.debug("Watch dog: alive") - with open("/watch_dog", "w", encoding="utf-8") as file_: + with open("/var/run/ghci/watch_dog", "w", encoding="utf-8") as file_: file_.write(datetime.datetime.now().isoformat()) for id_, job in _RUNNING_JOBS.items(): file_.write( From 7e4da0e795981a9ef206977db284b8ae8f6348f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 6 Jun 2024 14:06:09 +0200 Subject: [PATCH 2/2] Audit: Add debug messages --- github_app_geo_project/module/audit/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/github_app_geo_project/module/audit/__init__.py b/github_app_geo_project/module/audit/__init__.py index aa8781c1d84..78b547cd7e6 100644 --- a/github_app_geo_project/module/audit/__init__.py +++ b/github_app_geo_project/module/audit/__init__.py @@ -164,19 +164,20 @@ async def _process_snyk_dpkg( if "branch_to_version_re" in ci_config.get("version", {}): branch_to_version_re = c2cciutils.compile_re(ci_config["version"]["branch-to-version-re"]) - repo = context.github_project.github.get_repo( - f"{context.github_project.owner}/{context.github_project.repository}" - ) + repo = context.github_project.repo + _LOGGER.debug("Find the branch name") for github_branch in repo.get_branches(): matched, conf, value = c2cciutils.match(github_branch.name, branch_to_version_re) version = c2cciutils.substitute(matched, conf, value) if version == branch: branch = github_branch.name break + _LOGGER.debug("Branch name: %s", branch) # Checkout the right branch on a temporary directory with tempfile.TemporaryDirectory() as tmpdirname: os.chdir(tmpdirname) + _LOGGER.debug("Clone the repository in the temporary directory: %s", tmpdirname) success &= module_utils.git_clone(context.github_project, branch) local_config: configuration.AuditConfiguration = {}