-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
54 lines (51 loc) · 1.41 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
pipeline {
agent any
environment {
AWS_DEFAULT_REGION = 'us-east-1'
AWS_ACCESS_KEY_ID = credentials('aws-access-key-id')
AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key')
}
stages {
stage('Build') {
steps {
script {
echo 'Building the project...'
// Add your build steps here
}
}
}
stage('Test') {
steps {
script {
echo 'Running tests...'
// Add your test steps here
}
}
}
stage('Deploy') {
steps {
script {
echo 'Deploying the application...'
// Deploy to an EC2 instance
sh 'aws ec2 run-instances --image-id ami-12345678 --instance-type t2.micro --key-name my-keypair'
// Upload artifact to S3
sh 'aws s3 cp target/app.jar s3://my-bucket/'
}
}
}
}
post {
always {
echo 'Cleaning up...'
// Clean up steps here
}
success {
echo 'Deployment successful'
// Additional success steps here
}
failure {
echo 'Deployment failed'
// Additional failure steps here
}
}
}