tf-a-commitlint: `nvm use` -> `nvm install`
NVM won't use the version specified unless it is already installed. When
we move to the next LTS then it won't be installed because the TF-A
Dockerfile only uses 14 (which is end-of-life April 2023).
On the other hand, `nvm install` will automatically run `nvm use` once
installation is complete.
Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: Ife2e0936df261ebfcdbb1989b0865d91b7fefd49
diff --git a/tf-a-commitlint/Jenkinsfile b/tf-a-commitlint/Jenkinsfile
index be56694..2cb5829 100644
--- a/tf-a-commitlint/Jenkinsfile
+++ b/tf-a-commitlint/Jenkinsfile
@@ -44,7 +44,12 @@
stage('Lint') {
steps {
- sh "BASH_ENV=$NVM_DIR/nvm.sh bash -c '[ -f .nvmrc ] && nvm use'"
+ script {
+ if (fileExists('.nvmrc')) {
+ sh "BASH_ENV=$NVM_DIR/nvm.sh bash -c 'nvm install'"
+ }
+ }
+
sh "BASH_ENV=$NVM_DIR/nvm.sh bash -c 'npm install --no-save commitlint'"
sh "BASH_ENV=$NVM_DIR/nvm.sh bash -c 'npx commitlint --from=${mergeBase}'"
}