-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
49 lines (49 loc) · 1.68 KB
/
Jenkinsfile
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 mohd-capstone .'
}
}
stage('Push Docker Image') {
steps {
withDockerRegistry([url: "", credentialsId: "dockerhub"]) {
sh "docker tag mohd-capstone mohamedsgap/mohd-capstone"
sh 'docker push mohamedsgap/mohd-capstone'
}
}
}
stage('Deploying') {
steps{
echo 'Deploying to AWS...'
withAWS(credentials: 'aws-static', region: 'us-west-2') {
sh "aws eks --region us-west-2 update-kubeconfig --name mohd-capstone"
sh "kubectl config use-context arn:aws:eks:us-west-2:864485235780:cluster/mohd-capstone"
sh "kubectl set image deployments/mohd-capstone mohd-capstone=mohamedsgap/mohd-capstone"
sh "kubectl apply -f scripts/deploy.yml"
sh "kubectl get nodes"
sh "kubectl get deployment"
sh "kubectl get pod -o wide"
sh "kubectl get service/mohd-capstone"
}
}
}
stage("Cleaning up") {
steps{
echo 'Cleaning up...'
sh "docker system prune"
}
}
}
}