From 04ee87d124dd114b5e20b7c975cab92a583fe8ab Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Tue, 10 Nov 2020 08:25:38 -0800 Subject: [PATCH] Reproducible Security Providers Previously the list of security providers that was passed as an environment variable to launch time was non-deterministic. It was the result of map and would make layers non-reproducible in some cases. This change guarantees the order of the environment variable contents. Signed-off-by: Ben Hale --- jre.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jre.go b/jre.go index ae20218..b826d64 100644 --- a/jre.go +++ b/jre.go @@ -20,6 +20,7 @@ import ( "fmt" "os" "path/filepath" + "sort" "strings" "github.com/buildpacks/libcnb" @@ -133,6 +134,7 @@ func (j JRE) Contribute(layer libcnb.Layer) (libcnb.Layer, error) { for k, v := range p.Map() { providers = append(providers, fmt.Sprintf("%s|%s", k, v)) } + sort.Strings(providers) layer.LaunchEnvironment.Default("BPI_JVM_SECURITY_PROVIDERS", strings.Join(providers, " ")) layer.LaunchEnvironment.Default("JAVA_HOME", layer.Path)