github.com/jaylevin/jenkins-library@v1.230.4/resources/metadata/npmExecuteScripts.yaml (about)

     1  metadata:
     2    name: npmExecuteScripts
     3    aliases:
     4      - name: executeNpm
     5    description: Execute npm run scripts on all npm packages in a project
     6    longDescription: |
     7      Execute npm run scripts in all package json files, if they implement the scripts.
     8  
     9      ### build with depedencies from a private repository
    10      if your build has scoped/unscoped dependencies from a private repository you can include a .npmrc into the source code
    11      repository as below (replace the `@privateScope:registry` value(s) with a valid private repo url) :
    12  
    13      ```
    14      @privateScope:registry=https://private.repository.com/
    15      //private.repository.com/:username=${PIPER_VAULTCREDENTIAL_USER}
    16      //private.repository.com/:_password=${PIPER_VAULTCREDENTIAL_PASSWORD_BASE64}
    17      //private.repository.com/:always-auth=true
    18      registry=https://registry.npmjs.org
    19      ```
    20      `PIPER_VAULTCREDENTIAL_USER` and `PIPER_VAULTCREDENTIAL_PASSWORD_BASE64` (Base64 encoded password) are the username and password for the private repository
    21      and are exposed are environment variables that must be present in the environment where the Piper step runs or alternatively can be created using :
    22      [vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
    23  spec:
    24    inputs:
    25      resources:
    26        - name: source
    27          type: stash
    28      params:
    29        - name: install
    30          type: bool
    31          description: Run npm install or similar commands depending on the project structure.
    32          scope:
    33            - PARAMETERS
    34            - STAGES
    35            - STEPS
    36          default: true
    37        - name: runScripts
    38          type: "[]string"
    39          description: List of additional run scripts to execute from package.json.
    40          scope:
    41            - PARAMETERS
    42            - STAGES
    43            - STEPS
    44        - name: defaultNpmRegistry
    45          type: string
    46          description: URL of the npm registry to use. Defaults to https://registry.npmjs.org/
    47          scope:
    48            - PARAMETERS
    49            - GENERAL
    50            - STAGES
    51            - STEPS
    52          aliases:
    53            - name: npm/defaultNpmRegistry
    54        - name: virtualFrameBuffer
    55          type: bool
    56          description: (Linux only) Start a virtual frame buffer in the background. This allows you to run a web browser without the need for an X server. Note that xvfb needs to be installed in the execution environment.
    57          scope:
    58            - PARAMETERS
    59            - STAGES
    60            - STEPS
    61        - name: scriptOptions
    62          type: "[]string"
    63          description: Options are passed to all runScripts calls separated by a '--'. './piper npmExecuteScripts --runScripts ci-e2e --scriptOptions '--tag1' will correspond to 'npm run ci-e2e -- --tag1'
    64          scope:
    65            - PARAMETERS
    66            - STAGES
    67            - STEPS
    68        - name: buildDescriptorExcludeList
    69          type: "[]string"
    70          description: List of build descriptors and therefore modules to exclude from execution of the npm scripts. The elements can either be a path to the build descriptor or a pattern.
    71          scope:
    72            - PARAMETERS
    73            - STAGES
    74            - STEPS
    75          default: ["deployment/**"]
    76        - name: buildDescriptorList
    77          type: "[]string"
    78          description: List of build descriptors and therefore modules for execution of the npm scripts. The elements have to be paths to the build descriptors. **If set, buildDescriptorExcludeList will be ignored.**
    79          scope:
    80            - PARAMETERS
    81            - STAGES
    82            - STEPS
    83        - name: createBOM
    84          type: bool
    85          description: Create a BOM xml using CycloneDX.
    86          scope:
    87            - GENERAL
    88            - STEPS
    89            - STAGES
    90            - PARAMETERS
    91          default: false
    92        - name: publish
    93          type: bool
    94          description: Configures npm to publish the artifact to a repository.
    95          scope:
    96            - STEPS
    97            - STAGES
    98            - PARAMETERS
    99        - name: repositoryUrl
   100          type: string
   101          description: Url to the repository to which the project artifacts should be published.
   102          scope:
   103            - GENERAL
   104            - PARAMETERS
   105            - STAGES
   106            - STEPS
   107          resourceRef:
   108            - name: commonPipelineEnvironment
   109              param: custom/npmRepositoryURL
   110            - name: commonPipelineEnvironment
   111              param: custom/repositoryUrl
   112        - name: repositoryPassword
   113          type: string
   114          description: Password for the repository to which the project artifacts should be published.
   115          scope:
   116            - GENERAL
   117            - PARAMETERS
   118            - STAGES
   119            - STEPS
   120          secret: true
   121          resourceRef:
   122            - name: commonPipelineEnvironment
   123              param: custom/npmRepositoryPassword
   124            - name: commonPipelineEnvironment
   125              param: custom/repositoryPassword
   126        - name: repositoryUsername
   127          type: string
   128          description: Username for the repository to which the project artifacts should be published.
   129          scope:
   130            - GENERAL
   131            - PARAMETERS
   132            - STAGES
   133            - STEPS
   134          secret: true
   135          resourceRef:
   136            - name: commonPipelineEnvironment
   137              param: custom/npmRepositoryUsername
   138            - name: commonPipelineEnvironment
   139              param: custom/repositoryUsername
   140        - name: buildSettingsInfo
   141          type: string
   142          description: build settings info is typically filled by the step automatically to create information about the build settings that were used during the npm build . This information is typically used for compliance related processes.
   143          scope:
   144            - STEPS
   145            - STAGES
   146            - PARAMETERS
   147          resourceRef:
   148            - name: commonPipelineEnvironment
   149              param: custom/buildSettingsInfo
   150        - name: packBeforePublish
   151          type: bool
   152          default: false
   153          description: used for executing npm pack first, followed by npm publish. This two step maybe required when you are building a scoped packages and have npm dependencies from the same scope
   154          scope:
   155            - STEPS
   156            - STAGES
   157            - PARAMETERS
   158    outputs:
   159      resources:
   160        - name: commonPipelineEnvironment
   161          type: piperEnvironment
   162          params:
   163            - name: custom/buildSettingsInfo
   164        - name: reports
   165          type: reports
   166          params:
   167            - filePattern: "**/bom.xml"
   168              type: sbom
   169            - filePattern: "**/TEST-*.xml"
   170              type: junit
   171            - filePattern: "**/cobertura-coverage.xml"
   172              type: cobertura-coverage
   173            - filePattern: "**/e2e/*.json"
   174              type: cucumber
   175    containers:
   176      - name: node
   177        image: node:lts-stretch