Skip to content

Commit

Permalink
Merge pull request #503 from paketo-buildpacks/cf-index
Browse files Browse the repository at this point in the history
Fixes edge case where versions have prerelease info
  • Loading branch information
Daniel Mikusa authored Jan 6, 2022
2 parents f074b1c + b4db6de commit 39d5d1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions actions/cf-java-index-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ import (
"fmt"
"net/http"
"os"
"regexp"

"github.com/paketo-buildpacks/pipeline-builder/actions"
"gopkg.in/yaml.v3"
)

var versionPattern = regexp.MustCompile(`(\d+)\.(\d+)\.(\d+)_(.*)`)

func main() {
inputs := actions.NewInputs()

// same repository_root as documented here: https://github.com/cloudfoundry/java-buildpack/blob/main/docs/extending-repositories.md
// same repository_root as documented here: https://github.com/cloudfoundry/java-buildpack/blob/main/docs/extending-repositories.md
repositoryRoot, ok := inputs["repository_root"]
if !ok {
panic(fmt.Errorf("repository_root must be specified"))
Expand All @@ -52,7 +55,7 @@ func main() {

versions := make(actions.Versions)
for k, v := range raw {
versions[k] = v
versions[versionPattern.ReplaceAllString(k, "$1.$2.$3-$4")] = v
}

if o, err := versions.GetLatest(inputs); err != nil {
Expand Down

0 comments on commit 39d5d1d

Please sign in to comment.