From 66af1065d906daacb6cff76019cbc733f9bdcaef Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Thu, 6 Jun 2024 16:35:37 -0400 Subject: [PATCH 1/2] Change foojay update checker to include the architecture Signed-off-by: Daniel Mikusa --- actions/foojay-dependency/main.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/actions/foojay-dependency/main.go b/actions/foojay-dependency/main.go index a3a25a5b..3043ca21 100644 --- a/actions/foojay-dependency/main.go +++ b/actions/foojay-dependency/main.go @@ -34,12 +34,28 @@ var client *http.Client = http.DefaultClient func main() { inputs := actions.NewInputs() - // See list of distro's -> https://api.foojay.io/swagger-ui#/default/getDistributionsV2 + // Needs to be in this list + // (aoj, aoj_openj9, bisheng, corretto, dragonwell, graalvm_ce8, graalvm_ce11, graalvm_ce16, graalvm_ce17, graalvm_ce19, graalvm_ce20, graalvm_community, graalvm, jetbrains, kona, liberica, liberica_native, mandrel, microsoft, ojdk_build, openlogic, oracle, oracle_open_jdk, redhat, sap_machine, semeru, semeru_certified, temurin, trava, zulu, zulu_prime) + // https://api.foojay.io/swagger-ui#/default/getPackagesV3 d, ok := inputs["distro"] if !ok { panic(fmt.Errorf("distro must be specified")) } + arch, ok := inputs["arch"] + if !ok { + arch = "x64" + } + + // Needs to be in this list + // (aarch32, aarch64, amd64, arm, arm32, arm64, mips, ppc, ppc64el, ppc64le, ppc64, riscv64, s390, s390x, sparc, sparcv9, x64, x86-64, x86, i386, i486, i586, i686, x86-32) + // https://api.foojay.io/swagger-ui#/default/getPackagesV3 + if arch == "amd64" { + arch = "x64" + } else if arch == "arm64" { + arch = "aarch64" + } + distros, err := LoadDistros() if err != nil { panic(fmt.Errorf("unable to load distros\n%w", err)) @@ -73,7 +89,7 @@ func main() { panic(fmt.Errorf("version cannot be parsed\n%w", err)) } - versions := LoadPackages(d, t, v) + versions := LoadPackages(d, t, v, arch) latestVersion, err := versions.GetLatestVersion(inputs) if err != nil { @@ -96,18 +112,18 @@ func main() { outputs.Write() } -func LoadPackages(d string, t string, v int) actions.Versions { +func LoadPackages(d string, t string, v int, a string) actions.Versions { uri := fmt.Sprintf( "https://api.foojay.io/disco/v3.0/packages?"+ "distro=%s&"+ - "architecture=x64&"+ + "architecture=%s&"+ "archive_type=tar.gz&"+ "package_type=%s&"+ "operating_system=linux&"+ "lib_c_type=glibc&"+ "javafx_bundled=false&"+ "version=%d..%%3C%d", // 11..<12 - url.PathEscape(d), t, v, v+1) + url.PathEscape(d), a, t, v, v+1) request, err := http.NewRequest("GET", uri, nil) if err != nil { From 901dbd32dee16334bb89d2d2d152e227a7ba6bf2 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Thu, 6 Jun 2024 16:40:15 -0400 Subject: [PATCH 2/2] Bump to Go 1.22 Signed-off-by: Daniel Mikusa --- actions/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/Dockerfile b/actions/Dockerfile index 46a058e3..a1c1c980 100644 --- a/actions/Dockerfile +++ b/actions/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20 as build-stage +FROM golang:1.22 as build-stage WORKDIR /src ENV GO111MODULE=on CGO_ENABLED=0