2020-04-24 18:29:30 +02:00
metadata :
name : npmExecuteScripts
aliases :
- name : executeNpm
description : Execute npm run scripts on all npm packages in a project
longDescription : |
Execute npm run scripts in all package json files, if they implement the scripts.
2022-02-01 21:32:05 +02:00
### build with depedencies from a private repository
2022-02-02 23:37:48 +02:00
if your build has scoped/unscoped dependencies from a private repository you can include a .npmrc into the source code
repository as below (replace the `@privateScope:registry` value(s) with a valid private repo url) :
2022-02-01 21:32:05 +02:00
```
@privateScope:registry=https://private.repository.com/
2022-02-28 16:08:49 +02:00
//private.repository.com/:username=${PIPER_VAULTCREDENTIAL_USER}
//private.repository.com/:_password=${PIPER_VAULTCREDENTIAL_PASSWORD_BASE64}
2022-02-01 21:32:05 +02:00
//private.repository.com/:always-auth=true
registry=https://registry.npmjs.org
```
2022-02-28 16:08:49 +02:00
`PIPER_VAULTCREDENTIAL_USER` and `PIPER_VAULTCREDENTIAL_PASSWORD_BASE64` (Base64 encoded password) are the username and password for the private repository
2022-02-01 21:32:05 +02:00
and are exposed are environment variables that must be present in the environment where the Piper step runs or alternatively can be created using :
[ vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
2020-04-24 18:29:30 +02:00
spec :
inputs :
2020-10-30 10:25:26 +02:00
resources :
2020-10-30 16:33:13 +02:00
- name : source
2020-10-30 10:25:26 +02:00
type : stash
2020-04-24 18:29:30 +02:00
params :
- name : install
type : bool
description : Run npm install or similar commands depending on the project structure.
scope :
- PARAMETERS
- STAGES
- STEPS
2020-11-13 14:01:02 +02:00
default : true
2020-04-24 18:29:30 +02:00
- name : runScripts
2020-08-31 16:10:28 +02:00
type : "[]string"
2020-04-24 18:29:30 +02:00
description : List of additional run scripts to execute from package.json.
scope :
- PARAMETERS
- STAGES
- STEPS
- name : defaultNpmRegistry
type : string
description : URL of the npm registry to use. Defaults to https://registry.npmjs.org/
scope :
- PARAMETERS
2020-06-18 17:30:17 +02:00
- GENERAL
2020-04-24 18:29:30 +02:00
- STAGES
- STEPS
2020-06-18 17:30:17 +02:00
aliases :
- name : npm/defaultNpmRegistry
2020-06-16 11:42:51 +02:00
- name : virtualFrameBuffer
type : bool
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.
scope :
- PARAMETERS
- STAGES
- STEPS
2020-07-09 14:57:41 +02:00
- name : scriptOptions
2020-08-31 16:10:28 +02:00
type : "[]string"
2020-07-09 14:57:41 +02:00
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'
scope :
- PARAMETERS
- STAGES
- STEPS
2020-07-16 17:16:55 +02:00
- name : buildDescriptorExcludeList
2020-08-31 16:10:28 +02:00
type : "[]string"
2020-07-16 17:16:55 +02:00
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.
scope :
- PARAMETERS
- STAGES
- STEPS
default : [ "deployment/**" ]
2020-11-04 17:20:26 +02:00
- name : buildDescriptorList
type : "[]string"
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.**
scope :
- PARAMETERS
- STAGES
- STEPS
2021-03-04 11:16:59 +02:00
- name : createBOM
type : bool
description : Create a BOM xml using CycloneDX.
scope :
- GENERAL
- STEPS
- STAGES
- PARAMETERS
default : false
2021-07-15 14:46:04 +02:00
- name : publish
type : bool
description : Configures npm to publish the artifact to a repository.
scope :
- STEPS
- STAGES
- PARAMETERS
- name : repositoryUrl
type : string
description : Url to the repository to which the project artifacts should be published.
scope :
- GENERAL
- PARAMETERS
- STAGES
- STEPS
resourceRef :
2022-03-17 09:01:00 +02:00
- name : commonPipelineEnvironment
param : custom/npmRepositoryURL
2021-07-15 14:46:04 +02:00
- name : commonPipelineEnvironment
param : custom/repositoryUrl
- name : repositoryPassword
type : string
description : Password for the repository to which the project artifacts should be published.
scope :
- GENERAL
- PARAMETERS
- STAGES
- STEPS
secret : true
resourceRef :
2022-03-17 09:01:00 +02:00
- name : commonPipelineEnvironment
param : custom/npmRepositoryPassword
2021-07-15 14:46:04 +02:00
- name : commonPipelineEnvironment
param : custom/repositoryPassword
- name : repositoryUsername
type : string
description : Username for the repository to which the project artifacts should be published.
scope :
- GENERAL
- PARAMETERS
- STAGES
- STEPS
secret : true
resourceRef :
2022-03-17 09:01:00 +02:00
- name : commonPipelineEnvironment
param : custom/npmRepositoryUsername
2021-07-15 14:46:04 +02:00
- name : commonPipelineEnvironment
param : custom/repositoryUsername
2021-11-16 16:02:57 +02:00
- name : buildSettingsInfo
type : string
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.
scope :
- STEPS
- STAGES
- PARAMETERS
resourceRef :
- name : commonPipelineEnvironment
param : custom/buildSettingsInfo
2022-01-25 10:52:22 +02:00
- name : packBeforePublish
type : bool
default : false
2022-02-28 16:08:49 +02:00
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
2022-01-25 10:52:22 +02:00
scope :
- STEPS
- STAGES
- PARAMETERS
2021-11-16 16:02:57 +02:00
outputs :
resources :
- name : commonPipelineEnvironment
type : piperEnvironment
params :
- name : custom/buildSettingsInfo
2022-02-21 11:01:14 +02:00
- name : reports
type : reports
params :
2022-08-01 13:38:49 +02:00
- filePattern : "**/bom-npm.xml"
2022-02-21 11:01:14 +02:00
type : sbom
- filePattern : "**/TEST-*.xml"
type : junit
- filePattern : "**/cobertura-coverage.xml"
type : cobertura-coverage
- filePattern : "**/e2e/*.json"
type : cucumber
2020-04-24 18:29:30 +02:00
containers :
- name : node
2022-09-26 14:40:55 +02:00
image : node:lts-buster