forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
55 lines (55 loc) · 1.81 KB
/
Jenkinsfile
File metadata and controls
55 lines (55 loc) · 1.81 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pipeline {
agent {
kubernetes {
cloud 'Jenkins-K8-Agent-Orchestration'
yamlFile 'template.yaml'
}
}
environment {
KUBECONFIG = '/k8.yaml'
IMAGE_NAME = 'registry.digitalocean.com/ungate/mematrix-architect:development'
}
stages {
stage('Build and Push Image with Kaniko') {
steps {
container(name: 'kaniko', shell: '/busybox/sh') {
script {
def currentDir = sh(script: 'pwd', returnStdout: true).trim()
sh """
#!/busybox/sh
/kaniko/executor --dockerfile=${currentDir}/Dockerfile \
--context=${currentDir} \
--build-arg=KUBECONFIG=${KUBECONFIG} \
--destination=${IMAGE_NAME} \
--insecure
"""
}
}
}
}
stage('Restart with Kubectl') {
steps {
container(name: 'kubectl', shell: '/bin/sh') {
script {
sh """
#!/bin/sh
export KUBECONFIG=${KUBECONFIG}
kubectl config use-context 'do-blr1-k8s-ungate-init'
kubectl apply -f deployment.yaml
kubectl rollout restart deployment architect -n default
kubectl rollout restart deployment krakend-deployment -n default
"""
}
}
}
}
}
post {
failure {
echo 'Build or Deploy failed!'
}
success {
echo 'Build and Deploy succeeded!'
}
}
}