Skip to content

Commit

Permalink
Handle pagination of docker hub tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson committed Feb 2, 2024
1 parent c0769c4 commit 910cf4d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-kr8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
include:
- python-version: '3.10'
kubernetes-version: 1.28.0
- python-version: '3.10'
kubernetes-version: 1.27.3
- python-version: '3.10'
kubernetes-version: 1.26.6
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-kubectl-ng.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
include:
- python-version: '3.10'
kubernetes-version: 1.28.0
- python-version: '3.10'
kubernetes-version: 1.27.3
- python-version: '3.10'
kubernetes-version: 1.26.6
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![EffVer Versioning](https://img.shields.io/badge/version_scheme-EffVer-0097a7)](https://jacobtomlinson.dev/effver)
[![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kr8s)](https://pypi.org/project/kr8s/)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.28%7C1.29-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28%7C1.29-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/)

Expand Down
19 changes: 12 additions & 7 deletions ci/update-kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,22 @@ def get_versions():
data.sort(key=lambda x: x["eol"], reverse=True)

print("Loading Kubernetes tags from https://hub.docker.com/r/kindest/node/tags...")
with urllib.request.urlopen(
"https://hub.docker.com/v2/repositories/kindest/node/tags"
) as url:
container_tags = json.load(url)

container_tags = []
next_url = "https://hub.docker.com/v2/repositories/kindest/node/tags"
while next_url:
with urllib.request.urlopen(next_url) as url:
results = json.load(url)
container_tags += results["results"]
if "next" in results and results["next"]:
next_url = results["next"]
else:
next_url = None

for version in data:
try:
version["latest_kind_container"] = [
x["name"]
for x in container_tags["results"]
if version["cycle"] in x["name"]
x["name"] for x in container_tags if version["cycle"] in x["name"]
][0][1:]
except IndexError:
version["latest_kind_container"] = None
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![EffVer Versioning](https://img.shields.io/badge/version_scheme-EffVer-0097a7)](https://jacobtomlinson.dev/effver)
[![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kr8s)](https://pypi.org/project/kr8s/)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.28%7C1.29-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28%7C1.29-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/)
<iframe src="https://ghbtns.com/github-btn.html?user=kr8s-org&repo=kr8s&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
Expand Down

0 comments on commit 910cf4d

Please sign in to comment.