Skip to content

Commit 3fcdf6b

Browse files
authored
Fix retry job runtime error (#1075)
* Reproduce issue in CI * Fix crash in retry job * Add missing env vars and run using venv python * Allow secrets in CI and add missing env * Remove .py extension
1 parent a683312 commit 3fcdf6b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ jobs:
4040
run: make install
4141
- name: Run tests
4242
run: bin/test.sh
43+
- name: Run retry
44+
env:
45+
JBI_API_KEY: key # pragma: allowlist secret
46+
JIRA_API_KEY: key # pragma: allowlist secret
47+
JIRA_USERNAME: foo@bar
48+
BUGZILLA_API_KEY: key # pragma: allowlist secret
49+
DL_QUEUE_CONSTANT_RETRY: false
50+
DL_QUEUE_DSN: "file:///tmp/dlqueue"
51+
run: .venv/bin/python -m jbi.retry
4352
review-dependabot-pr:
4453
permissions:
4554
contents: write

jbi/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
APP_DIR = Path(__file__).parents[1]
3333

3434
settings = get_settings()
35-
version_info = get_version(APP_DIR)
35+
version_info: dict[str, str] = get_version(APP_DIR)
3636
VERSION: str = version_info["version"]
3737

3838
logging.config.dictConfig(CONFIG)

jbi/queue.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import traceback
2929
from abc import ABC, abstractmethod
3030
from datetime import datetime
31-
from functools import lru_cache
31+
from functools import cached_property, lru_cache
3232
from json import JSONDecodeError
3333
from pathlib import Path
3434
from typing import AsyncIterator, Optional
@@ -37,7 +37,7 @@
3737
import dockerflow.checks
3838
from pydantic import BaseModel, FileUrl, ValidationError, computed_field
3939

40-
from jbi import app, bugzilla
40+
from jbi import bugzilla
4141
from jbi.environment import get_settings
4242

4343
logger = logging.getLogger(__name__)
@@ -90,9 +90,11 @@ class QueueItem(BaseModel, frozen=True):
9090
rid: Optional[str] = None
9191

9292
@computed_field # type: ignore
93-
@property
93+
@cached_property
9494
def version(self) -> str:
9595
# Prevents circular imports.
96+
from jbi import app
97+
9698
return app.VERSION
9799

98100
@property

0 commit comments

Comments
 (0)