-
Notifications
You must be signed in to change notification settings - Fork 8
/
Jenkinsfile
36 lines (36 loc) · 1.28 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
ansiColor('css') {
node {
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/sathya-demo/hello-world.git'
}
stage('Build') {
sh 'pip install -r code/requirements.txt'
}
stage('Test') {
sh 'cd code && python hello_test.py'
}
stage('Validate Packer Box') {
withAWS(credentials:'sathyabhat', region:'ap-south-1') {
sh 'packer validate packer/packer-box.json'
}
}
stage('Validate Ansible Playbook') {
withAWS(credentials:'sathyabhat', region:'ap-south-1') {
sh 'ansible-playbook --syntax-check ansible/setup.yml'
}
}
stage('Bake AMI') {
withAWS(credentials:'sathyabhat', region:'ap-south-1') {
withCredentials([string(credentialsId: 'datadog', variable: 'dd_token')]) {
sh 'DD_TOKEN=${dd_token} packer build packer/packer-box.json'
}
}
}
stage('Launch Instance') {
withAWS(credentials: 'sathyabhat', region:'ap-south-1') {
sh('cd terraform && terraform init && terraform plan && terraform -auto-approve apply')
}
}
}
}