Skip to content

Commit

Permalink
codelists check-upstream always returns True in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rebkwok committed Nov 13, 2023
1 parent d9172c9 commit ab302ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
17 changes: 7 additions & 10 deletions opensafely/codelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ def check_upstream(codelists_dir=None):
# date upstream codelists, as users may have valid reasons for not wanting to update
# them (i.e. if they have already run jobs that use the backend database). In this
# case, just print the error message instead of exiting.
if os.environ.get("GITHUB_WORKFLOW"):
print(error_message)
return False
exit_with_prompt(error_message)

print("Codelists OK")
if not os.environ.get("GITHUB_WORKFLOW"):
exit_with_prompt(error_message)
print(error_message)
else:
print("Codelists OK")
return True


Expand Down Expand Up @@ -221,15 +220,13 @@ def check():
)

try:
upstream_check = check_upstream(codelists_dir)
check_upstream(codelists_dir)
except requests.exceptions.ConnectionError:
print(
f"Local codelists OK; could not contact {OPENCODELISTS_BASE_URL} for upstream check,"
"try again later"
)
return True

return upstream_check
return True


def make_temporary_manifest(codelists_dir):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_codelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,5 @@ def test_codelists_check_with_upstream_changes_in_CI(
}
)
os.chdir(codelists_path)
assert codelists.check() is False
# check doesn't fail in CI if there are upstream errors only
assert codelists.check()

0 comments on commit ab302ad

Please sign in to comment.