Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using Azul Metadata API #1168

Merged
merged 2 commits into from
Jun 8, 2023
Merged
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
30 changes: 16 additions & 14 deletions actions/azul-zulu-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ func main() {
panic(fmt.Errorf("version must be specified"))
}

uri := fmt.Sprintf("https://api.azul.com/zulu/download/community/v1.0/bundles/latest/"+
"?arch=x86"+
"&ext=tar.gz"+
"&features=%s"+
"&hw_bitness=64"+
"&jdk_version=%s"+
"&os=linux"+
"&javafx=false",
t, v)
uri := fmt.Sprintf("https://api.azul.com/metadata/v1/zulu/packages/?"+
"os=linux-glibc&"+
"arch=x64&"+
"archive_type=tar.gz&"+
"java_package_type=%s&"+
"javafx_bundled=false&"+
"crac_supported=false&"+
"latest=true&"+
"distro_version=%s&"+
"release_status=ga", t, v)

resp, err := http.Get(uri)
if err != nil {
Expand All @@ -57,13 +58,14 @@ func main() {
panic(fmt.Errorf("unable to download %s: %d", uri, resp.StatusCode))
}

var raw Bundle
var raw []Bundle
if err := json.NewDecoder(resp.Body).Decode(&raw); err != nil {
panic(fmt.Errorf("unable to decode payload\n%w", err))
}

versions := actions.Versions{
fmt.Sprintf("%d.%d.%d", raw.JDKVersion[0], raw.JDKVersion[1], raw.JDKVersion[2]): raw.URL,
versions := actions.Versions{}
for _, bundle := range raw {
versions[fmt.Sprintf("%d.%d.%d", bundle.JDKVersion[0], bundle.JDKVersion[1], bundle.JDKVersion[2])] = bundle.URL
}

latestVersion, err := versions.GetLatestVersion(inputs)
Expand All @@ -88,6 +90,6 @@ func main() {
}

type Bundle struct {
JDKVersion []int `json:"jdk_version"`
URL string `json:"url"`
JDKVersion []int `json:"java_version"`
URL string `json:"download_url"`
}