-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOAPPX-227-remove-abort-controller
- Loading branch information
Showing
241 changed files
with
4,228 additions
and
15,645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Actions to notify E2E tests failure through Slack message | ||
description: 'This action collects the steps to setup python env and run job' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: setup python | ||
uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b #v4.6.0 | ||
with: | ||
python-version: '3.8' | ||
- name: install pipenv | ||
run: pip install pipenv | ||
shell: bash | ||
- name: report E2E tests failure | ||
run: | | ||
cd scripts/e2e_message | ||
pipenv install | ||
pipenv run python3 e2e_notifier.py | ||
env: | ||
BUILD_ID: ${{ github.run_id }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
urllib3 = ">=1.26.6" | ||
requests = "*" | ||
slackclient = "*" | ||
urlextract = "*" | ||
|
||
[requires] | ||
python_version = "3.8" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
import ssl | ||
from os.path import join | ||
|
||
import certifi | ||
import urllib3 | ||
from slack import WebClient | ||
from slack.errors import SlackApiError | ||
|
||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
|
||
SLACK_TOKEN = os.environ.get("IO_APP_SLACK_HELPER_BOT_TOKEN", None) | ||
tagged_people = ["<!here>"] | ||
SLACK_CHANNEL = "#io_dev_app_feed" | ||
BUILD_ID = os.environ.get("BUILD_ID", None) | ||
BASE_ACTION_URI = "https://github.com/pagopa/io-app/actions/runs/" | ||
|
||
def send_slack_message(): | ||
""" | ||
Sends the report of the check to slack to notify the status of the E2E tests of the app | ||
:return: | ||
""" | ||
try: | ||
# avoid ssl certificate warning | ||
ssl_context = ssl.create_default_context(cafile=certifi.where()) | ||
rtm_client = WebClient( | ||
token=SLACK_TOKEN, ssl=ssl_context | ||
) | ||
tags = " ".join(tagged_people) | ||
message = "[E2E Tests] :warning: %s e2e tests have failed (<%s%s|here>)" % ( | ||
tags, BASE_ACTION_URI, BUILD_ID) | ||
message_blocks = [] | ||
message_blocks.append({ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": message | ||
} | ||
}) | ||
rtm_client.chat_postMessage( | ||
channel=SLACK_CHANNEL, | ||
blocks=message_blocks | ||
) | ||
|
||
|
||
except SlackApiError as e: | ||
# You will get a SlackApiError if "ok" is False | ||
assert e.response["ok"] is False | ||
# str like 'invalid_auth', 'channel_not_found' | ||
assert e.response["error"] | ||
print(f"Got an error: {e.response['error']}") | ||
|
||
if SLACK_TOKEN: | ||
send_slack_message() | ||
else: | ||
print("no SLACK token provided") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.