-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathjenkinsfile.txt
More file actions
42 lines (33 loc) · 1.33 KB
/
jenkinsfile.txt
File metadata and controls
42 lines (33 loc) · 1.33 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
pipeline {
agent any
environment {
AWS_ACCESS_KEY_ID = credentials('jenkins_aws_key_id')
AWS_SECRET_ACCESS_KEY = credentials('jenkins_aws_key_secret')
}
stages {
stage('SCM') {
steps {
git branch: 'main', url: 'https://github.com/Stywar/FirstDevOpsJob'
}
}
stage ('Build') {
steps {
bat(script: 'mvn -f pom.xml clean install', returnStdout: true);
}
}
stage ("Docker Build") {
steps{
// docker login
bat(script: 'docker build -t polyglotstudy/servicejava .' , returnStdout:true);
bat(script: 'docker push polyglotstudy/servicejava' , returnStdout:true);
}
}
stage ('K8S Deploy') {
steps {
bat (script: 'aws configure set region us-east-1',returnStdout: true);
bat(script: 'kubectl config use-context arn:aws:eks:us-east-1:532336934360:cluster/test1 --kubeconfig=%KUBE_PATH_CONFIG%', returnStdout: true);
bat(script: 'Kubectl delete --all pods --kubeconfig=%KUBE_PATH_CONFIG% & kubectl apply -f Devops.yaml --kubeconfig=%KUBE_PATH_CONFIG%', returnStdout: true);
}
}
}
}