-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathJenkinsfile-deploy-eks
More file actions
51 lines (50 loc) · 1.42 KB
/
Jenkinsfile-deploy-eks
File metadata and controls
51 lines (50 loc) · 1.42 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
pipeline{
environment{
eks_cluster_name = "eksdemo-dev"
artifacts_dir = "${env.WORKSPACE}/artifacts"
aws_region = "${params.aws_region}"
job_root_dir="${env.WORKSPACE}"
}
agent any
stages{
stage('Initialize workspace') {
steps {
// Make sure the directory is clean
dir("${artifacts_dir}") {
deleteDir()
}
sh(script: "mkdir -p ${artifacts_dir}", label: 'Create artifacts directory')
}
}
stage('git stage'){
steps{
git branch: 'main', url: 'https://github.com/cloudtechmasters/devops-weekend-session.git'
}
}
stage('Generate kubeconfig for the cluster') {
steps {
script {
env.KUBECONFIG = "${artifacts_dir}/${eks_cluster_name}-kubeconfig"
sh 'chmod +x ${WORKSPACE}/generate_kubeconfig_eks.sh'
}
sh(script: '${WORKSPACE}/generate_kubeconfig_eks.sh', label: 'Generate kubeconfig file')
}
}
stage('deploy spring boot app on k8s') {
steps {
script {
sh '''kubectl apply -f springboot-deployment.yml
kubectl apply -f springboot-service.yml
kubectl get all
'''
}
}
}
}
post {
cleanup {
cleanWs(cleanWhenFailure: false)
}
}
}
© 2022 GitHub, Inc.