-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
32 lines (32 loc) · 1.03 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pipeline {
agent any
options {
timeout(time: 60, unit: 'MINUTES') //Aborted the pipeline if it takes more than 5 hours
buildDiscarder(logRotator(numToKeepStr: '30')) //Delete the builds older than 30
disableConcurrentBuilds() // Disable concurrent builds
timestamps() //Print the timestamps of each setp
}
stages {
// Build stage
stage('Build') {
steps {
//Delete node_modules and package-lock.json to avoid the build failure
sh 'rm -rf node_modules/ package-lock.json'
// Install required npm modules
sh 'whoami && which npm && npm install'
// Build the modules
sh 'ng build'
}
}
stage('Start') {
steps {
script{
withEnv(['JENKINS_NODE_COOKIE=dontKillMe']) {
// Run the application in background
sh "nohup ng serve &"
}
}
}
}
}
}