forked from carlos-jenkins/python-github-webhooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
41 lines (34 loc) · 1.46 KB
/
Jenkinsfile
File metadata and controls
41 lines (34 loc) · 1.46 KB
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
node {
def suffix = ""
def imageBaseName="qube-git-listener"
def imgName = "qubeship/${imageBaseName}${suffix}"
def dockerFileName = "Dockerfile-wsgi${suffix}"
println (imgName + ":" + dockerFileName)
checkout poll:false,scm: [
$class: 'GitSCM',
branches: [[name: "${commithash}"]],
userRemoteConfigs: [[
url: "${git_repo}",
credentialsId: 'github',
refspec: '+refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin/pr/*'
]]
]
def branch=(branch?:"master").tokenize('/').last()
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD', label:"Get Commit id")
shorthash = gitCommit.take(6)
def imageVersion="${branch}.${shorthash}.${env.BUILD_NUMBER}"
def image = docker.build ("$imgName:${imageVersion}", "-f $dockerFileName .")
image.tag("latest")
docker.withRegistry('https://gcr.io/', 'gcr:qubeship') {
image.push()
image.push("latest")
}
withCredentials([[$class: 'StringBinding',credentialsId:
'qubeship-prod-k8s2', variable: 'TOKEN']]) {
sh '''
set +x +e
kubectl apply -f .qube/services/qube-services.yaml --record --token $TOKEN --namespace platform --server=https://104.198.6.255 --insecure-skip-tls-verify=true
kubectl apply -f .qube/production/qube-resources.yaml --record --token $TOKEN --namespace platform --server=https://104.198.6.255 --insecure-skip-tls-verify=true
'''
}
}