forked from EnsoFinance/temper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
65 lines (63 loc) · 2.02 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
61
62
63
64
65
pipeline {
environment {
imagename = "temper"
ecrurl = "http://10.123.31.221:5000/v2/"
dockerImage = ''
}
agent any
stages {
stage('Cloning Git') {
// when {branch 'main'}
steps {
git branch: 'main', credentialsId: 'github-develop', url: 'https://github.com/wakumo/temper.git'
}
}
stage('Building image') {
// when {branch 'main'}
steps{
script {
dockerImage = docker.build imagename
}
}
}
stage('Push Image') {
// when {branch 'main'}
steps{
script {
// docker.withRegistry(ecrurl, ecrcredentials ) {
docker.withRegistry(ecrurl) {
dockerImage.push("$BUILD_NUMBER")
dockerImage.push('latest')
}
}
}
}
stage('Kubernetes') {
// when {branch 'main'}
steps{
script{
withKubeConfig(credentialsId: 'wkm_local_credential_deploy', namespace: 'ethereum-tx', serverUrl: 'https://10.123.31.100:6443') {
sh 'curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.20.5/bin/linux/amd64/kubectl"'
sh 'chmod u+x ./kubectl'
sh './kubectl apply -f .kube/development/temper-deployment.yml'
sh './kubectl rollout restart deployment/temper-deployment'
}
}
}
}
}
post {
// only triggered when blue or green sign
success {
slackSend channel: 'ethereum-tx-jenkins-notification-dev', message: "[temper] git-commit {${GIT_COMMIT}} has been deployed!!!", color: '#1ddb46'
}
// triggered when red sign
failure {
slackSend channel: 'ethereum-tx-jenkins-notification-dev', message: "[temper] something went wrong at git-commit {${GIT_COMMIT}}. please try again!!!", color: '#FE2E2E'
}
// trigger every-works
always {
sh "docker system prune -f"
}
}
}