diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-03-07 16:58:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 16:58:27 -0500 |
commit | e3c205c81389a0c0be4fbcd163abc4a44a3cb072 (patch) | |
tree | f4dea3209e8bd3b968c6c78d4a7c3c8f2456798a /.github | |
parent | 4c23625a8abe7eb3c41902e8c3965d41d1d1fc18 (diff) |
Fix platform EOL checks to properly return success. (#14681)
Diffstat (limited to '.github')
-rwxr-xr-x | .github/scripts/platform-impending-eol.py | 20 | ||||
-rw-r--r-- | .github/workflows/platform-eol-check.yml | 1 |
2 files changed, 16 insertions, 5 deletions
diff --git a/.github/scripts/platform-impending-eol.py b/.github/scripts/platform-impending-eol.py index 8b0e7624b4..c57e5edde7 100755 --- a/.github/scripts/platform-impending-eol.py +++ b/.github/scripts/platform-impending-eol.py @@ -22,17 +22,27 @@ EXIT_IMPENDING = 1 EXIT_NO_DATA = 2 EXIT_FAILURE = 3 -with urllib.request.urlopen(f'{ URL_BASE }/{ DISTRO }/{ RELEASE }.json') as response: - match response.status: - case 200: - data = json.load(response) +try: + with urllib.request.urlopen(f'{ URL_BASE }/{ DISTRO }/{ RELEASE }.json') as response: + match response.status: + case 200: + data = json.load(response) + case _: + print( + f'Failed to retrieve data for { DISTRO } { RELEASE } ' + + f'(status: { response.status }).', + file=sys.stderr + ) + sys.exit(EXIT_FAILURE) +except urllib.error.HTTPError as e: + match e.code: case 404: print(f'No data available for { DISTRO } { RELEASE }.', file=sys.stderr) sys.exit(EXIT_NO_DATA) case _: print( f'Failed to retrieve data for { DISTRO } { RELEASE } ' + - f'(status: { response.status }).', + f'(status: { e.code }).', file=sys.stderr ) sys.exit(EXIT_FAILURE) diff --git a/.github/workflows/platform-eol-check.yml b/.github/workflows/platform-eol-check.yml index c4f47d8386..ed78e42e56 100644 --- a/.github/workflows/platform-eol-check.yml +++ b/.github/workflows/platform-eol-check.yml @@ -50,6 +50,7 @@ jobs: # Actually check the EOL date for the platform. - name: Check EOL Date id: check + shell: sh {0} run: | d="$(.github/scripts/platform-impending-eol.py ${{ matrix.distro }} ${{ matrix.release }})" case $? in |