-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
65 lines (65 loc) · 1.84 KB
/
Jenkinsfile
File metadata and controls
65 lines (65 loc) · 1.84 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pipeline {
environment {
registry = "mihirpradhan/website"
registryCredential = 'dockerhub'
dockerImage = ''
}
agent any
stages {
stage('Linting') {
steps {
sh 'tidy -q -e *.html'
}
}
stage('Build image') {
steps {
script {
dockerImage = docker.build registry + ":$BUILD_NUMBER"
}
}
}
stage('Push image') {
steps {
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Check credentials') {
steps {
withAWS(region:'us-east-1',credentials:'mihpradh') {
sh 'aws sts get-caller-identity'
}
}
}
stage('Create EKS cluster') {
steps {
withAWS(region:'us-east-1',credentials:'mihpradh') {
sh '''
eksctl create cluster \
--name website \
--version 1.17 \
--region us-east-1 \
--nodegroup-name website-nodes \
--node-type t2.micro \
--nodes 3 \
--nodes-min 1 \
--nodes-max 4 \
--ssh-access \
--ssh-public-key /home/ubuntu/capstone.pub \
--managed
'''
}
}
}
stage('Apply Kube config') {
steps {
withAWS(region:'us-east-1',credentials:'mihpradh') {
sh '/home/ubuntu/run_kubernetes.sh $BUILD_NUMBER'
}
}
}
}
}