Skip to content
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: Jinja CI
on:
pull_request:
paths:
- adoptium_api.py
- dockerhub_doc_config_update.py
- generate_dockerfiles.py
- test_dockerhub_doc_config_update.py
- test_generate_dockerfiles.py
- requirements.txt
branches: [ main ]
Expand All @@ -24,4 +27,6 @@ jobs:
run: "pip3 install -r requirements.txt"

- name: Run tests
run: "python3 test_generate_dockerfiles.py"
run: |
python3 -m unittest test_generate_dockerfiles -v
python3 -m unittest test_dockerhub_doc_config_update -v
3 changes: 2 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ jobs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: pip install pyyaml
- uses: docker-library/bashbrew@a519e31d2ed9cb229ff38ab4488e78bfa09d7a2a # v0.1.14
- id: generate-jobs
name: Generate Jobs
run: |
export GENERATE_STACKBREW_LIBRARY='./dockerhub_doc_config_update.sh /dev/stdout'
export GENERATE_STACKBREW_LIBRARY='python3 dockerhub_doc_config_update.py /dev/stdout'
export GITHUB_REPOSITORY="eclipse-temurin"
strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")"
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Once you've merged the PR, you can update the official Docker Hub manifest. This
git fetch --all
# Checkout the main branch
git checkout main
./dockerhub_doc_config_update.sh
python3 dockerhub_doc_config_update.py
```

This script will create a file called _eclipse-temurin_ by default.
Expand Down
57 changes: 57 additions & 0 deletions adoptium_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import json
import urllib.request

ADOPTIUM_API_URL = "https://api.adoptium.net/v3/info/available_releases"


def _fetch_release_data():
"""Fetch release info from the Adoptium API."""
req = urllib.request.Request(
ADOPTIUM_API_URL,
headers={"User-Agent": "Adoptium Dockerfile Updater"},
)
with urllib.request.urlopen(req) as response:
return json.loads(response.read().decode("utf-8"))


def get_supported_versions():
"""Fetch supported versions from the Adoptium API.

Returns all LTS versions plus any non-LTS versions between the most
recent LTS and the most recent feature release (inclusive).

For example, if LTS versions are [8, 11, 17, 21, 25] and the most
recent feature release is 26, this returns [8, 11, 17, 21, 25, 26].
"""
data = _fetch_release_data()

lts_versions = set(data["available_lts_releases"])
most_recent_lts = data["most_recent_lts"]
most_recent_feature = data["most_recent_feature_release"]

# All LTS versions + anything between latest LTS and most recent feature release
versions = set(lts_versions)
for v in range(most_recent_lts + 1, most_recent_feature + 1):
if v in data["available_releases"]:
versions.add(v)

return sorted(versions)


def get_latest_lts():
"""Return the most recent LTS version number."""
data = _fetch_release_data()
return data["most_recent_lts"]
3 changes: 0 additions & 3 deletions config/temurin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# limitations under the License.
#

supported_distributions:
Versions: [8, 11, 17, 21, 25, 26]

configurations:
linux:
# EOL April 2029
Expand Down
Loading
Loading