1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

add jobs param for mtaBuild (#3175)

* add jobs parameter

* add jobs param

* fix j= 8 to j=8

* m=verbose

* add param separately

* chore

* chore

* Delete init_unix.go

* spaces

* feeback from Anil

* max 8

Co-authored-by: Anil Keshav <anil.keshav@sap.com>
This commit is contained in:
Andre 2021-10-20 16:03:16 +02:00 committed by GitHub
parent b1b19dcace
commit f761c2b806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 11 deletions

View File

@ -1,11 +0,0 @@
// +build !windows
package cmd
import "syscall"
func init() {
// unset umask otherwise permissions on file or directory
// creation are altered in unpredictable ways.
syscall.Umask(0)
}

View File

@ -8,6 +8,7 @@ import (
"net/http"
"os"
"path"
"strconv"
"strings"
"text/template"
"time"
@ -208,6 +209,11 @@ func runMtaBuild(config mtaBuildOptions,
call = append(call, "--target", "./")
}
if config.Jobs > 0 {
call = append(call, "--mode=verbose")
call = append(call, "--jobs="+strconv.Itoa(config.Jobs))
}
if err = addNpmBinToPath(utils); err != nil {
return err
}

View File

@ -22,6 +22,7 @@ type mtaBuildOptions struct {
MtarGroup string `json:"mtarGroup,omitempty"`
Version string `json:"version,omitempty"`
Extensions string `json:"extensions,omitempty"`
Jobs int `json:"jobs,omitempty"`
Platform string `json:"platform,omitempty" validate:"oneof=CF NEO XSA"`
ApplicationName string `json:"applicationName,omitempty"`
Source string `json:"source,omitempty"`
@ -159,6 +160,7 @@ func addMtaBuildFlags(cmd *cobra.Command, stepConfig *mtaBuildOptions) {
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.")
cmd.Flags().StringVar(&stepConfig.Version, "version", os.Getenv("PIPER_version"), "Version of the mtar artifact")
cmd.Flags().StringVar(&stepConfig.Extensions, "extensions", os.Getenv("PIPER_extensions"), "The path to the extension descriptor file.")
cmd.Flags().IntVar(&stepConfig.Jobs, "jobs", 0, "Configures the number of Make jobs that can run simultaneously. Maximum value allowed is 8")
cmd.Flags().StringVar(&stepConfig.Platform, "platform", `CF`, "The target platform to which the mtar can be deployed.")
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.")
cmd.Flags().StringVar(&stepConfig.Source, "source", `./`, "The path to the MTA project.")
@ -228,6 +230,15 @@ func mtaBuildMetadata() config.StepData {
Aliases: []config.Alias{{Name: "extension"}},
Default: os.Getenv("PIPER_extensions"),
},
{
Name: "jobs",
ResourceRef: []config.ResourceReference{},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "int",
Mandatory: false,
Aliases: []config.Alias{{Name: "jobs"}},
Default: 0,
},
{
Name: "platform",
ResourceRef: []config.ResourceReference{},

View File

@ -47,6 +47,17 @@ spec:
default:
aliases:
- name: extension
- name: jobs
type: int
description: "Configures the number of Make jobs that can run simultaneously. Maximum value allowed is 8"
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: false
default:
aliases:
- name: jobs
- name: platform
type: string
description: "The target platform to which the mtar can be deployed."