You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
Provide addonDescriptor to build System (#4914)
This commit is contained in:
@@ -26,34 +26,34 @@ import (
|
||||
// AddonDescriptor contains fields about the addonProduct
|
||||
type AddonDescriptor struct {
|
||||
AddonProduct string `json:"addonProduct"`
|
||||
AddonVersionYAML string `json:"addonVersion"`
|
||||
AddonVersionYAML string `json:"addonVersion,omitempty"`
|
||||
AddonVersion string `json:"addonVersionAAK"`
|
||||
AddonSpsLevel string
|
||||
AddonPatchLevel string
|
||||
TargetVectorID string
|
||||
TargetVectorID string `json:",omitempty"`
|
||||
Repositories []Repository `json:"repositories"`
|
||||
}
|
||||
|
||||
// Repository contains fields for the repository/component version
|
||||
type Repository struct {
|
||||
Name string `json:"name"`
|
||||
UseClassicCTS bool `json:"useClassicCTS"`
|
||||
Tag string `json:"tag"`
|
||||
Branch string `json:"branch"`
|
||||
CommitID string `json:"commitID"`
|
||||
VersionYAML string `json:"version"`
|
||||
UseClassicCTS bool `json:"useClassicCTS,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Branch string `json:"branch,omitempty"`
|
||||
CommitID string `json:"commitID,omitempty"`
|
||||
VersionYAML string `json:"version,omitempty"`
|
||||
Version string `json:"versionAAK"`
|
||||
AdditionalPiecelist string `json:"additionalPiecelist"`
|
||||
PackageName string
|
||||
PackageType string
|
||||
AdditionalPiecelist string `json:"additionalPiecelist,omitempty"`
|
||||
PackageName string `json:",omitempty"`
|
||||
PackageType string `json:",omitempty"`
|
||||
SpLevel string
|
||||
PatchLevel string
|
||||
PredecessorCommitID string
|
||||
Status string
|
||||
Namespace string
|
||||
SarXMLFilePath string
|
||||
Languages []string `json:"languages"`
|
||||
InBuildScope bool
|
||||
PredecessorCommitID string `json:",omitempty"`
|
||||
Status string `json:",omitempty"`
|
||||
Namespace string `json:",omitempty"`
|
||||
SarXMLFilePath string `json:",omitempty"`
|
||||
Languages []string `json:"languages,omitempty"`
|
||||
InBuildScope bool `json:",omitempty"`
|
||||
}
|
||||
|
||||
// ReadAddonDescriptorType is the type for ReadAddonDescriptor for mocking
|
||||
@@ -182,3 +182,22 @@ func (me *AddonDescriptor) GetRepositoriesInBuildScope() []Repository {
|
||||
}
|
||||
return RepositoriesInBuildScope
|
||||
}
|
||||
|
||||
func (me *AddonDescriptor) AsReducedJson() string {
|
||||
input := AddonDescriptor{
|
||||
AddonProduct: me.AddonProduct,
|
||||
AddonVersion: me.AddonVersion,
|
||||
AddonSpsLevel: me.AddonSpsLevel,
|
||||
AddonPatchLevel: me.AddonPatchLevel,
|
||||
}
|
||||
for _, repo := range me.Repositories {
|
||||
input.Repositories = append(input.Repositories, Repository{
|
||||
Name: repo.Name,
|
||||
Version: repo.Version,
|
||||
SpLevel: repo.SpLevel,
|
||||
PatchLevel: repo.PatchLevel,
|
||||
})
|
||||
}
|
||||
|
||||
return input.AsJSONstring()
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ func TestAddonDescriptorNew(t *testing.T) {
|
||||
assert.Equal(t, "/DMO/REPO_B", repos[0].Name)
|
||||
})
|
||||
|
||||
t.Run("AsReducedJson", func(t *testing.T) {
|
||||
assert.NotContains(t, "commitID", addonDescriptor.AsReducedJson())
|
||||
})
|
||||
}
|
||||
|
||||
var TestAddonDescriptorYAML = `---
|
||||
|
||||
Reference in New Issue
Block a user