-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathJenkinsfile-K8S
41 lines (35 loc) · 1.24 KB
/
Jenkinsfile-K8S
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
pipeline {
agent any
environment {
registry = "211223789150.dkr.ecr.us-east-2.amazonaws.com/my-python-repo"
}
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/akannan1087/myPythonDockerRepo']]])
}
}
stage ("Build image") {
steps {
script {
docker.build registry
}
}
}
stage ("docker push") {
steps {
script {
sh "aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 211223789150.dkr.ecr.us-east-2.amazonaws.com"
sh "docker push 211223789150.dkr.ecr.us-east-2.amazonaws.com/my-python-repo"
}
}
}
stage ("Kube Deploy") {
steps {
withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'K8S', namespace: '', serverUrl: '') {
sh "kubectl apply -f eks-deploy-from-ecr.yaml"
}
}
}
}
}