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