braid/Jenkinsfile
2021-03-01 12:00:21 -07:00

47 lines
1.2 KiB
Groovy

def label = "node-${UUID.randomUUID().toString()}"
podTemplate(label: label, inheritFrom: 'base', , containers: [
containerTemplate(name: 'base', image: 'taylorchristieyardstick/build-base:node')
]) {
node(label) {
stage('Checkout Project') {
container('base') {
checkout scm
}
}
stage('Install Dependencies') {
container('base') {
sh "npm install"
sh "npm install typescript"
}
}
stage('Build the Project') {
container('base') {
sh "tsc"
}
}
stage('Run unit tests') {
container('base') {
sh "npm test"
}
}
stage('Login to Dockerhub') {
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
container('base') {
sh "docker login --username ${USER} --password ${PASS}"
}
}
}
stage('Build the Docker Image') {
container('base') {
sh "make build branch=${BRANCH_NAME}"
}
}
stage('Push the Docker Image') {
container('base') {
sh "make push branch=${BRANCH_NAME}"
}
}
}
}