Jenkins
Jenkinsfile
A Jenkinsfile
is a text file that contains the definition of a Jenkins Pipeline and is checked into source control.
Sample Jenkinsfile
for Angular application. Taken from here
pipeline{
agent { label 'nodejs8' }
stages{
stage ('checkout'){
steps{
checkout scm
}
}
stage ('install modules'){
steps{
sh '''
npm install --verbose -d
npm install --save classlist.js
'''
}
}
stage ('test'){
steps{
sh '''
$(npm bin)/ng test --single-run --browsers Chrome_no_sandbox
'''
}
post {
always {
junit "test-results.xml"
}
}
}
stage ('code quality'){
steps{
sh '$(npm bin)/ng lint'
}
}
stage ('build') {
steps{
sh '$(npm bin)/ng build --prod --build-optimizer'
}
}
stage ('build image') {
steps{
sh '''
rm -rf node_modules
oc start-build angular-5-example --from-dir=. --follow
'''
}
}
}
}