Skip to content

Commit

Permalink
Merge pull request #1016 from Ximinhan/fix-newslackapi
Browse files Browse the repository at this point in the history
update file_upload_v2 parameters
  • Loading branch information
openshift-merge-bot[bot] authored Oct 8, 2024
2 parents cb5104f + cec67b7 commit c626eb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 6 additions & 7 deletions pyartcd/pyartcd/pipelines/build_microshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,18 +453,17 @@ async def _create_or_update_pull_request(self, nvrs: List[str]):
async def _notify_microshift_alerts(self, version_release: str):
doozer_log_file = Path(self._doozer_env_vars["DOOZER_WORKING_DIR"]) / "debug.log"
slack_client = self.runtime.new_slack_client()
slack_client.channel = "#microshift-alerts"
slack_client.channel = "C0310LGMQQY" # microshift-alerts
message = f":alert: @here ART build failure: microshift-{version_release}."
message += "\nPing @ release-artists if you need help."
slack_response = await slack_client.say(message)
slack_thread = slack_response["message"]["ts"]
if doozer_log_file.exists():
with doozer_log_file.open() as f:
await slack_client.upload_file(
file=f,
filename="microshift-build.log",
initial_comment="Build logs",
thread_ts=slack_thread)
await slack_client.upload_file(
file=doozer_log_file,
filename="microshift-build.log",
initial_comment="Build logs",
thread_ts=slack_thread)
else:
await slack_client.say("Logs are not available.", thread_ts=slack_thread)

Expand Down
11 changes: 5 additions & 6 deletions pyartcd/pyartcd/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,21 @@ async def say(self, message: str, thread_ts: Optional[str] = None, reaction: Opt
async def upload_file(self, file=None, content=None, filename=None, initial_comment=None, thread_ts: Optional[str] = None):
response = await self._client.files_upload_v2(
file=file,
filename=content,
filetype=filename,
content=content,
filename=filename,
initial_comment=initial_comment,
channels=self.channel,
channel=self.channel,
thread_ts=thread_ts)
return response.data

async def upload_content(self, content, intro=None, filename=None, filetype=None, thread_ts: Optional[str] = None):
async def upload_content(self, content, intro=None, filename=None, thread_ts: Optional[str] = None):
"""
Similar to upload_file but can upload from a variable instead of a file
"""
response = await self._client.files_upload_v2(
initial_comment=intro,
channels=self.channel,
channel=self.channel,
content=content,
filename=filename,
filetype=filetype,
thread_ts=thread_ts)
return response.data

0 comments on commit c626eb2

Please sign in to comment.