diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index fdc808be..e397101e 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -30,6 +30,8 @@ actions: target: ghcr.io/paketo-buildpacks/actions/ca-apm-dependency - source: cf-java-index-dependency target: ghcr.io/paketo-buildpacks/actions/cf-java-index-dependency +- source: clojure-tools-dependency + target: ghcr.io/paketo-buildpacks/actions/clojure-tools-dependency - source: foojay-dependency target: ghcr.io/paketo-buildpacks/actions/foojay-dependency - source: gcs-dependency diff --git a/README.md b/README.md index fecab71d..47701dbf 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,22 @@ The Pipeline Builder is a collection of tools related to GitHub Actions and othe - [`actions`](#actions) - [Actions](#actions-1) - [Adoptium Dependency](#adoptium-dependency) + - [Alibaba Dragonwell Dependency](#alibaba-dragonwell-dependency) - [Amazon Corretto Dependency](#amazon-corretto-dependency) - [AppDynamics Dependency](#appdynamics-dependency) - [Aqua Security Dependency](#aqua-security-dependency) - [Azul Zulu Dependency](#azul-zulu-dependency) - [Bellsoft Liberica Dependency](#bellsoft-liberica-dependency) - [CA APM Dependency](#ca-apm-dependency) + - [CF Java Index Dependency](#cf-java-index-dependency) + - [Clojure Tools Dependency](#clojure-tools-dependency) + - [Foojay Dependency](#foojay-dependency) - [GCS Dependency](#gcs-dependency) - [GitHub Release Dependency](#github-release-dependency) - [Google Stackdriver Profiler Dependency](#google-stackdriver-profiler-dependency) - [GraalVM Dependency](#graalvm-dependency) - [Gradle Dependency](#gradle-dependency) + - [IBM Semeru Dependency](#ibm-semeru-dependency) - [JProfiler Dependency](#jprofiler-dependency) - [JRebel Dependency](#jrebel-dependency) - [Leiningen Dependency](#leiningen-dependency) @@ -41,7 +46,9 @@ The Pipeline Builder is a collection of tools related to GitHub Actions and othe - [New Relic Dependency](#new-relic-dependency) - [NPM Dependency](#npm-dependency) - [OverOps Dependency](#overops-dependency) + - [Paketo Deps Dependency](#paketo-deps-dependency) - [Riverbed Dependency](#riverbed-dependency) + - [Rustup Init Dependency](#rustup-init-dependency) - [Skywalking Dependency](#skywalking-dependency) - [Spring Generations](#spring-generations) - [Tomcat Dependency](#tomcat-dependency) @@ -251,6 +258,17 @@ with: version: "[11,12)" ``` +### Alibaba Dragonwell Dependency +The Alibaba Dependency watches [Alibaba repositories](https://github.com/alibaba/) for new versions. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/alibaba-dragonwell-dependency:main +with: + glob: Alibaba_Dragonwell_[\d\.]+_x64_linux.tar.gz$ + repository: dragonwell + token: ${{ secrets.JAVA_GITHUB_TOKEN }} +``` + ### Amazon Corretto Dependency The Amazon Corretto Dependency watches [Amazon Corretto repositories](https://github.com/corretto/) for new versions. @@ -309,6 +327,35 @@ with: type: java ``` +### CF Java Index Dependency +The CF Java Index Dependency querys a CloudFoundry Java buildpack v2 `index.yml` file for new versions. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/cf-java-index-dependency:main +with: + repository_root: +``` + +### Clojure Tools Dependency +The Clojure Tools Dependency watches [Clojure Tools repositories](https://github.com/clojure/clojure-tools) for new versions. It then filters based on the [stable.properties](https://raw.githubusercontent.com/clojure/brew-install/%s/stable.properties) file in their brew tap repo, allowing it to pick the most recent stable version. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/alibaba-dragonwell-dependency:main +with: + token: ${{ secrets.JAVA_GITHUB_TOKEN }} +``` + +### Foojay Dependency +The Foojay Dependency queries the [Foojay API](https://api.foojay.io/swagger-ui#/) for new versions. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/foojay-dependency:main +with: + distro: microsoft + type: jdk + version: "11" +``` + ### GCS Dependency The GCS Dependency watches [GCS Buckets](https://cloud.google.com/storage) for new versions. The first capture in `glob` is used as the version. @@ -357,6 +404,19 @@ The Gradle Dependency queries the [Gradle API](https://raw.githubusercontent.com uses: docker://ghcr.io/paketo-buildpacks/actions/gradle-dependency:main ``` +### IBM Semeru Dependency +The IBM Semeru Dependency queries the [Gradle API](https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json) for new versions. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/ibm-semeru-dependency:main +with: + glob: ibm-semeru-open-jdk_x64_linux_.+_openj9-.+.tar.gz + owner: ibmruntimes + repository: semeru8-binaries + tag_filter: jdk(.*8.*) + token: ${{ secrets.JAVA_GITHUB_TOKEN }} +``` + ### JProfiler Dependency The JProfiler Dependency watches the [JProfiler Changelog](https://www.ej-technologies.com/download/jprofiler/changelog.html) for new versions. @@ -418,6 +478,15 @@ The OverOps Dependency watches the [OverOps Download Page](https://app.overops.c uses: docker://ghcr.io/paketo-buildpacks/actions/overops-dependency:main ``` +### Paketo Deps Dependency +The Paketo Deps Dependency queries the [Paketo Deps Server](https://api.deps.paketo.io/v1/dependency?name) for new versions. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/paketo-deps-dependency:main +with: + name: rust +``` + ### Riverbed Dependency The Riverbed Dependency watches the [Riverbed Bucket](http://s3.amazonaws.com/appint-pcf-instrumentation-rpm-master) for new versions. @@ -425,6 +494,16 @@ The Riverbed Dependency watches the [Riverbed Bucket](http://s3.amazonaws.com/ap uses: docker://ghcr.io/paketo-buildpacks/actions/riverbed-dependency:main ``` +### Rustup Init Dependency +The Rustup Init Dependency queries the [Rustup Github Project](https://github.com/rust-lang/rustup) for new versions. The `target` specifies the target triple to download. + +```yaml +uses: docker://ghcr.io/paketo-buildpacks/actions/rustup-init-dependency:main +with: + target: x86_64-unknown-linux-musl + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} +``` + ### Skywalking Dependency The Skywalking Dependency watches the [Apache Skywalking Download Page](https://archive.apache.org/dist/skywalking) for new versions. diff --git a/actions/clojure-tools-dependency/main.go b/actions/clojure-tools-dependency/main.go new file mode 100644 index 00000000..9e9ffd5f --- /dev/null +++ b/actions/clojure-tools-dependency/main.go @@ -0,0 +1,111 @@ +/* + * Copyright 2018-2020 the original author or authors. + * + * 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. + */ + +package main + +import ( + "context" + "fmt" + "io" + "log" + "net/http" + "os" + "strings" + + "github.com/google/go-github/v32/github" + "github.com/paketo-buildpacks/pipeline-builder/actions" + "golang.org/x/oauth2" +) + +const ( + ORG = "clojure" + REPO = "brew-install" +) + +func main() { + inputs := actions.NewInputs() + + var c *http.Client + if s, ok := inputs["token"]; ok { + c = oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(&oauth2.Token{AccessToken: s})) + } + gh := github.NewClient(c) + + versions := make(actions.Versions) + + // fetch all the versions from tags + opt := &github.ListOptions{PerPage: 100} + for { + tags, rsp, err := gh.Repositories.ListTags(context.Background(), ORG, REPO, opt) + if err != nil { + panic(fmt.Errorf("unable to list existing tags for %s/%s\n%w", ORG, REPO, err)) + } + + for _, t := range tags { + normalVersion, err := actions.NormalizeVersion(*t.Name) + if err != nil { + panic(err) + } + + versions[normalVersion] = fmt.Sprintf("https://download.clojure.org/install/linux-install-%s.sh", *t.Name) + } + + if rsp.NextPage == 0 { + break + } + opt.Page = rsp.NextPage + } + + // pick the most recent, this gives us the most recent major.minor.patch + if o, err := versions.GetLatest(inputs); err != nil { + panic(err) + } else { + version := o["version"] + + uri := fmt.Sprintf("https://raw.githubusercontent.com/clojure/brew-install/%s/stable.properties", + version) + + resp, err := http.Get(uri) + if err != nil { + panic(fmt.Errorf("unable to get %s\n%w", uri, err)) + } + defer resp.Body.Close() + + if resp.StatusCode != 200 { + panic(fmt.Errorf("unable to download %s: %d", uri, resp.StatusCode)) + } + + b, err := io.ReadAll(resp.Body) + if err != nil { + log.Fatalln(err) + } + + origVersion := strings.Split(string(b), " ")[0] + normalVersion, err := actions.NormalizeVersion(origVersion) + if err != nil { + panic(err) + } + + versions := make(actions.Versions) + versions[normalVersion] = fmt.Sprintf("https://download.clojure.org/install/linux-install-%s.sh", origVersion) + } + + if o, err := versions.GetLatest(inputs); err != nil { + panic(err) + } else { + o.Write(os.Stdout) + } +}