Skip to content

Always run the post run step, logging conditionally and exiting based on the success/failure of the run step #23169

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

Merged
merged 2 commits into from
Mar 13, 2025
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
10 changes: 6 additions & 4 deletions .github/actions/run-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ runs:
${{ inputs.run }}
EOF

- name: Logs
if: ${{ inputs.logs }}
- name: Post Run (logs and exit code)
if: always()
shell: bash
run: |
docker compose logs
if [[ "${{ inputs.logs }}" == "true" ]]; then
docker compose logs
fi

# If the run command failed, exit with a non-zero exit code
if [ ${{ steps.run.outcome }} != 'success' ]; then
if [ "${{ steps.run.outcome }}" != 'success' ]; then
exit 1
fi
1 change: 0 additions & 1 deletion .github/workflows/_test_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ jobs:
with:
digest: ${{ inputs.digest }}
version: ${{ inputs.version }}
logs: true
run: |
exit 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import hashlib
import re
from collections import defaultdict

from django.conf import settings
from django.core.management.base import BaseCommand
from django.template import loader

import requests
from django_statsd.clients import statsd
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry

from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.template import loader

from olympia.amo.utils import send_mail
from olympia.core.languages import ALL_LANGUAGES

Expand Down Expand Up @@ -133,7 +132,7 @@ def find_locales_below_and_above_threshold(self):

def fetch_data(self):
self.stdout.write(
f'Calling pontoon with {re.sub(r'\s', '', self.PONTOON_QUERY)}'
f'Calling pontoon with {re.sub(r"\s", "", self.PONTOON_QUERY)}'
)
session = requests.Session()
adapter = HTTPAdapter(
Expand Down
4 changes: 2 additions & 2 deletions src/olympia/amo/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ def _test_full_run_empty_response(self):
+ '\n- '.join(
sorted(
[
f"{data['english']} [{locale}]"
f'{data["english"]} [{locale}]'
for locale, data in settings.AMO_LANGUAGES.items()
if locale not in self.expected_special_locales
and locale != settings.LANGUAGE_CODE
Expand All @@ -896,7 +896,7 @@ def _test_full_run_empty_response(self):
+ '\n- '.join(
sorted(
[
f"{settings.AMO_LANGUAGES[locale]['english']} [{locale}]"
f'{settings.AMO_LANGUAGES[locale]["english"]} [{locale}]'
for locale in self.expected_special_locales
]
)
Expand Down
Loading