Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
💚 Migrate to 20.04; spec py3.6 -> py3
Browse files Browse the repository at this point in the history
Based on actions/runner-images#1816,
the Ubuntu 20.04 runner uses Python 3.8; which is sufficient for
f-strings.
  • Loading branch information
jmuchovej committed Feb 21, 2021
1 parent 6b0e232 commit eb68b62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
version-bump:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- id: checkout
name: "Checkout"
Expand Down
16 changes: 9 additions & 7 deletions scripts/version-bump
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3.6
#!/usr/bin/env python3
import os
import json
from typing import Dict, Tuple
Expand All @@ -11,15 +11,16 @@ import requests
from packaging.version import parse


def get_upstream_CoreDNS_version():
def get_upstream_CoreDNS_version(arm: bool):
"""Retrieves the latest CoreDNS release from the CoreDNS GitHub repository. Additionally provides the Package and Release URLs to use in ZeroDNS Docker container and Release Notes.
"""
url = "https://api.github.com/repos/coredns/coredns/releases/latest"
release = json.loads(requests.get(url).content)

CoreDNS = parse(release["tag_name"])

pkg_url = next(filter(lambda x: "linux_amd64" in x["name"], release["assets"]))
lookup = "linux_amd64" if not arm else "linux_arm64"
pkg_url = next(filter(lambda x: lookup in x["name"], release["assets"]))
pkg_url = pkg_url["browser_download_url"]
release_info = release["url"]

Expand Down Expand Up @@ -58,10 +59,10 @@ def ZeroDNS_update(vZeroDNS: str) -> Tuple[Dict, bool]:
return outputs, c_ZeroDNS != ZeroDNS


def CoreDNS_update() -> Tuple[Dict, bool]:
def CoreDNS_update(arm: bool = False) -> Tuple[Dict, bool]:
"""Gathers CoreDNS version info, determines latest version, how it upgraded, and release contents.
"""
u_CoreDNS, pkg_url, release_info = get_upstream_CoreDNS_version()
u_CoreDNS, pkg_url, release_info = get_upstream_CoreDNS_version(arm)
c_CoreDNS, _ = get_current_CoreDNS_version()

CoreDNS = max(c_CoreDNS, u_CoreDNS)
Expand All @@ -84,11 +85,12 @@ if __name__ == "__main__":

parser = ArgumentParser()
parser.add_argument("vZeroDNS", nargs="?", type=str)
parser.add_argument("--arm", action="store_true")
args = parser.parse_args()

outputs = dict()
out_ZeroDNS, diff_ZeroDNS = ZeroDNS_update(args.vZeroDNS or "")
out_CoreDNS, diff_CoreDNS = CoreDNS_update()
out_CoreDNS, diff_CoreDNS = CoreDNS_update(args.arm)

outputs.update(out_ZeroDNS)
outputs.update(out_CoreDNS)
Expand All @@ -109,4 +111,4 @@ if __name__ == "__main__":
del outputs["majorUpgradeCoreDNS"]

for key, value in outputs.items():
print(f"::set-output name={key}::{value}")
print(f"::set-output name={key}::{value}")

0 comments on commit eb68b62

Please sign in to comment.