Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix watch dog #321

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions github_app_geo_project/module/audit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion github_app_geo_project/scripts/process_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down