-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
55 lines (50 loc) · 1.47 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
pipeline {
agent any
environment {
AWS_CREDENTIALS = 'saml-jenkins-creds' // Make sure this is properly configured in Jenkins Credentials
AWS_DEFAULT_REGION = 'us-east-2'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Setup Python Environment') {
steps {
script {
bat '''
"C:\\Program Files\\python.exe" -m venv venv
venv\\Scripts\\activate.bat
pip install -r requirements.txt
'''
}
}
}
stage('Deploy Using Serverless') {
steps {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: AWS_CREDENTIALS]]) {
bat '''
venv\\Scripts\\activate.bat
set AWS_ACCESS_KEY_ID=%AWS_ACCESS_KEY_ID%
set AWS_SECRET_ACCESS_KEY=%AWS_SECRET_ACCESS_KEY%
set AWS_SESSION_TOKEN=%AWS_SESSION_TOKEN%
serverless deploy --stage dev --region us-east-2
'''
}
}
}
}
post {
success {
echo 'Deployment succeeded!'
}
failure {
echo 'Deployment failed.'
}
always {
bat 'echo Cleaning up...'
bat 'rd /s /q venv'
}
}
}