You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-09-16 09:26:22 +02:00
publish built go co-ordinates
This commit is contained in:
@@ -265,7 +265,6 @@ func runGolangBuild(config *golangBuildOptions, telemetryData *telemetry.CustomD
|
||||
}
|
||||
|
||||
artifactVersion, err = artifact.GetVersion()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -286,6 +285,17 @@ func runGolangBuild(config *golangBuildOptions, telemetryData *telemetry.CustomD
|
||||
utils.SetOptions(repoClientOptions)
|
||||
|
||||
var binaryArtifacts piperenv.Artifacts
|
||||
options := versioning.Options{}
|
||||
buildCoordinates := []versioning.Coordinates{}
|
||||
builtArtifact, err := versioning.GetArtifact("golang", "", &options, utils)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
coordinate, err := builtArtifact.GetCoordinates()
|
||||
if err != nil {
|
||||
log.Entry().Warnf("unable to get artifact metdata : %v", err)
|
||||
}
|
||||
|
||||
for _, binary := range binaries {
|
||||
|
||||
targetPath := fmt.Sprintf("go/%s/%s/%s", goModFile.Module.Mod.Path, artifactVersion, binary)
|
||||
@@ -312,6 +322,12 @@ func runGolangBuild(config *golangBuildOptions, telemetryData *telemetry.CustomD
|
||||
binaryArtifacts = append(binaryArtifacts, piperenv.Artifact{
|
||||
Name: binary,
|
||||
})
|
||||
|
||||
coordinate.BuildPath = filepath.Dir("go.mod")
|
||||
coordinate.URL = config.TargetRepositoryURL
|
||||
coordinate.PURL = piperutils.GetPurl(filepath.Join(filepath.Dir("go.mod"), sbomFilename))
|
||||
|
||||
buildCoordinates = append(buildCoordinates, coordinate)
|
||||
}
|
||||
commonPipelineEnvironment.custom.artifacts = binaryArtifacts
|
||||
|
||||
|
@@ -54,6 +54,7 @@ type golangBuildOptions struct {
|
||||
type golangBuildCommonPipelineEnvironment struct {
|
||||
custom struct {
|
||||
buildSettingsInfo string
|
||||
goBuildArtifacts string
|
||||
artifacts piperenv.Artifacts
|
||||
}
|
||||
}
|
||||
@@ -65,6 +66,7 @@ func (p *golangBuildCommonPipelineEnvironment) persist(path, resourceName string
|
||||
value interface{}
|
||||
}{
|
||||
{category: "custom", name: "buildSettingsInfo", value: p.custom.buildSettingsInfo},
|
||||
{category: "custom", name: "goBuildArtifacts", value: p.custom.goBuildArtifacts},
|
||||
{category: "custom", name: "artifacts", value: p.custom.artifacts},
|
||||
}
|
||||
|
||||
@@ -591,6 +593,7 @@ func golangBuildMetadata() config.StepData {
|
||||
Type: "piperEnvironment",
|
||||
Parameters: []map[string]interface{}{
|
||||
{"name": "custom/buildSettingsInfo"},
|
||||
{"name": "custom/goBuildArtifacts"},
|
||||
{"name": "custom/artifacts", "type": "piperenv.Artifacts"},
|
||||
},
|
||||
},
|
||||
|
@@ -263,6 +263,7 @@ spec:
|
||||
type: piperEnvironment
|
||||
params:
|
||||
- name: custom/buildSettingsInfo
|
||||
- name: custom/goBuildArtifacts
|
||||
- name: custom/artifacts
|
||||
type: "piperenv.Artifacts"
|
||||
- name: reports
|
||||
|
Reference in New Issue
Block a user