Skip to content

Commit bf2a3fc

Browse files
authored
Update jenkinsfile
1 parent f4b5747 commit bf2a3fc

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

jenkinsfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pipeline {
22
agent any
33
environment {
4-
registry = '276775973535.dkr.ecr.ap-south-1.amazonaws.com/docker-image-deploy'
4+
registry = '224498103667.dkr.ecr.ap-south-1.amazonaws.com/ci-cd'
55
}
66

77
stages {
@@ -22,8 +22,8 @@ pipeline {
2222
steps{
2323
script {
2424
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'aws']]) {
25-
sh 'aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 276775973535.dkr.ecr.ap-south-1.amazonaws.com'
26-
sh 'docker push 276775973535.dkr.ecr.ap-south-1.amazonaws.com/docker-image-deploy:latest'
25+
sh 'aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 224498103667.dkr.ecr.ap-south-1.amazonaws.com'
26+
sh 'docker push 224498103667.dkr.ecr.ap-south-1.amazonaws.com/ci-cd:latest'
2727
}
2828

2929
}
@@ -41,5 +41,22 @@ pipeline {
4141
}
4242
}
4343
}
44+
stage('Deploying to Kubernetes') {
45+
steps{
46+
sshagent(['k8s']) {
47+
sh "scp -o stringHostKeyChecking=no app.yaml [email protected]:/home/ubuntu"
48+
script {
49+
try{
50+
sh "ssh [email protected] kubectl apply -f ."
51+
}catch(error){
52+
sh "ssh [email protected] kubectl create -f ."
53+
}
54+
55+
}
56+
57+
58+
}
59+
}
60+
}
4461
}
4562
}

0 commit comments

Comments
 (0)