diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-02-28 09:03:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 16:03:30 +0200 |
commit | 533b98d44d9954d35e90b41ba5b5f1110e804ec3 (patch) | |
tree | e320010c41b85addc7f7344227236671f42fb23e | |
parent | 45981cb7347a5fed7ebbabba0fe193d0d9471eff (diff) |
Fix handling of no data in platform EOL checks. (#14617)
Also, re-enable EOL checking for Debian.
-rw-r--r-- | .github/data/distros.yml | 2 | ||||
-rwxr-xr-x | .github/scripts/platform-impending-eol.py | 17 | ||||
-rw-r--r-- | .github/workflows/platform-eol-check.yml | 6 |
3 files changed, 18 insertions, 7 deletions
diff --git a/.github/data/distros.yml b/.github/data/distros.yml index e4061e16c1..72dd6ab79c 100644 --- a/.github/data/distros.yml +++ b/.github/data/distros.yml @@ -92,7 +92,7 @@ include: distro: debian version: "12" base_image: debian:bookworm - eol_check: false + eol_check: true env_prep: | apt-get update jsonc_removal: | diff --git a/.github/scripts/platform-impending-eol.py b/.github/scripts/platform-impending-eol.py index eec9b1abee..8b0e7624b4 100755 --- a/.github/scripts/platform-impending-eol.py +++ b/.github/scripts/platform-impending-eol.py @@ -17,18 +17,25 @@ LEAD_DAYS = datetime.timedelta(days=30) DISTRO = sys.argv[1] RELEASE = sys.argv[2] +EXIT_NOT_IMPENDING = 0 +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) case 404: - sys.exit(f'No data available for { DISTRO } { RELEASE }.') + print(f'No data available for { DISTRO } { RELEASE }.', file=sys.stderr) + sys.exit(EXIT_NO_DATA) case _: - sys.exit( + print( f'Failed to retrieve data for { DISTRO } { RELEASE } ' + - f'(status: { response.status }).' + f'(status: { response.status }).', + file=sys.stderr ) + sys.exit(EXIT_FAILURE) eol = datetime.date.fromisoformat(data['eol']) @@ -36,6 +43,6 @@ offset = abs(eol - NOW) if offset <= LEAD_DAYS: print(data['eol']) - sys.exit(2) + sys.exit(EXIT_IMPENDING) else: - sys.exit(0) + sys.exit(EXIT_NOT_IMPENDING) diff --git a/.github/workflows/platform-eol-check.yml b/.github/workflows/platform-eol-check.yml index 94fe485044..c4f47d8386 100644 --- a/.github/workflows/platform-eol-check.yml +++ b/.github/workflows/platform-eol-check.yml @@ -54,10 +54,14 @@ jobs: d="$(.github/scripts/platform-impending-eol.py ${{ matrix.distro }} ${{ matrix.release }})" case $? in 0) echo "pending=false" >> "${GITHUB_OUTPUT}" ;; - 2) + 1) echo "pending=true" >> "${GITHUB_OUTPUT}" echo "date=${d}" >> "${GITHUB_OUTPUT}" ;; + 2) + echo "pending=false" >> "${GITHUB_OUTPUT}" + echo "::info::No EOL information found for ${{ matrix.distro }} ${{ matrix.release }}" + ;; *) echo "::error::Failed to check EOL date for ${{ matrix.distro }} ${{ matrix.release }}" exit 1 |