mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-05 15:15:44 +02:00
* update lib version and fix code * remove outdated replace statement * update helm.sh/helm/v3 --------- Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
31 lines
519 B
Go
31 lines
519 B
Go
package cnbutils
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/BurntSushi/toml"
|
|
"github.com/buildpacks/lifecycle/platform/files"
|
|
)
|
|
|
|
const reportFile = "/layers/report.toml"
|
|
|
|
func DigestFromReport(utils BuildUtils) (string, error) {
|
|
report := files.Report{}
|
|
|
|
data, err := utils.FileRead(reportFile)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
err = toml.Unmarshal(data, &report)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
if report.Image.Digest == "" {
|
|
return "", fmt.Errorf("image digest is empty")
|
|
}
|
|
|
|
return report.Image.Digest, nil
|
|
}
|