github.com/xgoffin/jenkins-library@v1.154.0/cmd/golangBuild_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 golangBuildOptions struct {
    25  	BuildFlags                   []string `json:"buildFlags,omitempty"`
    26  	BuildSettingsInfo            string   `json:"buildSettingsInfo,omitempty"`
    27  	CgoEnabled                   bool     `json:"cgoEnabled,omitempty"`
    28  	CoverageFormat               string   `json:"coverageFormat,omitempty" validate:"possible-values=cobertura html"`
    29  	CreateBOM                    bool     `json:"createBOM,omitempty"`
    30  	CustomTLSCertificateLinks    []string `json:"customTlsCertificateLinks,omitempty"`
    31  	ExcludeGeneratedFromCoverage bool     `json:"excludeGeneratedFromCoverage,omitempty"`
    32  	LdflagsTemplate              string   `json:"ldflagsTemplate,omitempty"`
    33  	Output                       string   `json:"output,omitempty"`
    34  	Packages                     []string `json:"packages,omitempty"`
    35  	Publish                      bool     `json:"publish,omitempty"`
    36  	TargetRepositoryPassword     string   `json:"targetRepositoryPassword,omitempty"`
    37  	TargetRepositoryUser         string   `json:"targetRepositoryUser,omitempty"`
    38  	TargetRepositoryURL          string   `json:"targetRepositoryURL,omitempty"`
    39  	ReportCoverage               bool     `json:"reportCoverage,omitempty"`
    40  	RunTests                     bool     `json:"runTests,omitempty"`
    41  	RunIntegrationTests          bool     `json:"runIntegrationTests,omitempty"`
    42  	TargetArchitectures          []string `json:"targetArchitectures,omitempty"`
    43  	TestOptions                  []string `json:"testOptions,omitempty"`
    44  	TestResultFormat             string   `json:"testResultFormat,omitempty" validate:"possible-values=junit standard"`
    45  	PrivateModules               string   `json:"privateModules,omitempty"`
    46  	PrivateModulesGitToken       string   `json:"privateModulesGitToken,omitempty"`
    47  	ArtifactVersion              string   `json:"artifactVersion,omitempty"`
    48  }
    49  
    50  type golangBuildCommonPipelineEnvironment struct {
    51  	custom struct {
    52  		buildSettingsInfo string
    53  	}
    54  }
    55  
    56  func (p *golangBuildCommonPipelineEnvironment) persist(path, resourceName string) {
    57  	content := []struct {
    58  		category string
    59  		name     string
    60  		value    interface{}
    61  	}{
    62  		{category: "custom", name: "buildSettingsInfo", value: p.custom.buildSettingsInfo},
    63  	}
    64  
    65  	errCount := 0
    66  	for _, param := range content {
    67  		err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value)
    68  		if err != nil {
    69  			log.Entry().WithError(err).Error("Error persisting piper environment.")
    70  			errCount++
    71  		}
    72  	}
    73  	if errCount > 0 {
    74  		log.Entry().Error("failed to persist Piper environment")
    75  	}
    76  }
    77  
    78  type golangBuildReports struct {
    79  }
    80  
    81  func (p *golangBuildReports) persist(stepConfig golangBuildOptions, gcpJsonKeyFilePath string, gcsBucketId string, gcsFolderPath string, gcsSubFolder string) {
    82  	if gcsBucketId == "" {
    83  		log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
    84  		return
    85  	}
    86  	log.Entry().Info("Uploading reports to Google Cloud Storage...")
    87  	content := []gcs.ReportOutputParam{
    88  		{FilePattern: "**/bom.xml", ParamRef: "", StepResultType: "sbom"},
    89  		{FilePattern: "**/TEST-*.xml", ParamRef: "", StepResultType: "junit"},
    90  		{FilePattern: "**/cobertura-coverage.xml", ParamRef: "", StepResultType: "cobertura-coverage"},
    91  	}
    92  	envVars := []gcs.EnvVar{
    93  		{Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: gcpJsonKeyFilePath, Modified: false},
    94  	}
    95  	gcsClient, err := gcs.NewClient(gcs.WithEnvVars(envVars))
    96  	if err != nil {
    97  		log.Entry().Errorf("creation of GCS client failed: %v", err)
    98  		return
    99  	}
   100  	defer gcsClient.Close()
   101  	structVal := reflect.ValueOf(&stepConfig).Elem()
   102  	inputParameters := map[string]string{}
   103  	for i := 0; i < structVal.NumField(); i++ {
   104  		field := structVal.Type().Field(i)
   105  		if field.Type.String() == "string" {
   106  			paramName := strings.Split(field.Tag.Get("json"), ",")
   107  			paramValue, _ := structVal.Field(i).Interface().(string)
   108  			inputParameters[paramName[0]] = paramValue
   109  		}
   110  	}
   111  	if err := gcs.PersistReportsToGCS(gcsClient, content, inputParameters, gcsFolderPath, gcsBucketId, gcsSubFolder, doublestar.Glob, os.Stat); err != nil {
   112  		log.Entry().Errorf("failed to persist reports: %v", err)
   113  	}
   114  }
   115  
   116  // GolangBuildCommand This step will execute a golang build.
   117  func GolangBuildCommand() *cobra.Command {
   118  	const STEP_NAME = "golangBuild"
   119  
   120  	metadata := golangBuildMetadata()
   121  	var stepConfig golangBuildOptions
   122  	var startTime time.Time
   123  	var commonPipelineEnvironment golangBuildCommonPipelineEnvironment
   124  	var reports golangBuildReports
   125  	var logCollector *log.CollectorHook
   126  	var splunkClient *splunk.Splunk
   127  	telemetryClient := &telemetry.Telemetry{}
   128  
   129  	var createGolangBuildCmd = &cobra.Command{
   130  		Use:   STEP_NAME,
   131  		Short: "This step will execute a golang build.",
   132  		Long: `This step will build a golang project.
   133  It will also execute golang-based tests using [gotestsum](https://github.com/gotestyourself/gotestsum) and with that allows for reporting test results and test coverage.
   134  
   135  Besides execution of the default tests the step allows for running an additional integration test run using ` + "`" + `-tags=integration` + "`" + ` using pattern ` + "`" + `./...` + "`" + `
   136  
   137  If the build is successful the resulting artifact can be uploaded to e.g. a binary repository automatically.`,
   138  		PreRunE: func(cmd *cobra.Command, _ []string) error {
   139  			startTime = time.Now()
   140  			log.SetStepName(STEP_NAME)
   141  			log.SetVerbose(GeneralConfig.Verbose)
   142  
   143  			GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens)
   144  
   145  			path, _ := os.Getwd()
   146  			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
   147  			log.RegisterHook(fatalHook)
   148  
   149  			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
   150  			if err != nil {
   151  				log.SetErrorCategory(log.ErrorConfiguration)
   152  				return err
   153  			}
   154  			log.RegisterSecret(stepConfig.TargetRepositoryPassword)
   155  			log.RegisterSecret(stepConfig.TargetRepositoryUser)
   156  			log.RegisterSecret(stepConfig.PrivateModulesGitToken)
   157  
   158  			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
   159  				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
   160  				log.RegisterHook(&sentryHook)
   161  			}
   162  
   163  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   164  				splunkClient = &splunk.Splunk{}
   165  				logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
   166  				log.RegisterHook(logCollector)
   167  			}
   168  
   169  			validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages())
   170  			if err != nil {
   171  				return err
   172  			}
   173  			if err = validation.ValidateStruct(stepConfig); err != nil {
   174  				log.SetErrorCategory(log.ErrorConfiguration)
   175  				return err
   176  			}
   177  
   178  			return nil
   179  		},
   180  		Run: func(_ *cobra.Command, _ []string) {
   181  			stepTelemetryData := telemetry.CustomData{}
   182  			stepTelemetryData.ErrorCode = "1"
   183  			handler := func() {
   184  				commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment")
   185  				reports.persist(stepConfig, GeneralConfig.GCPJsonKeyFilePath, GeneralConfig.GCSBucketId, GeneralConfig.GCSFolderPath, GeneralConfig.GCSSubFolder)
   186  				config.RemoveVaultSecretFiles()
   187  				stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
   188  				stepTelemetryData.ErrorCategory = log.GetErrorCategory().String()
   189  				stepTelemetryData.PiperCommitHash = GitCommit
   190  				telemetryClient.SetData(&stepTelemetryData)
   191  				telemetryClient.Send()
   192  				if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   193  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   194  				}
   195  			}
   196  			log.DeferExitHandler(handler)
   197  			defer handler()
   198  			telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
   199  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   200  				splunkClient.Initialize(GeneralConfig.CorrelationID,
   201  					GeneralConfig.HookConfig.SplunkConfig.Dsn,
   202  					GeneralConfig.HookConfig.SplunkConfig.Token,
   203  					GeneralConfig.HookConfig.SplunkConfig.Index,
   204  					GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   205  			}
   206  			golangBuild(stepConfig, &stepTelemetryData, &commonPipelineEnvironment)
   207  			stepTelemetryData.ErrorCode = "0"
   208  			log.Entry().Info("SUCCESS")
   209  		},
   210  	}
   211  
   212  	addGolangBuildFlags(createGolangBuildCmd, &stepConfig)
   213  	return createGolangBuildCmd
   214  }
   215  
   216  func addGolangBuildFlags(cmd *cobra.Command, stepConfig *golangBuildOptions) {
   217  	cmd.Flags().StringSliceVar(&stepConfig.BuildFlags, "buildFlags", []string{}, "Defines list of build flags to be used.")
   218  	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.")
   219  	cmd.Flags().BoolVar(&stepConfig.CgoEnabled, "cgoEnabled", false, "If active: enables the creation of Go packages that call C code.")
   220  	cmd.Flags().StringVar(&stepConfig.CoverageFormat, "coverageFormat", `html`, "Defines the format of the coverage repository.")
   221  	cmd.Flags().BoolVar(&stepConfig.CreateBOM, "createBOM", false, "Creates the bill of materials (BOM) using CycloneDX plugin. It requires Go 1.17 or newer.")
   222  	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.")
   223  	cmd.Flags().BoolVar(&stepConfig.ExcludeGeneratedFromCoverage, "excludeGeneratedFromCoverage", true, "Defines if generated files should be excluded, according to [https://golang.org/s/generatedcode](https://golang.org/s/generatedcode).")
   224  	cmd.Flags().StringVar(&stepConfig.LdflagsTemplate, "ldflagsTemplate", os.Getenv("PIPER_ldflagsTemplate"), "Defines the content of -ldflags option in a golang template format.")
   225  	cmd.Flags().StringVar(&stepConfig.Output, "output", os.Getenv("PIPER_output"), "Defines the build result or output directory as per `go build` documentation.")
   226  	cmd.Flags().StringSliceVar(&stepConfig.Packages, "packages", []string{}, "List of packages to be build as per `go build` documentation.")
   227  	cmd.Flags().BoolVar(&stepConfig.Publish, "publish", false, "Configures the build to publish artifacts to a repository.")
   228  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryPassword, "targetRepositoryPassword", os.Getenv("PIPER_targetRepositoryPassword"), "Password for the target repository where the compiled binaries shall be uploaded - typically provided by the CI/CD environment.")
   229  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryUser, "targetRepositoryUser", os.Getenv("PIPER_targetRepositoryUser"), "Username for the target repository where the compiled binaries shall be uploaded - typically provided by the CI/CD environment.")
   230  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryURL, "targetRepositoryURL", os.Getenv("PIPER_targetRepositoryURL"), "URL of the target repository where the compiled binaries shall be uploaded - typically provided by the CI/CD environment.")
   231  	cmd.Flags().BoolVar(&stepConfig.ReportCoverage, "reportCoverage", true, "Defines if a coverage report should be created.")
   232  	cmd.Flags().BoolVar(&stepConfig.RunTests, "runTests", true, "Activates execution of tests using [gotestsum](https://github.com/gotestyourself/gotestsum).")
   233  	cmd.Flags().BoolVar(&stepConfig.RunIntegrationTests, "runIntegrationTests", false, "Activates execution of a second test run using tag `integration`.")
   234  	cmd.Flags().StringSliceVar(&stepConfig.TargetArchitectures, "targetArchitectures", []string{`linux,amd64`}, "Defines the target architectures for which the build should run using OS and architecture separated by a comma.")
   235  	cmd.Flags().StringSliceVar(&stepConfig.TestOptions, "testOptions", []string{}, "Options to pass to test as per `go test` documentation (comprises e.g. flags, packages).")
   236  	cmd.Flags().StringVar(&stepConfig.TestResultFormat, "testResultFormat", `junit`, "Defines the output format of the test results.")
   237  	cmd.Flags().StringVar(&stepConfig.PrivateModules, "privateModules", os.Getenv("PIPER_privateModules"), "Tells go which modules shall be considered to be private (by setting [GOPRIVATE](https://pkg.go.dev/cmd/go#hdr-Configuration_for_downloading_non_public_code)).")
   238  	cmd.Flags().StringVar(&stepConfig.PrivateModulesGitToken, "privateModulesGitToken", os.Getenv("PIPER_privateModulesGitToken"), "GitHub personal access token as per https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line.")
   239  	cmd.Flags().StringVar(&stepConfig.ArtifactVersion, "artifactVersion", os.Getenv("PIPER_artifactVersion"), "Version of the artifact to be built.")
   240  
   241  	cmd.MarkFlagRequired("targetArchitectures")
   242  }
   243  
   244  // retrieve step metadata
   245  func golangBuildMetadata() config.StepData {
   246  	var theMetaData = config.StepData{
   247  		Metadata: config.StepMetadata{
   248  			Name:        "golangBuild",
   249  			Aliases:     []config.Alias{},
   250  			Description: "This step will execute a golang build.",
   251  		},
   252  		Spec: config.StepSpec{
   253  			Inputs: config.StepInputs{
   254  				Secrets: []config.StepSecrets{
   255  					{Name: "golangPrivateModulesGitTokenCredentialsId", Description: "Jenkins 'Username with password' credentials ID containing username/password for http access to your git repos where your go private modules are stored.", Type: "jenkins"},
   256  				},
   257  				Parameters: []config.StepParameters{
   258  					{
   259  						Name:        "buildFlags",
   260  						ResourceRef: []config.ResourceReference{},
   261  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   262  						Type:        "[]string",
   263  						Mandatory:   false,
   264  						Aliases:     []config.Alias{},
   265  						Default:     []string{},
   266  					},
   267  					{
   268  						Name: "buildSettingsInfo",
   269  						ResourceRef: []config.ResourceReference{
   270  							{
   271  								Name:  "commonPipelineEnvironment",
   272  								Param: "custom/buildSettingsInfo",
   273  							},
   274  						},
   275  						Scope:     []string{"STEPS", "STAGES", "PARAMETERS"},
   276  						Type:      "string",
   277  						Mandatory: false,
   278  						Aliases:   []config.Alias{},
   279  						Default:   os.Getenv("PIPER_buildSettingsInfo"),
   280  					},
   281  					{
   282  						Name:        "cgoEnabled",
   283  						ResourceRef: []config.ResourceReference{},
   284  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   285  						Type:        "bool",
   286  						Mandatory:   false,
   287  						Aliases:     []config.Alias{},
   288  						Default:     false,
   289  					},
   290  					{
   291  						Name:        "coverageFormat",
   292  						ResourceRef: []config.ResourceReference{},
   293  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   294  						Type:        "string",
   295  						Mandatory:   false,
   296  						Aliases:     []config.Alias{},
   297  						Default:     `html`,
   298  					},
   299  					{
   300  						Name:        "createBOM",
   301  						ResourceRef: []config.ResourceReference{},
   302  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   303  						Type:        "bool",
   304  						Mandatory:   false,
   305  						Aliases:     []config.Alias{},
   306  						Default:     false,
   307  					},
   308  					{
   309  						Name:        "customTlsCertificateLinks",
   310  						ResourceRef: []config.ResourceReference{},
   311  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   312  						Type:        "[]string",
   313  						Mandatory:   false,
   314  						Aliases:     []config.Alias{},
   315  						Default:     []string{},
   316  					},
   317  					{
   318  						Name:        "excludeGeneratedFromCoverage",
   319  						ResourceRef: []config.ResourceReference{},
   320  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   321  						Type:        "bool",
   322  						Mandatory:   false,
   323  						Aliases:     []config.Alias{},
   324  						Default:     true,
   325  					},
   326  					{
   327  						Name:        "ldflagsTemplate",
   328  						ResourceRef: []config.ResourceReference{},
   329  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   330  						Type:        "string",
   331  						Mandatory:   false,
   332  						Aliases:     []config.Alias{},
   333  						Default:     os.Getenv("PIPER_ldflagsTemplate"),
   334  					},
   335  					{
   336  						Name:        "output",
   337  						ResourceRef: []config.ResourceReference{},
   338  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   339  						Type:        "string",
   340  						Mandatory:   false,
   341  						Aliases:     []config.Alias{},
   342  						Default:     os.Getenv("PIPER_output"),
   343  					},
   344  					{
   345  						Name:        "packages",
   346  						ResourceRef: []config.ResourceReference{},
   347  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   348  						Type:        "[]string",
   349  						Mandatory:   false,
   350  						Aliases:     []config.Alias{},
   351  						Default:     []string{},
   352  					},
   353  					{
   354  						Name:        "publish",
   355  						ResourceRef: []config.ResourceReference{},
   356  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   357  						Type:        "bool",
   358  						Mandatory:   false,
   359  						Aliases:     []config.Alias{},
   360  						Default:     false,
   361  					},
   362  					{
   363  						Name: "targetRepositoryPassword",
   364  						ResourceRef: []config.ResourceReference{
   365  							{
   366  								Name:  "commonPipelineEnvironment",
   367  								Param: "custom/rawRepositoryPassword",
   368  							},
   369  
   370  							{
   371  								Name:  "commonPipelineEnvironment",
   372  								Param: "custom/repositoryPassword",
   373  							},
   374  						},
   375  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   376  						Type:      "string",
   377  						Mandatory: false,
   378  						Aliases:   []config.Alias{},
   379  						Default:   os.Getenv("PIPER_targetRepositoryPassword"),
   380  					},
   381  					{
   382  						Name: "targetRepositoryUser",
   383  						ResourceRef: []config.ResourceReference{
   384  							{
   385  								Name:  "commonPipelineEnvironment",
   386  								Param: "custom/rawRepositoryUsername",
   387  							},
   388  
   389  							{
   390  								Name:  "commonPipelineEnvironment",
   391  								Param: "custom/repositoryUsername",
   392  							},
   393  						},
   394  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   395  						Type:      "string",
   396  						Mandatory: false,
   397  						Aliases:   []config.Alias{},
   398  						Default:   os.Getenv("PIPER_targetRepositoryUser"),
   399  					},
   400  					{
   401  						Name: "targetRepositoryURL",
   402  						ResourceRef: []config.ResourceReference{
   403  							{
   404  								Name:  "commonPipelineEnvironment",
   405  								Param: "custom/rawRepositoryURL",
   406  							},
   407  
   408  							{
   409  								Name:  "commonPipelineEnvironment",
   410  								Param: "custom/repositoryUrl",
   411  							},
   412  						},
   413  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   414  						Type:      "string",
   415  						Mandatory: false,
   416  						Aliases:   []config.Alias{},
   417  						Default:   os.Getenv("PIPER_targetRepositoryURL"),
   418  					},
   419  					{
   420  						Name:        "reportCoverage",
   421  						ResourceRef: []config.ResourceReference{},
   422  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   423  						Type:        "bool",
   424  						Mandatory:   false,
   425  						Aliases:     []config.Alias{},
   426  						Default:     true,
   427  					},
   428  					{
   429  						Name:        "runTests",
   430  						ResourceRef: []config.ResourceReference{},
   431  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   432  						Type:        "bool",
   433  						Mandatory:   false,
   434  						Aliases:     []config.Alias{},
   435  						Default:     true,
   436  					},
   437  					{
   438  						Name:        "runIntegrationTests",
   439  						ResourceRef: []config.ResourceReference{},
   440  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   441  						Type:        "bool",
   442  						Mandatory:   false,
   443  						Aliases:     []config.Alias{},
   444  						Default:     false,
   445  					},
   446  					{
   447  						Name:        "targetArchitectures",
   448  						ResourceRef: []config.ResourceReference{},
   449  						Scope:       []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"},
   450  						Type:        "[]string",
   451  						Mandatory:   true,
   452  						Aliases:     []config.Alias{},
   453  						Default:     []string{`linux,amd64`},
   454  					},
   455  					{
   456  						Name:        "testOptions",
   457  						ResourceRef: []config.ResourceReference{},
   458  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   459  						Type:        "[]string",
   460  						Mandatory:   false,
   461  						Aliases:     []config.Alias{},
   462  						Default:     []string{},
   463  					},
   464  					{
   465  						Name:        "testResultFormat",
   466  						ResourceRef: []config.ResourceReference{},
   467  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   468  						Type:        "string",
   469  						Mandatory:   false,
   470  						Aliases:     []config.Alias{},
   471  						Default:     `junit`,
   472  					},
   473  					{
   474  						Name:        "privateModules",
   475  						ResourceRef: []config.ResourceReference{},
   476  						Scope:       []string{"STEPS", "STAGES", "PARAMETERS"},
   477  						Type:        "string",
   478  						Mandatory:   false,
   479  						Aliases:     []config.Alias{},
   480  						Default:     os.Getenv("PIPER_privateModules"),
   481  					},
   482  					{
   483  						Name: "privateModulesGitToken",
   484  						ResourceRef: []config.ResourceReference{
   485  							{
   486  								Name: "golangPrivateModulesGitTokenCredentialsId",
   487  								Type: "secret",
   488  							},
   489  
   490  							{
   491  								Name:    "golangPrivateModulesGitTokenVaultSecret",
   492  								Type:    "vaultSecret",
   493  								Default: "golang",
   494  							},
   495  						},
   496  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   497  						Type:      "string",
   498  						Mandatory: false,
   499  						Aliases:   []config.Alias{},
   500  						Default:   os.Getenv("PIPER_privateModulesGitToken"),
   501  					},
   502  					{
   503  						Name: "artifactVersion",
   504  						ResourceRef: []config.ResourceReference{
   505  							{
   506  								Name:  "commonPipelineEnvironment",
   507  								Param: "artifactVersion",
   508  							},
   509  						},
   510  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   511  						Type:      "string",
   512  						Mandatory: false,
   513  						Aliases:   []config.Alias{},
   514  						Default:   os.Getenv("PIPER_artifactVersion"),
   515  					},
   516  				},
   517  			},
   518  			Containers: []config.Container{
   519  				{Name: "golang", Image: "golang:1", Options: []config.Option{{Name: "-u", Value: "0"}}},
   520  			},
   521  			Outputs: config.StepOutputs{
   522  				Resources: []config.StepResources{
   523  					{
   524  						Name: "commonPipelineEnvironment",
   525  						Type: "piperEnvironment",
   526  						Parameters: []map[string]interface{}{
   527  							{"name": "custom/buildSettingsInfo"},
   528  						},
   529  					},
   530  					{
   531  						Name: "reports",
   532  						Type: "reports",
   533  						Parameters: []map[string]interface{}{
   534  							{"filePattern": "**/bom.xml", "type": "sbom"},
   535  							{"filePattern": "**/TEST-*.xml", "type": "junit"},
   536  							{"filePattern": "**/cobertura-coverage.xml", "type": "cobertura-coverage"},
   537  						},
   538  					},
   539  				},
   540  			},
   541  		},
   542  	}
   543  	return theMetaData
   544  }