Skip to content
This repository was archived by the owner on Mar 25, 2023. It is now read-only.

Commit 470282b

Browse files
authored
Merge pull request #18 from petenorth/declarative_pipelines
Declarative pipelines
2 parents 3c03c71 + 0f8bac5 commit 470282b

File tree

2 files changed

+50
-31
lines changed

2 files changed

+50
-31
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ IMPORTANT - the minishift instance must be started using version 3.7 (the defaul
2626
tar -zxvf oc.tar.gz
2727
cp oc ~/.minishift/cache/oc/v3.6.173.0.21
2828
minishift start --ocp-tag v3.7.9
29+
oc login -u system:admin
30+
oc tag --source=docker openshift3/jenkins-2-rhel7:v3.7 openshift/jenkins:2
31+
oc login -u developer -p developer
32+
33+
The tag command ensures that the 3.7 version of the Openshift Jenkins image is used rather than one tagged latest (which can be a v3.6 image if a bug has been fixed in the 3.6 image for instance). The v3.7 version of the Jenkins image has a version of the pipeline plugin which supports the declarative syntax, v3.6 does not .
2934

3035
### Angular CLI (only if further development of the application will occur)
3136

jenkins/Jenkinsfile

+45-31
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
1-
node('nodejs8') {
2-
stage ('checkout') {
3-
checkout scm
4-
}
5-
stage ('install modules'){
6-
sh '''
7-
npm install --verbose -d
8-
npm install --save classlist.js
9-
'''
10-
}
11-
try{
12-
stage ('test') {
13-
sh '''
14-
ls -l /opt/google/chrome/chrome-sandbox
15-
$(npm bin)/ng test --single-run --browsers Chrome_no_sandbox
16-
'''
1+
pipeline{
2+
agent { label 'nodejs8' }
3+
stages{
4+
stage ('checkout'){
5+
steps{
6+
checkout scm
7+
}
8+
}
9+
stage ('install modules'){
10+
steps{
11+
sh '''
12+
npm install --verbose -d
13+
npm install --save classlist.js
14+
'''
15+
}
16+
}
17+
stage ('test'){
18+
steps{
19+
sh '''
20+
$(npm bin)/ng test --single-run --browsers Chrome_no_sandbox
21+
'''
22+
}
23+
post {
24+
always {
25+
junit "test-results.xml"
26+
}
27+
}
28+
}
29+
stage ('code quality'){
30+
steps{
31+
sh '$(npm bin)/ng lint'
32+
}
33+
}
34+
stage ('build') {
35+
steps{
36+
sh '$(npm bin)/ng build --prod --build-optimizer'
37+
}
38+
}
39+
stage ('build image') {
40+
steps{
41+
sh '''
42+
rm -rf node_modules
43+
oc start-build angular-5-example --from-dir=. --follow
44+
'''
45+
}
1746
}
18-
} finally {
19-
junit "test-results.xml"
20-
}
21-
stage ('code quality'){
22-
sh '$(npm bin)/ng lint'
23-
}
24-
stage ('build') {
25-
sh '$(npm bin)/ng build --prod --build-optimizer'
26-
}
27-
stage ('build image') {
28-
sh '''
29-
rm -rf node_modules
30-
oc start-build angular-5-example --from-dir=. --follow
31-
'''
3247
}
3348
}
34-

0 commit comments

Comments
 (0)