-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (48 loc) · 1.28 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage("Git Checkout") {
steps {
checkout([$class: 'GitSCM', branches: [[name: 'master']],
userRemoteConfigs: [[url: 'https://github.com/j-chao/example_apps_devops']]])
}
}
stage("Run Unit Tests") {
steps {
sh '''
python3 -m unittest flask_app/app_test.py -v
'''
}
}
stage("Build Docker Image") {
steps {
sh '''
docker build -t example-flask-app:latest flask_app/
'''
}
}
stage("Tag Docker Image") {
steps {
sh '''
docker tag example-flask-app:latest docker-registry-default.172.28.33.20.nip.io:80/myproject/example-flask-app:1.0.0
'''
}
}
stage("Login to OpenShift Integrated Repository") {
steps {
sh '''
oc login 172.28.33.20:8443 -u developer -p anyvalue --insecure-skip-tls-verify=true
docker login docker-registry-default.172.28.33.20.nip.io:80 -u developer -p $(oc whoami -t)
'''
}
}
stage("Push Image to Repository") {
steps {
sh '''
docker push docker-registry-default.172.28.33.20.nip.io:80/myproject/example-flask-app:1.0.0
'''
}
}
}
}