From 012054a32be6c291b074b0da660c8f41c0c21beb Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Tue, 15 Oct 2024 14:50:39 +0300 Subject: [PATCH 1/4] Do not run regctl in container --- Dockerfile | 5 ++++- entrypoint.sh | 2 -- webhook_server_container/libs/github_api.py | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c514163b..84fa3738 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,10 @@ RUN set -x \ && tar xvf $BIN_DIR/rosa-linux.tar.gz \ && mv rosa $BIN_DIR/rosa \ && chmod +x $BIN_DIR/rosa \ - && rm -rf $BIN_DIR/rosa-linux.tar.gz + && rm -rf $BIN_DIR/rosa-linux.tar.gz \ + && curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl \ + && mv regctl $BIN_DIR/regctl \ + && chmod +x $BIN_DIR/regctl WORKDIR $APP_DIR diff --git a/entrypoint.sh b/entrypoint.sh index f3cc4c41..1701cdc1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,5 @@ #!/bin/bash -rm -rf /run/containers/storage /run/libpod - SERVER_RUN_CMD="uv run uvicorn webhook_server_container.app:FASTAPI_APP --host 0.0.0.0 --port 5000 " UVICORN_WORKERS="${UVICORN_MAX_WORKERS:=10}" diff --git a/webhook_server_container/libs/github_api.py b/webhook_server_container/libs/github_api.py index e6a66dd3..38ed6cb5 100644 --- a/webhook_server_container/libs/github_api.py +++ b/webhook_server_container/libs/github_api.py @@ -818,9 +818,7 @@ def delete_remote_tag_for_merged_or_closed_pr(self) -> None: return pr_tag = repository_full_tag.split(":")[-1] - base_regctl_command = ( - "podman run --rm --net host -v regctl-conf:/home/appuser/.regctl/ ghcr.io/regclient/regctl:latest" - ) + base_regctl_command = "regctl" registry_info = self.container_repository.split("/") registry_url = "" if len(registry_info) < 3 else registry_info[0] From 8f8ba3a3cf33c608ab0d469f3eeaa8354a23b219 Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Tue, 15 Oct 2024 14:55:13 +0300 Subject: [PATCH 2/4] Do not run regctl in container --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84fa3738..cfcbe014 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,7 @@ RUN dnf -y install dnf-plugins-core \ RUN mkdir -p $BIN_DIR \ && mkdir -p $APP_DIR \ && mkdir -p $DATA_DIR \ - && mkdir -p $DATA_DIR/logs \ - && mkdir -p /tmp/containers + && mkdir -p $DATA_DIR/logs COPY entrypoint.sh pyproject.toml uv.lock README.md $APP_DIR/ COPY webhook_server_container $APP_DIR/webhook_server_container/ From b1f0830c49b93bff74a091bdc3e1b5d16ffd5084 Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Tue, 15 Oct 2024 15:07:39 +0300 Subject: [PATCH 3/4] fix /retest all --- webhook_server_container/libs/github_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_server_container/libs/github_api.py b/webhook_server_container/libs/github_api.py index 38ed6cb5..cdfafb52 100644 --- a/webhook_server_container/libs/github_api.py +++ b/webhook_server_container/libs/github_api.py @@ -1872,7 +1872,7 @@ def process_retest_command(self, issue_comment_id: int, command_args: str) -> No return if "all" in command_args: - if len(command_args) > 1: + if len(_target_tests) > 1: msg = "Invalid command. `all` cannot be used with other tests" error_msg = f"{self.log_prefix} {msg}." self.logger.debug(error_msg) From 9996c3c26d70e51e87041a51695fb715aa1eccbb Mon Sep 17 00:00:00 2001 From: Meni Yakove Date: Tue, 15 Oct 2024 15:16:21 +0300 Subject: [PATCH 4/4] we must run in container :) --- Dockerfile | 5 +---- webhook_server_container/libs/github_api.py | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index cfcbe014..95ebf08f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,10 +46,7 @@ RUN set -x \ && tar xvf $BIN_DIR/rosa-linux.tar.gz \ && mv rosa $BIN_DIR/rosa \ && chmod +x $BIN_DIR/rosa \ - && rm -rf $BIN_DIR/rosa-linux.tar.gz \ - && curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl \ - && mv regctl $BIN_DIR/regctl \ - && chmod +x $BIN_DIR/regctl + && rm -rf $BIN_DIR/rosa-linux.tar.gz WORKDIR $APP_DIR diff --git a/webhook_server_container/libs/github_api.py b/webhook_server_container/libs/github_api.py index cdfafb52..d6cb6057 100644 --- a/webhook_server_container/libs/github_api.py +++ b/webhook_server_container/libs/github_api.py @@ -818,9 +818,11 @@ def delete_remote_tag_for_merged_or_closed_pr(self) -> None: return pr_tag = repository_full_tag.split(":")[-1] - base_regctl_command = "regctl" registry_info = self.container_repository.split("/") registry_url = "" if len(registry_info) < 3 else registry_info[0] + base_regctl_command = ( + "podman run --rm --net host -v regctl-conf:/home/appuser/.regctl/ ghcr.io/regclient/regctl:latest" + ) rc, out, err = run_command( command=f"{base_regctl_command} registry login {registry_url} -u {self.container_repository_username} "