You've already forked sap-jenkins-library
							
							
				mirror of
				https://github.com/SAP/jenkins-library.git
				synced 2025-10-30 23:57:50 +02:00 
			
		
		
		
	AAKaaS: 3 publish target Vector (#2040)
* 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 publishTV * AAKaaS 3 Publish TV #2 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>
This commit is contained in:
		
							
								
								
									
										54
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
|  | ||||
| 	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/telemetry" | ||||
| 	"github.com/pkg/errors" | ||||
| ) | ||||
|  | ||||
| func abapAddonAssemblyKitPublishTargetVector(config abapAddonAssemblyKitPublishTargetVectorOptions, telemetryData *telemetry.CustomData) { | ||||
| 	// 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 := runAbapAddonAssemblyKitPublishTargetVector(&config, telemetryData, &client) | ||||
| 	if err != nil { | ||||
| 		log.Entry().WithError(err).Fatal("step execution failed") | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runAbapAddonAssemblyKitPublishTargetVector(config *abapAddonAssemblyKitPublishTargetVectorOptions, telemetryData *telemetry.CustomData, client piperhttp.Sender) error { | ||||
| 	conn := new(abapbuild.Connector) | ||||
| 	conn.InitAAKaaS(config.AbapAddonAssemblyKitEndpoint, config.Username, config.Password, client) | ||||
| 	var addonDescriptor abaputils.AddonDescriptor | ||||
| 	json.Unmarshal([]byte(config.AddonDescriptor), &addonDescriptor) | ||||
|  | ||||
| 	if addonDescriptor.TargetVectorID == "" { | ||||
| 		return errors.New("Parameter missing. Please provide the target vector id") | ||||
| 	} | ||||
|  | ||||
| 	if config.TargetVectorScope == "T" { | ||||
| 		log.Entry().Infof("Publish target vector %s to test SPC", addonDescriptor.TargetVectorID) | ||||
| 	} | ||||
| 	if config.TargetVectorScope == "P" { | ||||
| 		log.Entry().Infof("Publish target vector %s to SPC", addonDescriptor.TargetVectorID) | ||||
| 	} | ||||
| 	conn.GetToken("/odata/aas_ocs_package") | ||||
| 	appendum := "/odata/aas_ocs_package/PublishTargetVector?Id='" + addonDescriptor.TargetVectorID + "'&Scope='" + config.TargetVectorScope + "'" | ||||
| 	_, err := conn.Post(appendum, "") | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
							
								
								
									
										154
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector_generated.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										154
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector_generated.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,154 @@ | ||||
| // Code generated by piper's step-generator. DO NOT EDIT. | ||||
|  | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/SAP/jenkins-library/pkg/config" | ||||
| 	"github.com/SAP/jenkins-library/pkg/log" | ||||
| 	"github.com/SAP/jenkins-library/pkg/telemetry" | ||||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
|  | ||||
| type abapAddonAssemblyKitPublishTargetVectorOptions struct { | ||||
| 	AbapAddonAssemblyKitEndpoint string `json:"abapAddonAssemblyKitEndpoint,omitempty"` | ||||
| 	Username                     string `json:"username,omitempty"` | ||||
| 	Password                     string `json:"password,omitempty"` | ||||
| 	TargetVectorScope            string `json:"targetVectorScope,omitempty"` | ||||
| 	AddonDescriptor              string `json:"addonDescriptor,omitempty"` | ||||
| } | ||||
|  | ||||
| // AbapAddonAssemblyKitPublishTargetVectorCommand This step triggers the publication of the Target Vector to the Service Provider Cockpit system, specified by the Scope. | ||||
| func AbapAddonAssemblyKitPublishTargetVectorCommand() *cobra.Command { | ||||
| 	const STEP_NAME = "abapAddonAssemblyKitPublishTargetVector" | ||||
|  | ||||
| 	metadata := abapAddonAssemblyKitPublishTargetVectorMetadata() | ||||
| 	var stepConfig abapAddonAssemblyKitPublishTargetVectorOptions | ||||
| 	var startTime time.Time | ||||
|  | ||||
| 	var createAbapAddonAssemblyKitPublishTargetVectorCmd = &cobra.Command{ | ||||
| 		Use:   STEP_NAME, | ||||
| 		Short: "This step triggers the publication of the Target Vector to the Service Provider Cockpit system, specified by the Scope.", | ||||
| 		Long: `This step reads the Target Vector ID from the addonDescriptor in the commonPipelineEnvironment and triggers the publication of the Target Vector to the Service Provider Cockpit system. | ||||
| With scopeTV "T" the Target Vector will be published to the test SPC and with scopeTV "P" it will be published to public SPC.`, | ||||
| 		PreRunE: func(cmd *cobra.Command, _ []string) error { | ||||
| 			startTime = time.Now() | ||||
| 			log.SetStepName(STEP_NAME) | ||||
| 			log.SetVerbose(GeneralConfig.Verbose) | ||||
|  | ||||
| 			path, _ := os.Getwd() | ||||
| 			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path} | ||||
| 			log.RegisterHook(fatalHook) | ||||
|  | ||||
| 			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile) | ||||
| 			if err != nil { | ||||
| 				log.SetErrorCategory(log.ErrorConfiguration) | ||||
| 				return err | ||||
| 			} | ||||
| 			log.RegisterSecret(stepConfig.Username) | ||||
| 			log.RegisterSecret(stepConfig.Password) | ||||
|  | ||||
| 			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 { | ||||
| 				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID) | ||||
| 				log.RegisterHook(&sentryHook) | ||||
| 			} | ||||
|  | ||||
| 			return nil | ||||
| 		}, | ||||
| 		Run: func(_ *cobra.Command, _ []string) { | ||||
| 			telemetryData := telemetry.CustomData{} | ||||
| 			telemetryData.ErrorCode = "1" | ||||
| 			handler := func() { | ||||
| 				telemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds()) | ||||
| 				telemetry.Send(&telemetryData) | ||||
| 			} | ||||
| 			log.DeferExitHandler(handler) | ||||
| 			defer handler() | ||||
| 			telemetry.Initialize(GeneralConfig.NoTelemetry, STEP_NAME) | ||||
| 			abapAddonAssemblyKitPublishTargetVector(stepConfig, &telemetryData) | ||||
| 			telemetryData.ErrorCode = "0" | ||||
| 			log.Entry().Info("SUCCESS") | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	addAbapAddonAssemblyKitPublishTargetVectorFlags(createAbapAddonAssemblyKitPublishTargetVectorCmd, &stepConfig) | ||||
| 	return createAbapAddonAssemblyKitPublishTargetVectorCmd | ||||
| } | ||||
|  | ||||
| func addAbapAddonAssemblyKitPublishTargetVectorFlags(cmd *cobra.Command, stepConfig *abapAddonAssemblyKitPublishTargetVectorOptions) { | ||||
| 	cmd.Flags().StringVar(&stepConfig.AbapAddonAssemblyKitEndpoint, "abapAddonAssemblyKitEndpoint", os.Getenv("PIPER_abapAddonAssemblyKitEndpoint"), "Base URL to the Addon Assembly Kit as a Service (AAKaaS) system") | ||||
| 	cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User for the Addon Assembly Kit as a Service (AAKaaS) system") | ||||
| 	cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password for the Addon Assembly Kit as a Service (AAKaaS) system") | ||||
| 	cmd.Flags().StringVar(&stepConfig.TargetVectorScope, "targetVectorScope", os.Getenv("PIPER_targetVectorScope"), "Determines whether the Target Vector is published to the public SPC('P') or the test SPC('T')") | ||||
| 	cmd.Flags().StringVar(&stepConfig.AddonDescriptor, "addonDescriptor", os.Getenv("PIPER_addonDescriptor"), "Structure in the commonPipelineEnvironment containing information about the Product Version and corresponding Software Component Versions") | ||||
|  | ||||
| 	cmd.MarkFlagRequired("abapAddonAssemblyKitEndpoint") | ||||
| 	cmd.MarkFlagRequired("username") | ||||
| 	cmd.MarkFlagRequired("password") | ||||
| 	cmd.MarkFlagRequired("addonDescriptor") | ||||
| } | ||||
|  | ||||
| // retrieve step metadata | ||||
| func abapAddonAssemblyKitPublishTargetVectorMetadata() config.StepData { | ||||
| 	var theMetaData = config.StepData{ | ||||
| 		Metadata: config.StepMetadata{ | ||||
| 			Name:    "abapAddonAssemblyKitPublishTargetVector", | ||||
| 			Aliases: []config.Alias{}, | ||||
| 		}, | ||||
| 		Spec: config.StepSpec{ | ||||
| 			Inputs: config.StepInputs{ | ||||
| 				Parameters: []config.StepParameters{ | ||||
| 					{ | ||||
| 						Name:        "abapAddonAssemblyKitEndpoint", | ||||
| 						ResourceRef: []config.ResourceReference{}, | ||||
| 						Scope:       []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, | ||||
| 						Type:        "string", | ||||
| 						Mandatory:   true, | ||||
| 						Aliases:     []config.Alias{}, | ||||
| 					}, | ||||
| 					{ | ||||
| 						Name:        "username", | ||||
| 						ResourceRef: []config.ResourceReference{}, | ||||
| 						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"}, | ||||
| 						Type:        "string", | ||||
| 						Mandatory:   true, | ||||
| 						Aliases:     []config.Alias{}, | ||||
| 					}, | ||||
| 					{ | ||||
| 						Name:        "password", | ||||
| 						ResourceRef: []config.ResourceReference{}, | ||||
| 						Scope:       []string{"PARAMETERS"}, | ||||
| 						Type:        "string", | ||||
| 						Mandatory:   true, | ||||
| 						Aliases:     []config.Alias{}, | ||||
| 					}, | ||||
| 					{ | ||||
| 						Name:        "targetVectorScope", | ||||
| 						ResourceRef: []config.ResourceReference{}, | ||||
| 						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"}, | ||||
| 						Type:        "string", | ||||
| 						Mandatory:   false, | ||||
| 						Aliases:     []config.Alias{}, | ||||
| 					}, | ||||
| 					{ | ||||
| 						Name: "addonDescriptor", | ||||
| 						ResourceRef: []config.ResourceReference{ | ||||
| 							{ | ||||
| 								Name:  "commonPipelineEnvironment", | ||||
| 								Param: "abap/addonDescriptor", | ||||
| 							}, | ||||
| 						}, | ||||
| 						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"}, | ||||
| 						Type:      "string", | ||||
| 						Mandatory: true, | ||||
| 						Aliases:   []config.Alias{}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
| 	return theMetaData | ||||
| } | ||||
| @@ -0,0 +1,16 @@ | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| ) | ||||
|  | ||||
| func TestAbapAddonAssemblyKitPublishTargetVectorCommand(t *testing.T) { | ||||
|  | ||||
| 	testCmd := AbapAddonAssemblyKitPublishTargetVectorCommand() | ||||
|  | ||||
| 	// only high level testing performed - details are tested in step generation procedure | ||||
| 	assert.Equal(t, "abapAddonAssemblyKitPublishTargetVector", testCmd.Use, "command name incorrect") | ||||
|  | ||||
| } | ||||
							
								
								
									
										65
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								cmd/abapAddonAssemblyKitPublishTargetVector_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/SAP/jenkins-library/pkg/abaputils" | ||||
| 	"github.com/pkg/errors" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| ) | ||||
|  | ||||
| func TestPublishTargetVectorStep(t *testing.T) { | ||||
| 	//setup | ||||
| 	config := abapAddonAssemblyKitPublishTargetVectorOptions{ | ||||
| 		TargetVectorScope: "P", | ||||
| 	} | ||||
| 	addonDescriptor := abaputils.AddonDescriptor{ | ||||
| 		TargetVectorID: "dummy", | ||||
| 	} | ||||
| 	adoDesc, _ := json.Marshal(addonDescriptor) | ||||
| 	config.AddonDescriptor = string(adoDesc) | ||||
|  | ||||
| 	client := &abaputils.ClientMock{ | ||||
| 		Body:       "dummy", | ||||
| 		Token:      "myToken", | ||||
| 		StatusCode: 200, | ||||
| 	} | ||||
|  | ||||
| 	t.Run("step success prod", func(t *testing.T) { | ||||
| 		//act | ||||
| 		err := runAbapAddonAssemblyKitPublishTargetVector(&config, nil, client) | ||||
| 		//assert | ||||
| 		assert.NoError(t, err, "Did not expect error") | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("step success test", func(t *testing.T) { | ||||
| 		//arrange | ||||
| 		config.TargetVectorScope = "T" | ||||
| 		//act | ||||
| 		err := runAbapAddonAssemblyKitPublishTargetVector(&config, nil, client) | ||||
| 		//assert | ||||
| 		assert.NoError(t, err, "Did not expect error") | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("step fail http", func(t *testing.T) { | ||||
| 		//arrange | ||||
| 		client := &abaputils.ClientMock{ | ||||
| 			Body:  "dummy", | ||||
| 			Error: errors.New("dummy"), | ||||
| 		} | ||||
| 		//act | ||||
| 		err := runAbapAddonAssemblyKitPublishTargetVector(&config, nil, client) | ||||
| 		//assert | ||||
| 		assert.Error(t, err, "Must end with error") | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("step fail no id", func(t *testing.T) { | ||||
| 		//arrange | ||||
| 		config := abapAddonAssemblyKitPublishTargetVectorOptions{} | ||||
| 		//act | ||||
| 		err := runAbapAddonAssemblyKitPublishTargetVector(&config, nil, client) | ||||
| 		//assert | ||||
| 		assert.Error(t, err, "Must end with error") | ||||
| 	}) | ||||
| } | ||||
| @@ -107,6 +107,11 @@ func Execute() { | ||||
| 	rootCmd.AddCommand(AbapEnvironmentAssemblePackagesCommand()) | ||||
| 	rootCmd.AddCommand(AbapAddonAssemblyKitCheckCVsCommand()) | ||||
| 	rootCmd.AddCommand(AbapAddonAssemblyKitCheckPVCommand()) | ||||
| 	//	rootCmd.AddCommand(AbapAddonAssemblyKitCreateTargetVectorCommand()) | ||||
| 	rootCmd.AddCommand(AbapAddonAssemblyKitPublishTargetVectorCommand()) | ||||
| 	//	rootCmd.AddCommand(AbapAddonAssemblyKitRegisterPackagesCommand()) | ||||
| 	//	rootCmd.AddCommand(AbapAddonAssemblyKitReleasePackagesCommand()) | ||||
| 	//	rootCmd.AddCommand(AbapAddonAssemblyKitReserveNextPackagesCommand()) | ||||
|  | ||||
| 	addRootFlags(rootCmd) | ||||
| 	if err := rootCmd.Execute(); err != nil { | ||||
|   | ||||
| @@ -0,0 +1,85 @@ | ||||
| # ${docGenStepName} | ||||
|  | ||||
| ## ${docGenDescription} | ||||
|  | ||||
| ## Prerequisites | ||||
|  | ||||
| * The credentials to access the AAKaaS (e.g. S-User) must be stored in the Jenkins Credential Store | ||||
| * This step needs an existing Target Vector as well as the scope where it should be published. | ||||
| * The Target Vector ID is taken from the addonDescriptor in the commonPipelineEnvironment. | ||||
| * If you run prior to this step the step [abapAddonAssemblyKitCreateTargetVector](https://sap.github.io/jenkins-library/steps/abapAddonAssemblyKitCreateTargetVector), the Target Vector will be created and its ID will be written to the commonPipelineEnvironment | ||||
|  | ||||
| ## ${docGenParameters} | ||||
|  | ||||
| ## ${docGenConfiguration} | ||||
|  | ||||
| ## ${docJenkinsPluginDependencies} | ||||
|  | ||||
| ## Examples | ||||
|  | ||||
| ### Configuration in the config.yml | ||||
|  | ||||
| The recommended way to configure your pipeline is via the config.yml file. In this case, calling the step in the Jenkinsfile looks: | ||||
|  | ||||
| ```groovy | ||||
| abapAddonAssemblyKitPublishTargetVector( | ||||
|                     scopeTV: 'scopeTV', | ||||
|                     script: this, | ||||
|                     ) | ||||
| ``` | ||||
|  | ||||
| The config.yml should look like this: | ||||
|  | ||||
| ```yaml | ||||
| steps: | ||||
|   abapAddonAssemblyKitPublishTargetVector: | ||||
|     abapAddonAssemblyKitCredentialsId: 'abapAddonAssemblyKitCredentialsId', | ||||
|     abapAddonAssemblyKitEndpoint: 'https://myabapAddonAssemblyKitEndpoint.com', | ||||
| ``` | ||||
|  | ||||
| ### Input via the CommonPipelineEnvironment | ||||
|  | ||||
| Mandatory fields: | ||||
|  | ||||
| ```json | ||||
| {"addonProduct":"", | ||||
| "addonVersion":"", | ||||
| "addonVersionAAK":"", | ||||
| "addonUniqueID":"", | ||||
| "customerID":"", | ||||
| "AddonSpsLevel":"", | ||||
| "AddonPatchLevel":"", | ||||
| "TargetVectorID":"W7Q00207512600000188", | ||||
| "repositories":[ | ||||
|   { | ||||
|     "name":"", | ||||
|     "tag":"", | ||||
|     "branch":"", | ||||
|     "version":"", | ||||
|     "versionAAK":"", | ||||
|     "PackageName":"", | ||||
|     "PackageType":"", | ||||
|     "SpLevel":"", | ||||
|     "PatchLevel":"", | ||||
|     "PredecessorCommitID":"", | ||||
|     "Status":"", | ||||
|     "Namespace":"", | ||||
|     "SarXMLFilePath":"" | ||||
|   }, | ||||
|   { | ||||
|     "name":"", | ||||
|     "tag":"", | ||||
|     "branch":"", | ||||
|     "version":"", | ||||
|     "versionAAK":"", | ||||
|     "PackageName":"", | ||||
|     "PackageType":"", | ||||
|     "SpLevel":"", | ||||
|     "PatchLevel":"", | ||||
|     "PredecessorCommitID":"", | ||||
|     "Status":"", | ||||
|     "Namespace":"", | ||||
|     "SarXMLFilePath":"" | ||||
|   } | ||||
| ]} | ||||
| ``` | ||||
| @@ -51,6 +51,11 @@ nav: | ||||
|     - 'Library steps': | ||||
|         - abapAddonAssemblyKitCheckCVs: steps/abapAddonAssemblyKitCheckCVs.md | ||||
|         - abapAddonAssemblyKitCheckCVs: steps/abapAddonAssemblyKitCheckPV.md | ||||
| #        - abapAddonAssemblyKitCreateTargetVector: steps/abapAddonAssemblyKitCreateTargetVector.md | ||||
|         - abapAddonAssemblyKitPublishTargetVector: steps/abapAddonAssemblyKitPublishTargetVector.md | ||||
| #        - abapAddonAssemblyKitRegisterPackages: steps/abapAddonAssemblyKitRegisterPackages.md | ||||
| #        - abapAddonAssemblyKitReleasePackages: steps/abapAddonAssemblyKitReleasePackages.md | ||||
| #        - abapAddonAssemblyKitReserveNextPackages: steps/abapAddonAssemblyKitReserveNextPackages.md | ||||
|         - abapEnvironmentAssemblePackages: steps/abapEnvironmentAssemblePackages.md | ||||
|         - abapEnvironmentCheckoutBranch: steps/abapEnvironmentCheckoutBranch.md | ||||
|         - abapEnvironmentCloneGitRepo: steps/abapEnvironmentCloneGitRepo.md | ||||
|   | ||||
| @@ -0,0 +1,59 @@ | ||||
| metadata: | ||||
|     name: abapAddonAssemblyKitPublishTargetVector | ||||
|     description: This step triggers the publication of the Target Vector to the Service Provider Cockpit system, specified by the Scope. | ||||
|     longDescription: | | ||||
|       This step reads the Target Vector ID from the addonDescriptor in the commonPipelineEnvironment and triggers the publication of the Target Vector to the Service Provider Cockpit system. | ||||
|       With scopeTV "T" the Target Vector will be published to the test SPC and with scopeTV "P" it will be published to public SPC. | ||||
| spec: | ||||
|   inputs: | ||||
|     secrets: | ||||
|       - name: abapAddonAssemblyKitCredentialsId | ||||
|         description: Credential stored in Jenkins for the Addon Assembly Kit as a Service (AAKaaS) system | ||||
|         type: jenkins | ||||
|     params: | ||||
|       - name: abapAddonAssemblyKitEndpoint | ||||
|         type: string | ||||
|         description: Base URL to the Addon Assembly Kit as a Service (AAKaaS) system | ||||
|         scope: | ||||
|           - PARAMETERS | ||||
|           - STAGES | ||||
|           - STEPS | ||||
|           - GENERAL | ||||
|         mandatory: true | ||||
|       - name: username | ||||
|         type: string | ||||
|         description: User for the Addon Assembly Kit as a Service (AAKaaS) system | ||||
|         scope: | ||||
|           - PARAMETERS | ||||
|           - STAGES | ||||
|           - STEPS | ||||
|         mandatory: true | ||||
|         secret: true | ||||
|       - name: password | ||||
|         type: string | ||||
|         description: Password for the Addon Assembly Kit as a Service (AAKaaS) system | ||||
|         scope: | ||||
|           - PARAMETERS | ||||
|         mandatory: true | ||||
|         secret: true | ||||
|       - name: targetVectorScope | ||||
|         type: string | ||||
|         description: Determines whether the Target Vector is published to the public SPC('P') or the test SPC('T') | ||||
|         possibleValues: | ||||
|           - T | ||||
|           - P | ||||
|         scope: | ||||
|           - PARAMETERS | ||||
|           - STAGES | ||||
|           - STEPS | ||||
|       - name: addonDescriptor | ||||
|         type: string | ||||
|         description: Structure in the commonPipelineEnvironment containing information about the Product Version and corresponding Software Component Versions | ||||
|         mandatory: true | ||||
|         scope: | ||||
|           - PARAMETERS | ||||
|           - STAGES | ||||
|           - STEPS | ||||
|         resourceRef: | ||||
|           - name: commonPipelineEnvironment | ||||
|             param: abap/addonDescriptor | ||||
| @@ -108,6 +108,11 @@ public class CommonStepsTest extends BasePiperTest{ | ||||
|     private static fieldRelatedWhitelist = [ | ||||
|         'abapAddonAssemblyKitCheckCVs', //implementing new golang pattern without fields | ||||
|         'abapAddonAssemblyKitCheckPV', //implementing new golang pattern without fields | ||||
|         //'abapAddonAssemblyKitCreateTargetVector', //implementing new golang pattern without fields | ||||
|         'abapAddonAssemblyKitPublishTargetVector', //implementing new golang pattern without fields | ||||
|         //'abapAddonAssemblyKitRegisterPackages', //implementing new golang pattern without fields | ||||
|         //'abapAddonAssemblyKitReleasePackages', //implementing new golang pattern without fields | ||||
|         //'abapAddonAssemblyKitReserveNextPackages', //implementing new golang pattern without fields | ||||
|         'abapEnvironmentAssemblePackages', //implementing new golang pattern without fields | ||||
|         'abapEnvironmentCheckoutBranch', //implementing new golang pattern without fields | ||||
|         'abapEnvironmentCloneGitRepo', //implementing new golang pattern without fields | ||||
|   | ||||
							
								
								
									
										11
									
								
								vars/abapAddonAssemblyKitPublishTargetVector.groovy
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								vars/abapAddonAssemblyKitPublishTargetVector.groovy
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| import groovy.transform.Field | ||||
|  | ||||
| @Field String STEP_NAME = getClass().getName() | ||||
| @Field String METADATA_FILE = 'metadata/abapAddonAssemblyKitPublishTargetVector.yaml' | ||||
|  | ||||
| void call(Map parameters = [:]) { | ||||
|     List credentials = [ | ||||
|         [type: 'usernamePassword', id: 'abapAddonAssemblyKitCredentialsId', env: ['PIPER_username', 'PIPER_password']] | ||||
|     ] | ||||
|         piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials, false, false, true) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user