forked from aiwithqasim/Capstone-Project-Devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
39 lines (39 loc) · 1.34 KB
/
Jenkinsfile
File metadata and controls
39 lines (39 loc) · 1.34 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
pipeline {
agent any
stages {
stage('Install requirements') {
steps {
sh 'make install'
}
}
stage('Lint files') {
steps {
sh 'make lint'
}
}
stage('Build and upload to ECR') {
steps {
sh 'rm -f ~/.dockercfg'
sh 'rm -f ~/.docker/config.json'
script {
docker.withRegistry('https://119841056280.dkr.ecr.us-east-1.amazonaws.com', 'ecr:us-east-1:AwsCreds') {
def customImage = docker.build("nano-devops-05:latest")
customImage.push()
}
}
}
}
stage('Deploy to EKS') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'AwsCreds',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh 'AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} AWS_DEFAULT_REGION=us-east-1 aws ecs update-service --cluster NanoDevops05 --service helloWorld --force-new-deployment'
}
}
}
}
}