-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathJenkinsfile.1
38 lines (30 loc) · 1.21 KB
/
Jenkinsfile.1
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
def createNamespace (namespace) {
echo "Creating namespace ${namespace} if needed"
sh "[ ! -z \"\$(kubectl get ns ${namespace} -o name 2>/dev/null)\" ] || kubectl create ns ${namespace}"
}
node {
def mvnHome
stage('Checkout') { // for display purposes
// Get some code from a GitHub repository
git branch: 'master',
credentialsId: 'github-padmaragl',
url: 'https://github.com/padmaragl/activemq-kubernetes.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'M3'
}
stage('Dockerize Build'){
sh "sudo docker build -t activemq ."
sh "sudo docker tag activemq-kubernetes padmaraglaunchpad/activemq:latest"
sh "sudo docker push padmaraglaunchpad/activemq:latest"
}
stage('Kubernetes Deploy') {
//Kubernetes - create deployment and service
sh "kubectl delete service activemq || true"
sh "kubectl delete deployment activemq || true"
sh "kubectl apply -f create_user_role_binding.yaml"
sh "kubectl apply -f activemq_deployment.yaml"
sh "kubectl apply -f activemq_service.yaml"
}
}