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

update file_upload_v2 parameters #1016

Merged
merged 1 commit into from
Oct 8, 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
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