Skip to content

Commit

Permalink
Merge pull request #563 from paketo-buildpacks/bellsoft-action-purl-fix
Browse files Browse the repository at this point in the history
Updated bellsoft action to set purl to NIK version
  • Loading branch information
Daniel Mikusa authored Feb 17, 2022
2 parents cefa856 + 10b9a82 commit fd4c553
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion actions/bellsoft-liberica-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"net/http"
"os"
"regexp"

"github.com/paketo-buildpacks/pipeline-builder/actions"
)
Expand Down Expand Up @@ -81,6 +82,7 @@ func main() {
}

versions := make(actions.Versions)
additionalOutputs := make(actions.Outputs)

for _, r := range raw {
key := fmt.Sprintf("%d.%d.%d-%d", r.FeatureVersion, r.InterimVersion, r.UpdateVersion, r.BuildVersion)
Expand All @@ -91,6 +93,14 @@ func main() {
s = fmt.Sprintf("%s-%s", s, v[4])
}
key = s

// Use NIK version for CPE/PURL
re := regexp.MustCompile(`\/vm/([\d]+\.[\d]+\.[\d]+\.?[\d]?)\/`)
matches := re.FindStringSubmatch(r.DownloadURL)
if matches == nil || len(matches) != 2 {
panic(fmt.Errorf("unable to parse NIK version: %s", matches))
}
additionalOutputs["purl"] = matches[1]
}
}
versions[key] = r.DownloadURL
Expand All @@ -101,7 +111,7 @@ func main() {
panic(fmt.Errorf("unable to get latest version\n%w", err))
}

outputs, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, nil)
outputs, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, additionalOutputs)
if err != nil {
panic(fmt.Errorf("unable to create outputs\n%w", err))
}
Expand Down

0 comments on commit fd4c553

Please sign in to comment.