-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathJenkinsfile
More file actions
49 lines (49 loc) · 1.81 KB
/
Jenkinsfile
File metadata and controls
49 lines (49 loc) · 1.81 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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo Building...'
}
}
stage('Lint HTML') {
steps {
sh 'tidy -q -e *.html'
}
}
stage('Build Docker Image') {
steps {
sh 'docker build -t capstone-project-cloud-devops .'
}
}
stage('Push Docker Image') {
steps {
withDockerRegistry([url: "", credentialsId: "docker-hub"]) {
sh "docker tag capstone-project-cloud-devops sabbir33/capstone-project-cloud-devops"
sh 'docker push sabbir33/capstone-project-cloud-devops'
}
}
}
stage('Deploying') {
steps{
echo 'Deploying to AWS...'
withAWS(credentials: 'aws', region: 'us-west-2') {
sh "aws eks --region us-west-2 update-kubeconfig --name capstonecluster"
sh "kubectl config use-context arn:aws:eks:us-west-2:988212813982:cluster/capstonecluster"
sh "kubectl set image deployments/capstone-project-cloud-devops capstone-project-cloud-devops=sabbir33/capstone-project-cloud-devops:latest"
sh "kubectl apply -f deployment/deployment.yml"
sh "kubectl get nodes"
sh "kubectl get deployment"
sh "kubectl get pod -o wide"
sh "kubectl get service/capstone-project-cloud-devops"
}
}
}
stage("Cleaning up") {
steps{
echo 'Cleaning up...'
sh "docker system prune"
}
}
}
}