github.com/SAP/jenkins-library@v1.362.0/cmd/mavenBuild_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 mavenBuildOptions struct {
    25  	PomPath                         string   `json:"pomPath,omitempty"`
    26  	Profiles                        []string `json:"profiles,omitempty"`
    27  	Flatten                         bool     `json:"flatten,omitempty"`
    28  	Verify                          bool     `json:"verify,omitempty"`
    29  	ProjectSettingsFile             string   `json:"projectSettingsFile,omitempty"`
    30  	GlobalSettingsFile              string   `json:"globalSettingsFile,omitempty"`
    31  	M2Path                          string   `json:"m2Path,omitempty"`
    32  	LogSuccessfulMavenTransfers     bool     `json:"logSuccessfulMavenTransfers,omitempty"`
    33  	CreateBOM                       bool     `json:"createBOM,omitempty"`
    34  	AltDeploymentRepositoryPassword string   `json:"altDeploymentRepositoryPassword,omitempty"`
    35  	AltDeploymentRepositoryUser     string   `json:"altDeploymentRepositoryUser,omitempty"`
    36  	AltDeploymentRepositoryURL      string   `json:"altDeploymentRepositoryUrl,omitempty"`
    37  	AltDeploymentRepositoryID       string   `json:"altDeploymentRepositoryID,omitempty"`
    38  	CustomTLSCertificateLinks       []string `json:"customTlsCertificateLinks,omitempty"`
    39  	Publish                         bool     `json:"publish,omitempty"`
    40  	JavaCaCertFilePath              string   `json:"javaCaCertFilePath,omitempty"`
    41  	BuildSettingsInfo               string   `json:"buildSettingsInfo,omitempty"`
    42  	DeployFlags                     []string `json:"deployFlags,omitempty"`
    43  }
    44  
    45  type mavenBuildCommonPipelineEnvironment struct {
    46  	custom struct {
    47  		buildSettingsInfo string
    48  	}
    49  }
    50  
    51  func (p *mavenBuildCommonPipelineEnvironment) persist(path, resourceName string) {
    52  	content := []struct {
    53  		category string
    54  		name     string
    55  		value    interface{}
    56  	}{
    57  		{category: "custom", name: "buildSettingsInfo", value: p.custom.buildSettingsInfo},
    58  	}
    59  
    60  	errCount := 0
    61  	for _, param := range content {
    62  		err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value)
    63  		if err != nil {
    64  			log.Entry().WithError(err).Error("Error persisting piper environment.")
    65  			errCount++
    66  		}
    67  	}
    68  	if errCount > 0 {
    69  		log.Entry().Error("failed to persist Piper environment")
    70  	}
    71  }
    72  
    73  type mavenBuildReports struct {
    74  }
    75  
    76  func (p *mavenBuildReports) persist(stepConfig mavenBuildOptions, gcpJsonKeyFilePath string, gcsBucketId string, gcsFolderPath string, gcsSubFolder string) {
    77  	if gcsBucketId == "" {
    78  		log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
    79  		return
    80  	}
    81  	log.Entry().Info("Uploading reports to Google Cloud Storage...")
    82  	content := []gcs.ReportOutputParam{
    83  		{FilePattern: "**/bom-maven.xml", ParamRef: "", StepResultType: "sbom"},
    84  		{FilePattern: "**/TEST-*.xml", ParamRef: "", StepResultType: "junit"},
    85  		{FilePattern: "**/jacoco.xml", ParamRef: "", StepResultType: "jacoco-coverage"},
    86  	}
    87  	envVars := []gcs.EnvVar{
    88  		{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: gcpJsonKeyFilePath, Modified: false},
    89  	}
    90  	gcsClient, err := gcs.NewClient(gcs.WithEnvVars(envVars))
    91  	if err != nil {
    92  		log.Entry().Errorf("creation of GCS client failed: %v", err)
    93  		return
    94  	}
    95  	defer gcsClient.Close()
    96  	structVal := reflect.ValueOf(&stepConfig).Elem()
    97  	inputParameters := map[string]string{}
    98  	for i := 0; i < structVal.NumField(); i++ {
    99  		field := structVal.Type().Field(i)
   100  		if field.Type.String() == "string" {
   101  			paramName := strings.Split(field.Tag.Get("json"), ",")
   102  			paramValue, _ := structVal.Field(i).Interface().(string)
   103  			inputParameters[paramName[0]] = paramValue
   104  		}
   105  	}
   106  	if err := gcs.PersistReportsToGCS(gcsClient, content, inputParameters, gcsFolderPath, gcsBucketId, gcsSubFolder, doublestar.Glob, os.Stat); err != nil {
   107  		log.Entry().Errorf("failed to persist reports: %v", err)
   108  	}
   109  }
   110  
   111  // MavenBuildCommand This step will install the maven project into the local maven repository.
   112  func MavenBuildCommand() *cobra.Command {
   113  	const STEP_NAME = "mavenBuild"
   114  
   115  	metadata := mavenBuildMetadata()
   116  	var stepConfig mavenBuildOptions
   117  	var startTime time.Time
   118  	var commonPipelineEnvironment mavenBuildCommonPipelineEnvironment
   119  	var reports mavenBuildReports
   120  	var logCollector *log.CollectorHook
   121  	var splunkClient *splunk.Splunk
   122  	telemetryClient := &telemetry.Telemetry{}
   123  
   124  	var createMavenBuildCmd = &cobra.Command{
   125  		Use:   STEP_NAME,
   126  		Short: "This step will install the maven project into the local maven repository.",
   127  		Long: `This step will install the maven project into the local maven repository.
   128  It will also prepare jacoco to record the code coverage and
   129  supports ci friendly versioning by flattening the pom before installing.
   130  
   131  ### build with depedencies from a private repository
   132  if your build has dependencies from a private repository you can include a project settings xml into the source code repository as below (replace the ` + "`" + `<url>` + "`" + `
   133  tag with a valid private repo url).
   134  ` + "`" + `` + "`" + `` + "`" + `xml
   135  <?xml version="1.0" encoding="UTF-8"?>
   136  <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
   137  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
   138    <servers>
   139      <server>
   140          <id>private.repo.id</id>
   141          <username>${env.PIPER_VAULTCREDENTIAL_USERNAME}</username>
   142          <password>${env.PIPER_VAULTCREDENTIAL_PASSWORD}</password>
   143      </server>
   144    </servers>
   145  </settings>
   146  ` + "`" + `` + "`" + `` + "`" + `
   147  ` + "`" + `PIPER_VAULTCREDENTIAL_USERNAME` + "`" + ` and ` + "`" + `PIPER_VAULTCREDENTIAL_PASSWORD` + "`" + ` are the username and password for the private repository and are exposed as environment variables that must be present
   148  in the environment where the Piper step runs or alternatively can be created using :
   149  [vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
   150  
   151  include the below ` + "`" + `<repositories>` + "`" + ` tag in your ` + "`" + `pom.xml` + "`" + ` to reference the ` + "`" + `<server>` + "`" + ` and make sure the values in the ` + "`" + `<id>` + "`" + ` tags match
   152  ` + "`" + `` + "`" + `` + "`" + `xml
   153  <repositories>
   154      <repository>
   155        <id>private.repo.id</id>
   156        <url>https://private.repo.com/</url>
   157      </repository>
   158  </repositories>
   159  ` + "`" + `` + "`" + `` + "`" + `
   160  
   161  Ensure the following configuration in the Piper ` + "`" + `config.yaml` + "`" + ` to ensure the above settings xml is included and all steps can consume this parameter:
   162  
   163  ` + "`" + `` + "`" + `` + "`" + `yaml
   164  general:
   165    projectSettingsFile: <path to the above settings.xml>
   166  ` + "`" + `` + "`" + `` + "`" + ``,
   167  		PreRunE: func(cmd *cobra.Command, _ []string) error {
   168  			startTime = time.Now()
   169  			log.SetStepName(STEP_NAME)
   170  			log.SetVerbose(GeneralConfig.Verbose)
   171  
   172  			GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens)
   173  
   174  			path, _ := os.Getwd()
   175  			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
   176  			log.RegisterHook(fatalHook)
   177  
   178  			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
   179  			if err != nil {
   180  				log.SetErrorCategory(log.ErrorConfiguration)
   181  				return err
   182  			}
   183  			log.RegisterSecret(stepConfig.AltDeploymentRepositoryPassword)
   184  
   185  			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
   186  				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
   187  				log.RegisterHook(&sentryHook)
   188  			}
   189  
   190  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 || len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
   191  				splunkClient = &splunk.Splunk{}
   192  				logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
   193  				log.RegisterHook(logCollector)
   194  			}
   195  
   196  			if err = log.RegisterANSHookIfConfigured(GeneralConfig.CorrelationID); err != nil {
   197  				log.Entry().WithError(err).Warn("failed to set up SAP Alert Notification Service log hook")
   198  			}
   199  
   200  			validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages())
   201  			if err != nil {
   202  				return err
   203  			}
   204  			if err = validation.ValidateStruct(stepConfig); err != nil {
   205  				log.SetErrorCategory(log.ErrorConfiguration)
   206  				return err
   207  			}
   208  
   209  			return nil
   210  		},
   211  		Run: func(_ *cobra.Command, _ []string) {
   212  			stepTelemetryData := telemetry.CustomData{}
   213  			stepTelemetryData.ErrorCode = "1"
   214  			handler := func() {
   215  				commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment")
   216  				reports.persist(stepConfig, GeneralConfig.GCPJsonKeyFilePath, GeneralConfig.GCSBucketId, GeneralConfig.GCSFolderPath, GeneralConfig.GCSSubFolder)
   217  				config.RemoveVaultSecretFiles()
   218  				stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
   219  				stepTelemetryData.ErrorCategory = log.GetErrorCategory().String()
   220  				stepTelemetryData.PiperCommitHash = GitCommit
   221  				telemetryClient.SetData(&stepTelemetryData)
   222  				telemetryClient.Send()
   223  				if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   224  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   225  						GeneralConfig.HookConfig.SplunkConfig.Dsn,
   226  						GeneralConfig.HookConfig.SplunkConfig.Token,
   227  						GeneralConfig.HookConfig.SplunkConfig.Index,
   228  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   229  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   230  				}
   231  				if len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
   232  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   233  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint,
   234  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblToken,
   235  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblIndex,
   236  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   237  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   238  				}
   239  			}
   240  			log.DeferExitHandler(handler)
   241  			defer handler()
   242  			telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME, GeneralConfig.HookConfig.PendoConfig.Token)
   243  			mavenBuild(stepConfig, &stepTelemetryData, &commonPipelineEnvironment)
   244  			stepTelemetryData.ErrorCode = "0"
   245  			log.Entry().Info("SUCCESS")
   246  		},
   247  	}
   248  
   249  	addMavenBuildFlags(createMavenBuildCmd, &stepConfig)
   250  	return createMavenBuildCmd
   251  }
   252  
   253  func addMavenBuildFlags(cmd *cobra.Command, stepConfig *mavenBuildOptions) {
   254  	cmd.Flags().StringVar(&stepConfig.PomPath, "pomPath", `pom.xml`, "Path to the pom file which should be installed including all children.")
   255  	cmd.Flags().StringSliceVar(&stepConfig.Profiles, "profiles", []string{}, "Defines list of maven build profiles to be used.")
   256  	cmd.Flags().BoolVar(&stepConfig.Flatten, "flatten", true, "Defines if the pom files should be flattened to support ci friendly maven versioning.")
   257  	cmd.Flags().BoolVar(&stepConfig.Verify, "verify", false, "Instead of installing the artifact only the verify lifecycle phase is executed.")
   258  	cmd.Flags().StringVar(&stepConfig.ProjectSettingsFile, "projectSettingsFile", os.Getenv("PIPER_projectSettingsFile"), "Path to the mvn settings file that should be used as project settings file.")
   259  	cmd.Flags().StringVar(&stepConfig.GlobalSettingsFile, "globalSettingsFile", os.Getenv("PIPER_globalSettingsFile"), "Path to the mvn settings file that should be used as global settings file.")
   260  	cmd.Flags().StringVar(&stepConfig.M2Path, "m2Path", os.Getenv("PIPER_m2Path"), "Path to the location of the local repository that should be used.")
   261  	cmd.Flags().BoolVar(&stepConfig.LogSuccessfulMavenTransfers, "logSuccessfulMavenTransfers", false, "Configures maven to log successful downloads. This is set to `false` by default to reduce the noise in build logs.")
   262  	cmd.Flags().BoolVar(&stepConfig.CreateBOM, "createBOM", false, "Creates the bill of materials (BOM) using CycloneDX Maven plugin.")
   263  	cmd.Flags().StringVar(&stepConfig.AltDeploymentRepositoryPassword, "altDeploymentRepositoryPassword", os.Getenv("PIPER_altDeploymentRepositoryPassword"), "Password for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). This password will be updated in settings.xml . When no settings.xml is provided a new one is created corresponding with <servers> tag")
   264  	cmd.Flags().StringVar(&stepConfig.AltDeploymentRepositoryUser, "altDeploymentRepositoryUser", os.Getenv("PIPER_altDeploymentRepositoryUser"), "User for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). This user will be updated in settings.xml . When no settings.xml is provided a new one is created corresponding with <servers> tag")
   265  	cmd.Flags().StringVar(&stepConfig.AltDeploymentRepositoryURL, "altDeploymentRepositoryUrl", os.Getenv("PIPER_altDeploymentRepositoryUrl"), "Url for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). This Url will be updated in settings.xml . When no settings.xml is provided a new one is created corresponding with <servers> tag")
   266  	cmd.Flags().StringVar(&stepConfig.AltDeploymentRepositoryID, "altDeploymentRepositoryID", os.Getenv("PIPER_altDeploymentRepositoryID"), "Id for the alternative deployment repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). This id will be updated in settings.xml and will be used as a flag with DaltDeploymentRepository along with mavenAltDeploymentRepositoryUrl during maven deploy . When no settings.xml is provided a new one is created corresponding with <servers> tag")
   267  	cmd.Flags().StringSliceVar(&stepConfig.CustomTLSCertificateLinks, "customTlsCertificateLinks", []string{}, "List of download links to custom TLS certificates. This is required to ensure trusted connections to instances with repositories (like nexus) when publish flag is set to true.")
   268  	cmd.Flags().BoolVar(&stepConfig.Publish, "publish", false, "Configures maven to run the deploy plugin to publish artifacts to a repository.")
   269  	cmd.Flags().StringVar(&stepConfig.JavaCaCertFilePath, "javaCaCertFilePath", os.Getenv("PIPER_javaCaCertFilePath"), "path to the cacerts file used by Java. When maven publish is set to True and customTlsCertificateLinks (to deploy the artifact to a repository with a self signed cert) are provided to trust the self signed certs, Piper will extend the existing Java cacerts to include the new self signed certs. if not provided Piper will search for the cacerts in $JAVA_HOME/jre/lib/security/cacerts")
   270  	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 maven build . This information is typically used for compliance related processes.")
   271  	cmd.Flags().StringSliceVar(&stepConfig.DeployFlags, "deployFlags", []string{`-Dmaven.main.skip=true`, `-Dmaven.test.skip=true`, `-Dmaven.install.skip=true`}, "maven deploy flags that will be used when publish is detected.")
   272  
   273  }
   274  
   275  // retrieve step metadata
   276  func mavenBuildMetadata() config.StepData {
   277  	var theMetaData = config.StepData{
   278  		Metadata: config.StepMetadata{
   279  			Name:        "mavenBuild",
   280  			Aliases:     []config.Alias{{Name: "mavenExecute", Deprecated: false}},
   281  			Description: "This step will install the maven project into the local maven repository.",
   282  		},
   283  		Spec: config.StepSpec{
   284  			Inputs: config.StepInputs{
   285  				Secrets: []config.StepSecrets{
   286  					{Name: "altDeploymentRepositoryPasswordId", Description: "Jenkins credentials ID containing the artifact deployment repository password.", Type: "jenkins"},
   287  				},
   288  				Resources: []config.StepResources{
   289  					{Type: "stash"},
   290  				},
   291  				Parameters: []config.StepParameters{
   292  					{
   293  						Name:        "pomPath",
   294  						ResourceRef: []config.ResourceReference{},
   295  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   296  						Type:        "string",
   297  						Mandatory:   false,
   298  						Aliases:     []config.Alias{},
   299  						Default:     `pom.xml`,
   300  					},
   301  					{
   302  						Name:        "profiles",
   303  						ResourceRef: []config.ResourceReference{},
   304  						Scope:       []string{"PARAMETERS", "GENERAL", "STAGES", "STEPS"},
   305  						Type:        "[]string",
   306  						Mandatory:   false,
   307  						Aliases:     []config.Alias{},
   308  						Default:     []string{},
   309  					},
   310  					{
   311  						Name:        "flatten",
   312  						ResourceRef: []config.ResourceReference{},
   313  						Scope:       []string{"PARAMETERS", "STEPS"},
   314  						Type:        "bool",
   315  						Mandatory:   false,
   316  						Aliases:     []config.Alias{},
   317  						Default:     true,
   318  					},
   319  					{
   320  						Name:        "verify",
   321  						ResourceRef: []config.ResourceReference{},
   322  						Scope:       []string{"PARAMETERS"},
   323  						Type:        "bool",
   324  						Mandatory:   false,
   325  						Aliases:     []config.Alias{},
   326  						Default:     false,
   327  					},
   328  					{
   329  						Name:        "projectSettingsFile",
   330  						ResourceRef: []config.ResourceReference{},
   331  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   332  						Type:        "string",
   333  						Mandatory:   false,
   334  						Aliases:     []config.Alias{{Name: "maven/projectSettingsFile"}},
   335  						Default:     os.Getenv("PIPER_projectSettingsFile"),
   336  					},
   337  					{
   338  						Name: "globalSettingsFile",
   339  						ResourceRef: []config.ResourceReference{
   340  							{
   341  								Name:  "commonPipelineEnvironment",
   342  								Param: "custom/mavenGlobalSettingsFile",
   343  							},
   344  						},
   345  						Scope:     []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   346  						Type:      "string",
   347  						Mandatory: false,
   348  						Aliases:   []config.Alias{{Name: "maven/globalSettingsFile"}},
   349  						Default:   os.Getenv("PIPER_globalSettingsFile"),
   350  					},
   351  					{
   352  						Name:        "m2Path",
   353  						ResourceRef: []config.ResourceReference{},
   354  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   355  						Type:        "string",
   356  						Mandatory:   false,
   357  						Aliases:     []config.Alias{{Name: "maven/m2Path"}},
   358  						Default:     os.Getenv("PIPER_m2Path"),
   359  					},
   360  					{
   361  						Name:        "logSuccessfulMavenTransfers",
   362  						ResourceRef: []config.ResourceReference{},
   363  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   364  						Type:        "bool",
   365  						Mandatory:   false,
   366  						Aliases:     []config.Alias{{Name: "maven/logSuccessfulMavenTransfers"}},
   367  						Default:     false,
   368  					},
   369  					{
   370  						Name:        "createBOM",
   371  						ResourceRef: []config.ResourceReference{},
   372  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   373  						Type:        "bool",
   374  						Mandatory:   false,
   375  						Aliases:     []config.Alias{{Name: "maven/createBOM"}},
   376  						Default:     false,
   377  					},
   378  					{
   379  						Name: "altDeploymentRepositoryPassword",
   380  						ResourceRef: []config.ResourceReference{
   381  							{
   382  								Name:  "commonPipelineEnvironment",
   383  								Param: "custom/mavenRepositoryPassword",
   384  							},
   385  
   386  							{
   387  								Name:  "commonPipelineEnvironment",
   388  								Param: "custom/repositoryPassword",
   389  							},
   390  
   391  							{
   392  								Name: "altDeploymentRepositoryPasswordId",
   393  								Type: "secret",
   394  							},
   395  
   396  							{
   397  								Name:    "altDeploymentRepositoryPasswordFileVaultSecretName",
   398  								Type:    "vaultSecretFile",
   399  								Default: "alt-deployment-repository-passowrd",
   400  							},
   401  						},
   402  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   403  						Type:      "string",
   404  						Mandatory: false,
   405  						Aliases:   []config.Alias{},
   406  						Default:   os.Getenv("PIPER_altDeploymentRepositoryPassword"),
   407  					},
   408  					{
   409  						Name: "altDeploymentRepositoryUser",
   410  						ResourceRef: []config.ResourceReference{
   411  							{
   412  								Name:  "commonPipelineEnvironment",
   413  								Param: "custom/mavenRepositoryUsername",
   414  							},
   415  
   416  							{
   417  								Name:  "commonPipelineEnvironment",
   418  								Param: "custom/repositoryUsername",
   419  							},
   420  						},
   421  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   422  						Type:      "string",
   423  						Mandatory: false,
   424  						Aliases:   []config.Alias{},
   425  						Default:   os.Getenv("PIPER_altDeploymentRepositoryUser"),
   426  					},
   427  					{
   428  						Name: "altDeploymentRepositoryUrl",
   429  						ResourceRef: []config.ResourceReference{
   430  							{
   431  								Name:  "commonPipelineEnvironment",
   432  								Param: "custom/mavenRepositoryURL",
   433  							},
   434  
   435  							{
   436  								Name:  "commonPipelineEnvironment",
   437  								Param: "custom/repositoryUrl",
   438  							},
   439  						},
   440  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   441  						Type:      "string",
   442  						Mandatory: false,
   443  						Aliases:   []config.Alias{},
   444  						Default:   os.Getenv("PIPER_altDeploymentRepositoryUrl"),
   445  					},
   446  					{
   447  						Name: "altDeploymentRepositoryID",
   448  						ResourceRef: []config.ResourceReference{
   449  							{
   450  								Name:  "commonPipelineEnvironment",
   451  								Param: "custom/repositoryId",
   452  							},
   453  						},
   454  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   455  						Type:      "string",
   456  						Mandatory: false,
   457  						Aliases:   []config.Alias{},
   458  						Default:   os.Getenv("PIPER_altDeploymentRepositoryID"),
   459  					},
   460  					{
   461  						Name:        "customTlsCertificateLinks",
   462  						ResourceRef: []config.ResourceReference{},
   463  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   464  						Type:        "[]string",
   465  						Mandatory:   false,
   466  						Aliases:     []config.Alias{},
   467  						Default:     []string{},
   468  					},
   469  					{
   470  						Name:        "publish",
   471  						ResourceRef: []config.ResourceReference{},
   472  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   473  						Type:        "bool",
   474  						Mandatory:   false,
   475  						Aliases:     []config.Alias{{Name: "maven/publish"}},
   476  						Default:     false,
   477  					},
   478  					{
   479  						Name:        "javaCaCertFilePath",
   480  						ResourceRef: []config.ResourceReference{},
   481  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   482  						Type:        "string",
   483  						Mandatory:   false,
   484  						Aliases:     []config.Alias{{Name: "maven/javaCaCertFilePath"}},
   485  						Default:     os.Getenv("PIPER_javaCaCertFilePath"),
   486  					},
   487  					{
   488  						Name: "buildSettingsInfo",
   489  						ResourceRef: []config.ResourceReference{
   490  							{
   491  								Name:  "commonPipelineEnvironment",
   492  								Param: "custom/buildSettingsInfo",
   493  							},
   494  						},
   495  						Scope:     []string{"STEPS", "STAGES", "PARAMETERS"},
   496  						Type:      "string",
   497  						Mandatory: false,
   498  						Aliases:   []config.Alias{},
   499  						Default:   os.Getenv("PIPER_buildSettingsInfo"),
   500  					},
   501  					{
   502  						Name:        "deployFlags",
   503  						ResourceRef: []config.ResourceReference{},
   504  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   505  						Type:        "[]string",
   506  						Mandatory:   false,
   507  						Aliases:     []config.Alias{},
   508  						Default:     []string{`-Dmaven.main.skip=true`, `-Dmaven.test.skip=true`, `-Dmaven.install.skip=true`},
   509  					},
   510  				},
   511  			},
   512  			Containers: []config.Container{
   513  				{Name: "mvn", Image: "maven:3.6-jdk-8"},
   514  			},
   515  			Outputs: config.StepOutputs{
   516  				Resources: []config.StepResources{
   517  					{
   518  						Name: "commonPipelineEnvironment",
   519  						Type: "piperEnvironment",
   520  						Parameters: []map[string]interface{}{
   521  							{"name": "custom/buildSettingsInfo"},
   522  						},
   523  					},
   524  					{
   525  						Name: "reports",
   526  						Type: "reports",
   527  						Parameters: []map[string]interface{}{
   528  							{"filePattern": "**/bom-maven.xml", "type": "sbom"},
   529  							{"filePattern": "**/TEST-*.xml", "type": "junit"},
   530  							{"filePattern": "**/jacoco.xml", "type": "jacoco-coverage"},
   531  						},
   532  					},
   533  				},
   534  			},
   535  		},
   536  	}
   537  	return theMetaData
   538  }