1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-11-06 09:09:19 +02:00
Files
sap-jenkins-library/pkg/cnbutils/project/v01/project.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
860 B
Go

// Source: https://github.com/buildpacks/pack/blob/main/pkg/project/v01/project.go
package v01
import (
"github.com/BurntSushi/toml"
"github.com/SAP/jenkins-library/pkg/cnbutils/project/types"
"github.com/buildpacks/lifecycle/api"
)
type Descriptor struct {
Project types.Project `toml:"project"`
Build types.Build `toml:"build"`
Metadata map[string]interface{} `toml:"metadata"`
}
func NewDescriptor(projectTomlContents string) (types.Descriptor, error) {
versionedDescriptor := &Descriptor{}
_, err := toml.Decode(projectTomlContents, versionedDescriptor)
if err != nil {
return types.Descriptor{}, err
}
return types.Descriptor{
Project: versionedDescriptor.Project,
Build: versionedDescriptor.Build,
Metadata: versionedDescriptor.Metadata,
SchemaVersion: api.MustParse("0.1"),
}, nil
}