-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
27 lines (25 loc) · 880 Bytes
/
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
pipeline {
agent any
stages {
stage ('fetch code') {
steps {
script {
echo "Pull source code from Git"
git branch: 'main', url: 'https://github.com/doyindevops/DevSecOps-Webserver-Automation.git'
}
}
}
stage ('deploy to EC2') {
steps {
script {
echo "deploying to shell-script to ec2"
def shellCmd = "bash ./websetup.sh"
sshagent (['EC2-KEY']) {
sh "scp -o StrictHostKeyChecking=no websetup.sh ec2-user@15.237.233.219:/home/ec2-user"
sh "ssh -o StrictHostKeyChecking=no ec2-user@15.237.233.219 ${shellCmd}"
}
}
}
}
}
}