pipeline {
agent any // with hosted env use agent { label env.JOB_NAME.split('/')[0] }
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
timeout(time: 10, unit: 'MINUTES')
timestamps() // Timestamper Plugin
}
environment {
NVM_HOME = tool('nvm')
}
stages {
stage('Build') {
steps {
sh """#!/bin/bash +x
source \${HOME}/.nvm/nvm.sh
nvm install 4
node --version
"""
}
}
}
}
Add additional Node.js lab with tests and artifact archiving.
Write a custom step to move the above boilerplate code into a shared library.
End of Lab 16