github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/cmd/mtaBuild_generated.go (about)

     1  // Code generated by piper's step-generator. DO NOT EDIT.
     2  
     3  package cmd
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"path/filepath"
     9  	"reflect"
    10  	"strings"
    11  	"time"
    12  
    13  	"github.com/SAP/jenkins-library/pkg/config"
    14  	"github.com/SAP/jenkins-library/pkg/gcs"
    15  	"github.com/SAP/jenkins-library/pkg/log"
    16  	"github.com/SAP/jenkins-library/pkg/piperenv"
    17  	"github.com/SAP/jenkins-library/pkg/splunk"
    18  	"github.com/SAP/jenkins-library/pkg/telemetry"
    19  	"github.com/SAP/jenkins-library/pkg/validation"
    20  	"github.com/bmatcuk/doublestar"
    21  	"github.com/spf13/cobra"
    22  )
    23  
    24  type mtaBuildOptions struct {
    25  	MtarName                        string   `json:"mtarName,omitempty"`
    26  	MtarGroup                       string   `json:"mtarGroup,omitempty"`
    27  	Version                         string   `json:"version,omitempty"`
    28  	Extensions                      string   `json:"extensions,omitempty"`
    29  	Jobs                            int      `json:"jobs,omitempty"`
    30  	Platform                        string   `json:"platform,omitempty" validate:"possible-values=CF NEO XSA"`
    31  	ApplicationName                 string   `json:"applicationName,omitempty"`
    32  	Source                          string   `json:"source,omitempty"`
    33  	Target                          string   `json:"target,omitempty"`
    34  	DefaultNpmRegistry              string   `json:"defaultNpmRegistry,omitempty"`
    35  	ProjectSettingsFile             string   `json:"projectSettingsFile,omitempty"`
    36  	GlobalSettingsFile              string   `json:"globalSettingsFile,omitempty"`
    37  	M2Path                          string   `json:"m2Path,omitempty"`
    38  	InstallArtifacts                bool     `json:"installArtifacts,omitempty"`
    39  	MtaDeploymentRepositoryPassword string   `json:"mtaDeploymentRepositoryPassword,omitempty"`
    40  	MtaDeploymentRepositoryUser     string   `json:"mtaDeploymentRepositoryUser,omitempty"`
    41  	MtaDeploymentRepositoryURL      string   `json:"mtaDeploymentRepositoryUrl,omitempty"`
    42  	Publish                         bool     `json:"publish,omitempty"`
    43  	Profiles                        []string `json:"profiles,omitempty"`
    44  	BuildSettingsInfo               string   `json:"buildSettingsInfo,omitempty"`
    45  }
    46  
    47  type mtaBuildCommonPipelineEnvironment struct {
    48  	mtarFilePath string
    49  	custom       struct {
    50  		mtaBuildToolDesc  string
    51  		mtarPublishedURL  string
    52  		buildSettingsInfo string
    53  	}
    54  }
    55  
    56  func (p *mtaBuildCommonPipelineEnvironment) persist(path, resourceName string) {
    57  	content := []struct {
    58  		category string
    59  		name     string
    60  		value    interface{}
    61  	}{
    62  		{category: "", name: "mtarFilePath", value: p.mtarFilePath},
    63  		{category: "custom", name: "mtaBuildToolDesc", value: p.custom.mtaBuildToolDesc},
    64  		{category: "custom", name: "mtarPublishedUrl", value: p.custom.mtarPublishedURL},
    65  		{category: "custom", name: "buildSettingsInfo", value: p.custom.buildSettingsInfo},
    66  	}
    67  
    68  	errCount := 0
    69  	for _, param := range content {
    70  		err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value)
    71  		if err != nil {
    72  			log.Entry().WithError(err).Error("Error persisting piper environment.")
    73  			errCount++
    74  		}
    75  	}
    76  	if errCount > 0 {
    77  		log.Entry().Error("failed to persist Piper environment")
    78  	}
    79  }
    80  
    81  type mtaBuildReports struct {
    82  }
    83  
    84  func (p *mtaBuildReports) persist(stepConfig mtaBuildOptions, gcpJsonKeyFilePath string, gcsBucketId string, gcsFolderPath string, gcsSubFolder string) {
    85  	if gcsBucketId == "" {
    86  		log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
    87  		return
    88  	}
    89  	log.Entry().Info("Uploading reports to Google Cloud Storage...")
    90  	content := []gcs.ReportOutputParam{
    91  		{FilePattern: "**/TEST-*.xml", ParamRef: "", StepResultType: "junit"},
    92  		{FilePattern: "**/cobertura-coverage.xml", ParamRef: "", StepResultType: "cobertura-coverage"},
    93  		{FilePattern: "**/jacoco.xml", ParamRef: "", StepResultType: "jacoco-coverage"},
    94  	}
    95  	envVars := []gcs.EnvVar{
    96  		{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: gcpJsonKeyFilePath, Modified: false},
    97  	}
    98  	gcsClient, err := gcs.NewClient(gcs.WithEnvVars(envVars))
    99  	if err != nil {
   100  		log.Entry().Errorf("creation of GCS client failed: %v", err)
   101  		return
   102  	}
   103  	defer gcsClient.Close()
   104  	structVal := reflect.ValueOf(&stepConfig).Elem()
   105  	inputParameters := map[string]string{}
   106  	for i := 0; i < structVal.NumField(); i++ {
   107  		field := structVal.Type().Field(i)
   108  		if field.Type.String() == "string" {
   109  			paramName := strings.Split(field.Tag.Get("json"), ",")
   110  			paramValue, _ := structVal.Field(i).Interface().(string)
   111  			inputParameters[paramName[0]] = paramValue
   112  		}
   113  	}
   114  	if err := gcs.PersistReportsToGCS(gcsClient, content, inputParameters, gcsFolderPath, gcsBucketId, gcsSubFolder, doublestar.Glob, os.Stat); err != nil {
   115  		log.Entry().Errorf("failed to persist reports: %v", err)
   116  	}
   117  }
   118  
   119  // MtaBuildCommand Performs an mta build
   120  func MtaBuildCommand() *cobra.Command {
   121  	const STEP_NAME = "mtaBuild"
   122  
   123  	metadata := mtaBuildMetadata()
   124  	var stepConfig mtaBuildOptions
   125  	var startTime time.Time
   126  	var commonPipelineEnvironment mtaBuildCommonPipelineEnvironment
   127  	var reports mtaBuildReports
   128  	var logCollector *log.CollectorHook
   129  	var splunkClient *splunk.Splunk
   130  	telemetryClient := &telemetry.Telemetry{}
   131  
   132  	var createMtaBuildCmd = &cobra.Command{
   133  		Use:   STEP_NAME,
   134  		Short: "Performs an mta build",
   135  		Long: `Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
   136  ### build with depedencies from a private repository
   137  1. For maven related settings refer [maven build dependencies](./mavenBuild.md#build-with-depedencies-from-a-private-repository)
   138  2. For NPM related settings refer [NPM build dependencies](./npmExecuteScripts.md#build-with-depedencies-from-a-private-repository)`,
   139  		PreRunE: func(cmd *cobra.Command, _ []string) error {
   140  			startTime = time.Now()
   141  			log.SetStepName(STEP_NAME)
   142  			log.SetVerbose(GeneralConfig.Verbose)
   143  
   144  			GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens)
   145  
   146  			path, _ := os.Getwd()
   147  			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
   148  			log.RegisterHook(fatalHook)
   149  
   150  			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
   151  			if err != nil {
   152  				log.SetErrorCategory(log.ErrorConfiguration)
   153  				return err
   154  			}
   155  			log.RegisterSecret(stepConfig.MtaDeploymentRepositoryPassword)
   156  
   157  			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
   158  				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
   159  				log.RegisterHook(&sentryHook)
   160  			}
   161  
   162  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   163  				splunkClient = &splunk.Splunk{}
   164  				logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
   165  				log.RegisterHook(logCollector)
   166  			}
   167  
   168  			if err = log.RegisterANSHookIfConfigured(GeneralConfig.CorrelationID); err != nil {
   169  				log.Entry().WithError(err).Warn("failed to set up SAP Alert Notification Service log hook")
   170  			}
   171  
   172  			validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages())
   173  			if err != nil {
   174  				return err
   175  			}
   176  			if err = validation.ValidateStruct(stepConfig); err != nil {
   177  				log.SetErrorCategory(log.ErrorConfiguration)
   178  				return err
   179  			}
   180  
   181  			return nil
   182  		},
   183  		Run: func(_ *cobra.Command, _ []string) {
   184  			stepTelemetryData := telemetry.CustomData{}
   185  			stepTelemetryData.ErrorCode = "1"
   186  			handler := func() {
   187  				commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment")
   188  				reports.persist(stepConfig, GeneralConfig.GCPJsonKeyFilePath, GeneralConfig.GCSBucketId, GeneralConfig.GCSFolderPath, GeneralConfig.GCSSubFolder)
   189  				config.RemoveVaultSecretFiles()
   190  				stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
   191  				stepTelemetryData.ErrorCategory = log.GetErrorCategory().String()
   192  				stepTelemetryData.PiperCommitHash = GitCommit
   193  				telemetryClient.SetData(&stepTelemetryData)
   194  				telemetryClient.Send()
   195  				if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   196  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   197  						GeneralConfig.HookConfig.SplunkConfig.Dsn,
   198  						GeneralConfig.HookConfig.SplunkConfig.Token,
   199  						GeneralConfig.HookConfig.SplunkConfig.Index,
   200  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   201  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   202  				}
   203  				if len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
   204  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   205  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint,
   206  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblToken,
   207  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblIndex,
   208  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   209  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   210  				}
   211  			}
   212  			log.DeferExitHandler(handler)
   213  			defer handler()
   214  			telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
   215  			mtaBuild(stepConfig, &stepTelemetryData, &commonPipelineEnvironment)
   216  			stepTelemetryData.ErrorCode = "0"
   217  			log.Entry().Info("SUCCESS")
   218  		},
   219  	}
   220  
   221  	addMtaBuildFlags(createMtaBuildCmd, &stepConfig)
   222  	return createMtaBuildCmd
   223  }
   224  
   225  func addMtaBuildFlags(cmd *cobra.Command, stepConfig *mtaBuildOptions) {
   226  	cmd.Flags().StringVar(&stepConfig.MtarName, "mtarName", os.Getenv("PIPER_mtarName"), "The name of the generated mtar file including its extension.")
   227  	cmd.Flags().StringVar(&stepConfig.MtarGroup, "mtarGroup", os.Getenv("PIPER_mtarGroup"), "The group to which the mtar artifact will be uploaded. Required when publish is True.")
   228  	cmd.Flags().StringVar(&stepConfig.Version, "version", os.Getenv("PIPER_version"), "Version of the mtar artifact")
   229  	cmd.Flags().StringVar(&stepConfig.Extensions, "extensions", os.Getenv("PIPER_extensions"), "The path to the extension descriptor file.")
   230  	cmd.Flags().IntVar(&stepConfig.Jobs, "jobs", 0, "Configures the number of Make jobs that can run simultaneously. Maximum value allowed is 8")
   231  	cmd.Flags().StringVar(&stepConfig.Platform, "platform", `CF`, "The target platform to which the mtar can be deployed.")
   232  	cmd.Flags().StringVar(&stepConfig.ApplicationName, "applicationName", os.Getenv("PIPER_applicationName"), "The name of the application which is being built. If the parameter has been provided and no `mta.yaml` exists, the `mta.yaml` will be automatically generated using this parameter and the information (`name` and `version`) from 'package.json` before the actual build starts.")
   233  	cmd.Flags().StringVar(&stepConfig.Source, "source", `./`, "The path to the MTA project.")
   234  	cmd.Flags().StringVar(&stepConfig.Target, "target", `./`, "The folder for the generated `MTAR` file. If the parameter has been provided, the `MTAR` file is saved in the root of the folder provided by the argument.")
   235  	cmd.Flags().StringVar(&stepConfig.DefaultNpmRegistry, "defaultNpmRegistry", os.Getenv("PIPER_defaultNpmRegistry"), "Url to the npm registry that should be used for installing npm dependencies.")
   236  	cmd.Flags().StringVar(&stepConfig.ProjectSettingsFile, "projectSettingsFile", os.Getenv("PIPER_projectSettingsFile"), "Path or url to the mvn settings file that should be used as project settings file.")
   237  	cmd.Flags().StringVar(&stepConfig.GlobalSettingsFile, "globalSettingsFile", os.Getenv("PIPER_globalSettingsFile"), "Path or url to the mvn settings file that should be used as global settings file")
   238  	cmd.Flags().StringVar(&stepConfig.M2Path, "m2Path", os.Getenv("PIPER_m2Path"), "Path to the location of the local repository that should be used.")
   239  	cmd.Flags().BoolVar(&stepConfig.InstallArtifacts, "installArtifacts", false, "If enabled, for npm packages this step will install all dependencies including dev dependencies. For maven it will install all artifacts to the local maven repository. Note: This happens _after_ mta build was done. The default mta build tool does not install dev-dependencies as part of the process. If you require dev-dependencies for building the mta, you will need to use a [custom builder](https://sap.github.io/cloud-mta-build-tool/configuration/#configuring-the-custom-builder)")
   240  	cmd.Flags().StringVar(&stepConfig.MtaDeploymentRepositoryPassword, "mtaDeploymentRepositoryPassword", os.Getenv("PIPER_mtaDeploymentRepositoryPassword"), "Password for the alternative deployment repository to which mtar artifacts will be publised")
   241  	cmd.Flags().StringVar(&stepConfig.MtaDeploymentRepositoryUser, "mtaDeploymentRepositoryUser", os.Getenv("PIPER_mtaDeploymentRepositoryUser"), "User for the alternative deployment repository to which which mtar artifacts will be publised")
   242  	cmd.Flags().StringVar(&stepConfig.MtaDeploymentRepositoryURL, "mtaDeploymentRepositoryUrl", os.Getenv("PIPER_mtaDeploymentRepositoryUrl"), "Url for the alternative deployment repository to which mtar artifacts will be publised")
   243  	cmd.Flags().BoolVar(&stepConfig.Publish, "publish", false, "pushed mtar artifact to altDeploymentRepositoryUrl/altDeploymentRepositoryID when set to true")
   244  	cmd.Flags().StringSliceVar(&stepConfig.Profiles, "profiles", []string{}, "Defines list of maven build profiles to be used. profiles will overwrite existing values in the global settings xml at $M2_HOME/conf/settings.xml")
   245  	cmd.Flags().StringVar(&stepConfig.BuildSettingsInfo, "buildSettingsInfo", os.Getenv("PIPER_buildSettingsInfo"), "build settings info is typically filled by the step automatically to create information about the build settings that were used during the mta build . This information is typically used for compliance related processes.")
   246  
   247  }
   248  
   249  // retrieve step metadata
   250  func mtaBuildMetadata() config.StepData {
   251  	var theMetaData = config.StepData{
   252  		Metadata: config.StepMetadata{
   253  			Name:        "mtaBuild",
   254  			Aliases:     []config.Alias{},
   255  			Description: "Performs an mta build",
   256  		},
   257  		Spec: config.StepSpec{
   258  			Inputs: config.StepInputs{
   259  				Parameters: []config.StepParameters{
   260  					{
   261  						Name:        "mtarName",
   262  						ResourceRef: []config.ResourceReference{},
   263  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   264  						Type:        "string",
   265  						Mandatory:   false,
   266  						Aliases:     []config.Alias{},
   267  						Default:     os.Getenv("PIPER_mtarName"),
   268  					},
   269  					{
   270  						Name:        "mtarGroup",
   271  						ResourceRef: []config.ResourceReference{},
   272  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   273  						Type:        "string",
   274  						Mandatory:   false,
   275  						Aliases:     []config.Alias{},
   276  						Default:     os.Getenv("PIPER_mtarGroup"),
   277  					},
   278  					{
   279  						Name: "version",
   280  						ResourceRef: []config.ResourceReference{
   281  							{
   282  								Name:  "commonPipelineEnvironment",
   283  								Param: "artifactVersion",
   284  							},
   285  						},
   286  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   287  						Type:      "string",
   288  						Mandatory: false,
   289  						Aliases:   []config.Alias{{Name: "artifactVersion"}},
   290  						Default:   os.Getenv("PIPER_version"),
   291  					},
   292  					{
   293  						Name:        "extensions",
   294  						ResourceRef: []config.ResourceReference{},
   295  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   296  						Type:        "string",
   297  						Mandatory:   false,
   298  						Aliases:     []config.Alias{{Name: "extension"}},
   299  						Default:     os.Getenv("PIPER_extensions"),
   300  					},
   301  					{
   302  						Name:        "jobs",
   303  						ResourceRef: []config.ResourceReference{},
   304  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   305  						Type:        "int",
   306  						Mandatory:   false,
   307  						Aliases:     []config.Alias{{Name: "jobs"}},
   308  						Default:     0,
   309  					},
   310  					{
   311  						Name:        "platform",
   312  						ResourceRef: []config.ResourceReference{},
   313  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   314  						Type:        "string",
   315  						Mandatory:   false,
   316  						Aliases:     []config.Alias{},
   317  						Default:     `CF`,
   318  					},
   319  					{
   320  						Name:        "applicationName",
   321  						ResourceRef: []config.ResourceReference{},
   322  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   323  						Type:        "string",
   324  						Mandatory:   false,
   325  						Aliases:     []config.Alias{},
   326  						Default:     os.Getenv("PIPER_applicationName"),
   327  					},
   328  					{
   329  						Name:        "source",
   330  						ResourceRef: []config.ResourceReference{},
   331  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   332  						Type:        "string",
   333  						Mandatory:   false,
   334  						Aliases:     []config.Alias{},
   335  						Default:     `./`,
   336  					},
   337  					{
   338  						Name:        "target",
   339  						ResourceRef: []config.ResourceReference{},
   340  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   341  						Type:        "string",
   342  						Mandatory:   false,
   343  						Aliases:     []config.Alias{},
   344  						Default:     `./`,
   345  					},
   346  					{
   347  						Name:        "defaultNpmRegistry",
   348  						ResourceRef: []config.ResourceReference{},
   349  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   350  						Type:        "string",
   351  						Mandatory:   false,
   352  						Aliases:     []config.Alias{{Name: "npm/defaultNpmRegistry"}},
   353  						Default:     os.Getenv("PIPER_defaultNpmRegistry"),
   354  					},
   355  					{
   356  						Name:        "projectSettingsFile",
   357  						ResourceRef: []config.ResourceReference{},
   358  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   359  						Type:        "string",
   360  						Mandatory:   false,
   361  						Aliases:     []config.Alias{{Name: "maven/projectSettingsFile"}},
   362  						Default:     os.Getenv("PIPER_projectSettingsFile"),
   363  					},
   364  					{
   365  						Name:        "globalSettingsFile",
   366  						ResourceRef: []config.ResourceReference{},
   367  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   368  						Type:        "string",
   369  						Mandatory:   false,
   370  						Aliases:     []config.Alias{{Name: "maven/globalSettingsFile"}},
   371  						Default:     os.Getenv("PIPER_globalSettingsFile"),
   372  					},
   373  					{
   374  						Name:        "m2Path",
   375  						ResourceRef: []config.ResourceReference{},
   376  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   377  						Type:        "string",
   378  						Mandatory:   false,
   379  						Aliases:     []config.Alias{{Name: "maven/m2Path"}},
   380  						Default:     os.Getenv("PIPER_m2Path"),
   381  					},
   382  					{
   383  						Name:        "installArtifacts",
   384  						ResourceRef: []config.ResourceReference{},
   385  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   386  						Type:        "bool",
   387  						Mandatory:   false,
   388  						Aliases:     []config.Alias{},
   389  						Default:     false,
   390  					},
   391  					{
   392  						Name: "mtaDeploymentRepositoryPassword",
   393  						ResourceRef: []config.ResourceReference{
   394  							{
   395  								Name:  "commonPipelineEnvironment",
   396  								Param: "custom/mavenRepositoryPassword",
   397  							},
   398  
   399  							{
   400  								Name:  "commonPipelineEnvironment",
   401  								Param: "custom/repositoryPassword",
   402  							},
   403  
   404  							{
   405  								Name: "mtaDeploymentRepositoryPasswordId",
   406  								Type: "secret",
   407  							},
   408  
   409  							{
   410  								Name:    "mtaDeploymentRepositoryPasswordFileVaultSecretName",
   411  								Type:    "vaultSecretFile",
   412  								Default: "mta-deployment-repository-passowrd",
   413  							},
   414  						},
   415  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   416  						Type:      "string",
   417  						Mandatory: false,
   418  						Aliases:   []config.Alias{},
   419  						Default:   os.Getenv("PIPER_mtaDeploymentRepositoryPassword"),
   420  					},
   421  					{
   422  						Name: "mtaDeploymentRepositoryUser",
   423  						ResourceRef: []config.ResourceReference{
   424  							{
   425  								Name:  "commonPipelineEnvironment",
   426  								Param: "custom/mavenRepositoryUsername",
   427  							},
   428  
   429  							{
   430  								Name:  "commonPipelineEnvironment",
   431  								Param: "custom/repositoryUsername",
   432  							},
   433  						},
   434  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   435  						Type:      "string",
   436  						Mandatory: false,
   437  						Aliases:   []config.Alias{},
   438  						Default:   os.Getenv("PIPER_mtaDeploymentRepositoryUser"),
   439  					},
   440  					{
   441  						Name: "mtaDeploymentRepositoryUrl",
   442  						ResourceRef: []config.ResourceReference{
   443  							{
   444  								Name:  "commonPipelineEnvironment",
   445  								Param: "custom/mavenRepositoryURL",
   446  							},
   447  
   448  							{
   449  								Name:  "commonPipelineEnvironment",
   450  								Param: "custom/repositoryUrl",
   451  							},
   452  						},
   453  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   454  						Type:      "string",
   455  						Mandatory: false,
   456  						Aliases:   []config.Alias{},
   457  						Default:   os.Getenv("PIPER_mtaDeploymentRepositoryUrl"),
   458  					},
   459  					{
   460  						Name:        "publish",
   461  						ResourceRef: []config.ResourceReference{},
   462  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   463  						Type:        "bool",
   464  						Mandatory:   false,
   465  						Aliases:     []config.Alias{{Name: "mta/publish"}},
   466  						Default:     false,
   467  					},
   468  					{
   469  						Name:        "profiles",
   470  						ResourceRef: []config.ResourceReference{},
   471  						Scope:       []string{"PARAMETERS", "GENERAL", "STAGES", "STEPS"},
   472  						Type:        "[]string",
   473  						Mandatory:   false,
   474  						Aliases:     []config.Alias{},
   475  						Default:     []string{},
   476  					},
   477  					{
   478  						Name: "buildSettingsInfo",
   479  						ResourceRef: []config.ResourceReference{
   480  							{
   481  								Name:  "commonPipelineEnvironment",
   482  								Param: "custom/buildSettingsInfo",
   483  							},
   484  						},
   485  						Scope:     []string{"STEPS", "STAGES", "PARAMETERS"},
   486  						Type:      "string",
   487  						Mandatory: false,
   488  						Aliases:   []config.Alias{},
   489  						Default:   os.Getenv("PIPER_buildSettingsInfo"),
   490  					},
   491  				},
   492  			},
   493  			Containers: []config.Container{
   494  				{Image: "devxci/mbtci-java11-node14"},
   495  			},
   496  			Outputs: config.StepOutputs{
   497  				Resources: []config.StepResources{
   498  					{
   499  						Name: "commonPipelineEnvironment",
   500  						Type: "piperEnvironment",
   501  						Parameters: []map[string]interface{}{
   502  							{"name": "mtarFilePath"},
   503  							{"name": "custom/mtaBuildToolDesc"},
   504  							{"name": "custom/mtarPublishedUrl"},
   505  							{"name": "custom/buildSettingsInfo"},
   506  						},
   507  					},
   508  					{
   509  						Name: "reports",
   510  						Type: "reports",
   511  						Parameters: []map[string]interface{}{
   512  							{"filePattern": "**/TEST-*.xml", "type": "junit"},
   513  							{"filePattern": "**/cobertura-coverage.xml", "type": "cobertura-coverage"},
   514  							{"filePattern": "**/jacoco.xml", "type": "jacoco-coverage"},
   515  						},
   516  					},
   517  				},
   518  			},
   519  		},
   520  	}
   521  	return theMetaData
   522  }