style fixes

This commit is contained in:
Max Kainov 2024-07-19 09:35:43 +00:00 committed by Max K
parent 952ab302ce
commit 5d09f205e5
5 changed files with 27 additions and 26 deletions

View File

@ -21,8 +21,6 @@ on: # yamllint disable-line rule:truthy
jobs:
AutoRelease:
env:
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run != '' && github.event.inputs.dry_run || true }}
runs-on: [self-hosted, release-maker]
steps:
- name: DebugInfo
@ -34,6 +32,12 @@ jobs:
${{secrets.ROBOT_CLICKHOUSE_SSH_KEY}}
RCSK
EOF
- name: Set DRY_RUN for schedule
if: ${{ github.event_name == 'schedule' }}
run: echo "DRY_RUN=true" >> "$GITHUB_ENV"
- name: Set DRY_RUN for dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "DRY_RUN=${{ github.event.inputs.dry-run }}" >> "$GITHUB_ENV"
- name: Check out repository code
uses: ClickHouse/checkout@v1
with:

View File

@ -2,8 +2,7 @@ name: CreateRelease
concurrency:
group: release
on:
'on':
workflow_dispatch:
inputs:
ref:
@ -30,10 +29,8 @@ jobs:
runs-on: [self-hosted, release-maker]
steps:
- name: DebugInfo
if: ${{ ! inputs.autorelease }}
uses: hmarr/debug-action@f7318c783045ac39ed9bb497e22ce835fdafbfe6
- name: Check out repository code
if: ${{ ! inputs.autorelease }}
uses: ClickHouse/checkout@v1
with:
token: ${{secrets.ROBOT_CLICKHOUSE_COMMIT_TOKEN}}

View File

@ -55,7 +55,7 @@ class ReleaseParams:
class AutoReleaseInfo:
releases: List[ReleaseParams]
def add_release(self, release_params: ReleaseParams):
def add_release(self, release_params: ReleaseParams) -> None:
self.releases.append(release_params)
def dump(self):
@ -133,15 +133,16 @@ def _prepare(token):
commit_sha = commit
if commit_ci_status == SUCCESS:
break
else:
print(f"CI status [{commit_ci_status}] - skip")
print(f"CI status [{commit_ci_status}] - skip")
commits_to_branch_head += 1
ready = commit_ci_status == SUCCESS and commit_sha
if ready:
ready = False
if commit_ci_status == SUCCESS and commit_sha:
print(
f"Add release ready info for commit [{commit_sha}] and release branch [{pr.head.ref}]"
)
ready = True
else:
print(f"WARNING: No ready commits found for release branch [{pr.head.ref}]")

View File

@ -62,7 +62,7 @@ class CIBuddy:
print(f"ERROR: Failed to post message, ex {e}")
def _post_formatted(
self, title, body: Union[Dict, str], with_wf_link: bool
self, title: str, body: Union[Dict, str], with_wf_link: bool
) -> None:
message = title
if isinstance(body, dict):
@ -80,36 +80,36 @@ class CIBuddy:
self.post(message)
def post_info(
self, title, body: Union[Dict, str], with_wf_link: bool = True
self, title: str, body: Union[Dict, str], with_wf_link: bool = True
) -> None:
title_extended = f":white_circle: *{title}*\n\n"
self._post_formatted(title_extended, body, with_wf_link)
def post_done(
self, title, body: Union[Dict, str], with_wf_link: bool = True
self, title: str, body: Union[Dict, str], with_wf_link: bool = True
) -> None:
title_extended = f":white_check_mark: *{title}*\n\n"
self._post_formatted(title_extended, body, with_wf_link)
def post_warning(
self, title, body: Union[Dict, str], with_wf_link: bool = True
self, title: str, body: Union[Dict, str], with_wf_link: bool = True
) -> None:
title_extended = f":warning: *{title}*\n\n"
self._post_formatted(title_extended, body, with_wf_link)
def post_critical(
self, title, body: Union[Dict, str], with_wf_link: bool = True
self, title: str, body: Union[Dict, str], with_wf_link: bool = True
) -> None:
title_extended = f":black_circle: *{title}*\n\n"
self._post_formatted(title_extended, body, with_wf_link)
def post_job_error(
self,
error_description,
job_name="",
with_instance_info=True,
error_description: str,
job_name: str = "",
with_instance_info: bool = True,
with_wf_link: bool = True,
):
) -> None:
instance_id, instance_type = "unknown", "unknown"
if with_instance_info:
instance_id = Shell.run("ec2metadata --instance-id") or instance_id

View File

@ -90,7 +90,7 @@ class GHActions:
@staticmethod
def get_commit_status_by_name(
token: str, commit_sha: str, status_name: Union[str, Sequence]
) -> Optional[str]:
) -> str:
assert len(token) == 40
assert len(commit_sha) == 40
assert is_hex(commit_sha)
@ -109,8 +109,8 @@ class GHActions:
statuses = response.json()
for status in statuses:
if status["context"] in status_name:
return status["state"]
return None
return status["state"] # type: ignore
return ""
@staticmethod
def check_wf_completed(token: str, commit_sha: str) -> bool:
@ -135,10 +135,9 @@ class GHActions:
f" Check workflow status: Check not completed [{check['name']}]"
)
return False
else:
return True
return True
except Exception as e:
print(f"ERROR: exception {e}")
print(f"ERROR: exception after attempt [{i}]: {e}")
time.sleep(1)
return False