forked from hshar/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
57 lines (50 loc) · 1.48 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
50
51
52
53
54
55
56
57
pipeline {
agent any
environment{
registryCredential = 'ecr:us-east-1:ravindra-capstone'
appRegistry = "127778518722.dkr.ecr.us-east-1.amazonaws.com/capstone-ravi"
capstoneRegistry = "127778518722.dkr.ecr.us-east-1.amazonaws.com"
cluster = "capstone-ravi"
service = "capstone-serv"
}
stages {
stage('Clone given Website') {
steps {
git url:'https://github.com/RavindraRv/website.git'
}
}
stage("Docker Build Image"){
steps{
script{
dockerImage = docker.build(appRegistry+ ":$BUILD_NUMBER",".")
}
}
}
stage('Test my Website') {
steps {
// Run tests on the website
sh 'echo "Running tests on the website"'
}
}
stage("Upload docker App Image"){
steps{
script{
docker.withRegistry(capstoneRegistry, registryCredential){
dockerImage.push("$BUILD_NUMBER")
dockerImage.push('latest')
}
}
}
}
stage('Deploying website to ecs'){
when {
branch "master"
}
steps{
withAWS(credentials: 'ravindra-capstone', region: 'us-east-1'){
sh 'aws ecs update-service --cluster ${cluster} --service ${service} --force-new-deployment'
}
}
}
}
}