forked from openshift/assisted-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
60 lines (53 loc) · 2.1 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
58
59
60
pipeline {
agent { label 'bm-inventory-subsystem' }
stages {
stage('clear deployment') {
steps {
sh 'make clear-deployment'
}
}
stage('Deploy') {
steps {
sh '''export PATH=$PATH:/usr/local/go/bin; make deploy-test'''
sleep 60
sh '''# Dump pod statuses;kubectl get pods -A'''
}
}
stage('test') {
steps {
sh '''export PATH=$PATH:/usr/local/go/bin;make subsystem-run'''
}
}
stage('Deploy to prod') {
when {
branch 'master'
}
steps {
withCredentials([usernamePassword(credentialsId: 'ocpmetal_cred', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh '''docker login quay.io -u $USER -p $PASS'''
}
sh '''docker tag quay.io/ocpmetal/assisted-service:test quay.io/ocpmetal/assisted-service:$(git rev-parse --verify HEAD)'''
sh '''docker tag quay.io/ocpmetal/assisted-service:test quay.io/ocpmetal/assisted-service:latest'''
sh '''docker push quay.io/ocpmetal/assisted-service:latest'''
sh '''docker push quay.io/ocpmetal/assisted-service:$(git rev-parse --verify HEAD)'''
}
}
}
post {
failure {
echo 'Get assisted-service log'
sh '''
kubectl get pods -o=custom-columns=NAME:.metadata.name -A | grep assisted-service | xargs -I {} sh -c "kubectl logs {} -n assisted-installer > test_dd.log"
mv test_dd.log $WORKSPACE/assisted-service.log || true
'''
echo 'Get mariadb log'
sh '''kubectl get pods -o=custom-columns=NAME:.metadata.name -A | grep mariadb | xargs -I {} sh -c "kubectl logs {} -n assisted-installer > test_dd.log"
mv test_dd.log $WORKSPACE/mariadb.log || true
'''
echo 'Get createimage log'
sh '''kubectl get pods -o=custom-columns=NAME:.metadata.name -A | grep createimage | xargs -I {} sh -c "kubectl logs {} -n assisted-installer > test_dd.log"
mv test_dd.log $WORKSPACE/createimage.log || true
'''
}
}
}