1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/cmd/abapAddonAssemblyKitCheckPV.go

118 lines
4.8 KiB
Go
Raw Normal View History

AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
package cmd
import (
"encoding/json"
"net/url"
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
abapbuild "github.com/SAP/jenkins-library/pkg/abap/build"
"github.com/SAP/jenkins-library/pkg/abaputils"
"github.com/SAP/jenkins-library/pkg/command"
piperhttp "github.com/SAP/jenkins-library/pkg/http"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperutils"
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
"github.com/SAP/jenkins-library/pkg/telemetry"
)
func abapAddonAssemblyKitCheckPV(config abapAddonAssemblyKitCheckPVOptions, telemetryData *telemetry.CustomData, cpe *abapAddonAssemblyKitCheckPVCommonPipelineEnvironment) {
// for command execution use Command
c := command.Command{}
// reroute command output to logging framework
c.Stdout(log.Writer())
c.Stderr(log.Writer())
client := piperhttp.Client{}
// error situations should stop execution through log.Entry().Fatal() call which leads to an os.Exit(1) in the end
err := runAbapAddonAssemblyKitCheckPV(&config, telemetryData, &client, cpe, abaputils.ReadAddonDescriptor)
if err != nil {
log.Entry().WithError(err).Fatal("step execution failed")
}
}
func runAbapAddonAssemblyKitCheckPV(config *abapAddonAssemblyKitCheckPVOptions, telemetryData *telemetry.CustomData, client piperhttp.Sender,
cpe *abapAddonAssemblyKitCheckPVCommonPipelineEnvironment, readAdoDescriptor abaputils.ReadAddonDescriptorType) error {
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
conn := new(abapbuild.Connector)
conn.InitAAKaaS(config.AbapAddonAssemblyKitEndpoint, config.Username, config.Password, client)
log.Entry().Infof("Reading Product Version Information from addonDescriptor (aka addon.yml) file: %s", config.AddonDescriptorFileName)
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
addonDescriptor, err := readAdoDescriptor(config.AddonDescriptorFileName)
if err != nil {
return err
}
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
pv := new(productVersion).init(addonDescriptor, *conn)
err = pv.validateAndResolveVersionFields()
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
if err != nil {
return err
}
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
pv.transferVersionFields(&addonDescriptor)
// now Product Version fields are valid, but maybe Component Versions (Repositories) were checked before, so copy that part from CPE
// we don't care for errors
// scenario 1: config.AddonDescriptor is empty since checkPV is the first step in the pipeline, then the empty result is fine anyway
// scenario 2: for some reason config.AddonDescriptor is corrupt - then we insert the valid data but delete the repositories which will ensure issue is found later on
addonDescriptorCPE, _ := abaputils.ConstructAddonDescriptorFromJSON([]byte(config.AddonDescriptor))
if len(addonDescriptorCPE.Repositories) == 0 {
log.Entry().Info("No Software Component Information present yet in the addonDescriptor of CommonPipelineEnvironment")
} else {
log.Entry().Infof("Information for %v Software Component Repositories taken from addonDescriptor of CommonPipelineEnvironment", len(addonDescriptorCPE.Repositories))
}
addonDescriptor.SetRepositories(addonDescriptorCPE.Repositories)
cpe.abap.addonDescriptor = string(addonDescriptor.AsJSON())
log.Entry().Info("Wrote addonDescriptor to CommonPipelineEnvironment")
var filesToPublish []piperutils.Path
log.Entry().Infof("Add %s to be published", config.AddonDescriptorFileName)
filesToPublish = append(filesToPublish, piperutils.Path{Target: config.AddonDescriptorFileName, Name: "AddonDescriptor", Mandatory: true})
log.Entry().Infof("Publsihing %v files", len(filesToPublish))
piperutils.PersistReportsAndLinks("abapAddonAssemblyKitCheckPV", "", filesToPublish, nil)
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
return nil
}
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
func (p *productVersion) init(desc abaputils.AddonDescriptor, conn abapbuild.Connector) *productVersion {
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
p.Connector = conn
p.Name = desc.AddonProduct
p.VersionYAML = desc.AddonVersionYAML
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
return p
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
}
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
func (p *productVersion) transferVersionFields(initialAddonDescriptor *abaputils.AddonDescriptor) {
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
initialAddonDescriptor.AddonVersion = p.Version
initialAddonDescriptor.AddonSpsLevel = p.SpsLevel
initialAddonDescriptor.AddonPatchLevel = p.PatchLevel
}
AAKaaS check steps to run without prior PV input (#2091) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS Checks as First Step * remove old coding Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> Co-authored-by: Chris <42861202+bluesbrother84@users.noreply.github.com>
2020-09-30 10:30:53 +02:00
func (p *productVersion) validateAndResolveVersionFields() error {
log.Entry().Infof("Validate product '%s' version '%s' and resolve version", p.Name, p.VersionYAML)
appendum := "/odata/aas_ocs_package/ValidateProductVersion?Name='" + url.QueryEscape(p.Name) + "'&Version='" + url.QueryEscape(p.VersionYAML) + "'"
AAKaaS: 2 Check Product Version (#2037) * adding my steps * messy step * Update abapEnvironmentAssembly.go * clean up * change yaml * corrections * Update cloudFoundryDeploy.go * update * delete simulation step * remove simulate * Update PiperGoUtils.groovy * Update PiperGoUtils.groovy * Update CommonStepsTest.groovy * add docu * Update abapEnvironmentAssembly.md * changes due to PR * Update .gitignore * b * CV list * Update abapEnvironmentAssembly.go * testing with simulation * Update abapEnvironmentAssembly.go * remove simulation * renaming * Update mkdocs.yml * moving service key to yaml and fixing code climate * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * Update abapEnvironmentAssemblePackages.go * change input * Update abapEnvironmentAssemblePackages.go * change json tag * fixed error handling * documentation * Update abapEnvironmentAssemblePackages.md * Update abapEnvironmentAssemblePackages.md * fixing code climate issues * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * fixing code climate issues * Update abapEnvironmentAssemblePackages.yaml * adding unittests * adding unittests and improved logging * yaml -> json * change scope of cfServiceKeyName * correct indentation * Update CommonStepsTest.groovy * maintain correct step order * AAKaaS CheckPV step * AAKaaS CheckPV step #2 * AAKaaS CheckPV step #3 * AAKaaS CheckPV step #4 * AAKaaS CheckPV step #5 * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckPV.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * Update resources/metadata/abapAddonAssemblyKitCheckCVs.yaml Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> * AAKaaS CheckPV step #6 Co-authored-by: rosemarieB <45030247+rosemarieB@users.noreply.github.com> Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-09-17 15:56:14 +02:00
body, err := p.Connector.Get(appendum)
if err != nil {
return err
}
var jPV jsonProductVersion
json.Unmarshal(body, &jPV)
p.Name = jPV.ProductVersion.Name
p.Version = jPV.ProductVersion.Version
p.SpsLevel = jPV.ProductVersion.SpsLevel
p.PatchLevel = jPV.ProductVersion.PatchLevel
log.Entry().Infof("Resolved version %s, spslevel %s, patchlevel %s", p.Version, p.SpsLevel, p.PatchLevel)
return nil
}
type jsonProductVersion struct {
ProductVersion *productVersion `json:"d"`
}
type productVersion struct {
abapbuild.Connector
Name string `json:"Name"`
VersionYAML string
Version string `json:"Version"`
SpsLevel string `json:"SpsLevel"`
PatchLevel string `json:"PatchLevel"`
TargetVectorID string
}