1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/pkg/cnbutils/report.go
Pavel Busko 610e212306
feat(cnbBuild) Add support for pre and post-buildpacks (#4448)
* Add pre and post buildpacks

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Pavel Busko <pavel.busko@sap.com>

* fix integration tests

Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>

* simplify if clauses

Co-authored-by: Pavel Busko <pavel.busko@sap.com>

---------

Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
2023-07-06 11:34:05 +02:00

31 lines
522 B
Go

package cnbutils
import (
"fmt"
"github.com/BurntSushi/toml"
"github.com/buildpacks/lifecycle/platform"
)
const reportFile = "/layers/report.toml"
func DigestFromReport(utils BuildUtils) (string, error) {
report := platform.ExportReport{}
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
}