-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
79 lines (67 loc) · 1.68 KB
/
Jenkinsfile
File metadata and controls
79 lines (67 loc) · 1.68 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
pipeline {
agent any
environment {
STAGE = "dev"
}
stages {
stage('Checkout Code') {
steps {
checkout scm
}
}
stage('Check Environment') {
steps {
sh '''
echo Checking Python version...
python3 --version
echo Checking Node version...
node -v
echo Checking npm version...
npm -v
echo Checking Serverless version...
command -v serverless
echo ✅ Environment looks good.
'''
}
}
stage('Install Dependencies') {
steps {
sh '''
echo Installing Python virtual environment...
python3 -m venv venv
. venv/bin/activate
echo Installing Python dependencies...
pip install --upgrade pip
pip install -r requirements.txt
echo Installing Node dependencies...
npm install
echo Installing Serverless WSGI plugin if needed...
npm install --save serverless-wsgi
'''
}
}
stage('Deploy to AWS Lambda') {
steps {
withCredentials([
string(credentialsId: 'SERVERLESS_ACCESS_KEY', variable: 'SERVERLESS_ACCESS_KEY'),
string(credentialsId: 'AWS_ACCESS_KEY_ID', variable: 'AWS_ACCESS_KEY_ID'),
string(credentialsId: 'AWS_SECRET_ACCESS_KEY', variable: 'AWS_SECRET_ACCESS_KEY')
])
{
sh '''
echo Deploying with Serverless CLI...
serverless deploy --stage $STAGE --verbose
'''
}
}
}
}
post {
failure {
echo "❌ Pipeline failed. Check logs above."
}
success {
echo "✅ Deployed successfully to AWS Lambda!"
}
}
}