-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 1084565-infra-doc
- Loading branch information
Showing
77 changed files
with
3,288 additions
and
912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
- uses: styfle/[email protected] | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20.x' | ||
go-version: '1.21.x' | ||
- name: Cache Golang Packages | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -43,7 +43,7 @@ jobs: | |
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20.x' | ||
go-version: '1.21.x' | ||
- name: Cache Golang Packages | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -63,8 +63,7 @@ jobs: | |
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20.x' | ||
# action requires [email protected] | ||
go-version: '1.21.x' | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -79,7 +78,7 @@ jobs: | |
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20.x' | ||
go-version: '1.21.x' | ||
- name: Cache Golang Packages | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -99,7 +98,7 @@ jobs: | |
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20.x' | ||
go-version: '1.21.x' | ||
- name: Cache Golang Packages | ||
uses: actions/cache@v3 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.20 AS build-env | ||
FROM golang:1.21 AS build-env | ||
COPY . /build | ||
WORKDIR /build | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/SAP/jenkins-library/pkg/abap/aakaas" | ||
abapbuild "github.com/SAP/jenkins-library/pkg/abap/build" | ||
"github.com/SAP/jenkins-library/pkg/abaputils" | ||
"github.com/SAP/jenkins-library/pkg/log" | ||
"github.com/SAP/jenkins-library/pkg/piperutils" | ||
"github.com/SAP/jenkins-library/pkg/telemetry" | ||
) | ||
|
||
func abapAddonAssemblyKitCheck(config abapAddonAssemblyKitCheckOptions, telemetryData *telemetry.CustomData, commonPipelineEnvironment *abapAddonAssemblyKitCheckCommonPipelineEnvironment) { | ||
utils := aakaas.NewAakBundle() | ||
|
||
err := runAbapAddonAssemblyKitCheck(&config, telemetryData, utils, commonPipelineEnvironment) | ||
if err != nil { | ||
log.Entry().WithError(err).Fatal("step execution failed") | ||
} | ||
} | ||
|
||
func runAbapAddonAssemblyKitCheck(config *abapAddonAssemblyKitCheckOptions, telemetryData *telemetry.CustomData, utils aakaas.AakUtils, commonPipelineEnvironment *abapAddonAssemblyKitCheckCommonPipelineEnvironment) error { | ||
|
||
log.Entry().Info("╔═══════════════════════════╗") | ||
log.Entry().Info("║ abapAddonAssemblyKitCheck ║") | ||
log.Entry().Info("╚═══════════════════════════╝") | ||
|
||
conn := new(abapbuild.Connector) | ||
if err := conn.InitAAKaaS(config.AbapAddonAssemblyKitEndpoint, config.Username, config.Password, utils, "", config.AbapAddonAssemblyKitCertificateFile, config.AbapAddonAssemblyKitCertificatePass); err != nil { | ||
return err | ||
} | ||
|
||
log.Entry().Infof("reading addonDescriptor (aka addon.yml) file: %s", config.AddonDescriptorFileName) | ||
addonDescriptor, err := utils.ReadAddonDescriptor(config.AddonDescriptorFileName) | ||
if err != nil { | ||
return err | ||
} | ||
log.Entry().Info("building product modelling (and resolving potential wildcards)") | ||
pvh, err := aakaas.NewProductVersionHeader(&addonDescriptor, conn) | ||
if err != nil { | ||
return err | ||
} | ||
printProductVersionHeader(*pvh) | ||
|
||
log.Entry().Info("calling AAKaaS to check product modelling...") | ||
if err := pvh.CheckAndResolveVersion(conn); err != nil { | ||
return err | ||
} | ||
log.Entry().Info("... success!") | ||
pvh.SyncAddonDescriptorVersionFields(&addonDescriptor) | ||
log.Entry().Info("resolved version fields:") | ||
printAddonDescriptorVersionFields(addonDescriptor) | ||
log.Entry().Info("transferring addonDescriptor to commonPipelineEnvironment for usage by subsequent steps of the pipeline") | ||
commonPipelineEnvironment.abap.addonDescriptor = string(addonDescriptor.AsJSON()) | ||
|
||
publishAddonYaml(config, utils) | ||
return nil | ||
} | ||
|
||
func printProductVersionHeader(pvh aakaas.ProductVersionHeader) { | ||
logLine30 := "──────────────────────────────" | ||
log.Entry().Infof("┌─%-30v─┬─%-30v─┐", logLine30, logLine30) | ||
log.Entry().Infof("│ %-30v │ %-30v │", "Product Name", pvh.ProductName) | ||
log.Entry().Infof("│ %-30v │ %-30v │", "Product Version", pvh.SemanticProductVersion) | ||
log.Entry().Infof("├─%-30v─┼─%-30v─┤", logLine30, logLine30) | ||
log.Entry().Infof("│ %-30v │ %-30v │", "Software Component Name", "Software Component Version") | ||
log.Entry().Infof("├─%-30v─┼─%-30v─┤", logLine30, logLine30) | ||
for _, pvc := range pvh.Content { | ||
log.Entry().Infof("│ %-30v │ %-30v │", pvc.SoftwareComponentName, pvc.SemanticSoftwareComponentVersion) | ||
} | ||
log.Entry().Infof("└─%-30v─┴─%-30v─┘", logLine30, logLine30) | ||
} | ||
|
||
func printAddonDescriptorVersionFields(addonDescriptor abaputils.AddonDescriptor) { | ||
logLine30 := "──────────────────────────────" | ||
logLine4 := "────" | ||
log.Entry().Infof("┌─%-30v─┬─%-4v─┬─%-4v─┬─%-4v─┐", logLine30, logLine4, logLine4, logLine4) | ||
log.Entry().Infof("│ %-30v │ %-4v │ %-4v │ %-4v │", "Name", "Vers", "SP", "Pat.") | ||
log.Entry().Infof("├─%-30v─┼─%-4v─┼─%-4v─┼─%-4v─┤", logLine30, logLine4, logLine4, logLine4) | ||
log.Entry().Infof("│ %-30v │ %-4v │ %-4v │ %-4v │", addonDescriptor.AddonProduct, addonDescriptor.AddonVersion, addonDescriptor.AddonSpsLevel, addonDescriptor.AddonPatchLevel) | ||
for _, repo := range addonDescriptor.Repositories { | ||
log.Entry().Infof("│ %-30v │ %-4v │ %-4v │ %-4v │", repo.Name, repo.Version, repo.SpLevel, repo.PatchLevel) | ||
} | ||
log.Entry().Infof("└─%-30v─┴─%-4v─┴─%-4v─┴─%-4v─┘", logLine30, logLine4, logLine4, logLine4) | ||
} | ||
|
||
func publishAddonYaml(config *abapAddonAssemblyKitCheckOptions, utils aakaas.AakUtils) { | ||
var filesToPublish []piperutils.Path | ||
log.Entry().Infof("adding %s to be published", config.AddonDescriptorFileName) | ||
filesToPublish = append(filesToPublish, piperutils.Path{Target: config.AddonDescriptorFileName, Name: "AddonDescriptor", Mandatory: true}) | ||
log.Entry().Infof("publishing %v files", len(filesToPublish)) | ||
if err := piperutils.PersistReportsAndLinks("abapAddonAssemblyKitCheckPV", "", utils, filesToPublish, nil); err != nil { | ||
log.Entry().WithError(err).Error("failed to persist report information") | ||
} | ||
} |
Oops, something went wrong.