@@ -8,35 +8,49 @@ pipeline {
88 }
99
1010 stages {
11- stage(' Install Python Deps ' ) {
11+ stage(' Check Environment ' ) {
1212 steps {
1313 sh '''
14- python3 -m venv venv
15- ${PIP} install --upgrade pip
16- ${PIP} install -r requirements.txt
14+ echo "Checking Python version..."
15+ python3 --version || { echo "Python not found"; exit 1; }
16+
17+ echo "Checking Node version..."
18+ node -v || { echo "Node.js not found"; exit 1; }
19+
20+ echo "Checking npm..."
21+ npm -v || { echo "npm not found"; exit 1; }
22+
23+ echo "Checking Serverless CLI..."
24+ serverless -v || { echo "Serverless not found"; exit 1; }
1725 '''
1826 }
1927 }
2028
21- stage(' Lint & Security ' ) {
29+ stage(' Setup Python Virtualenv ' ) {
2230 steps {
2331 sh '''
24- ./venv/bin/flake8 . --exclude=venv,tests,.serverless || true
25- ./venv/bin/bandit -r . -x venv,tests,.serverless || true
26- ./venv/bin/isort . --skip venv --skip tests --skip .serverless --check-only || true
27- ./venv/bin/mypy . --exclude '(venv|tests|\\ .serverless)' || true
32+ python3 -m venv ${VENV}
33+ ${PIP} install --upgrade pip
34+ ${PIP} install -r requirements.txt
2835 '''
2936 }
3037 }
3138
3239 stage(' Deploy to AWS Lambda' ) {
3340 steps {
3441 sh '''
35- npm install -g serverless
36- ./venv/bin/pip install serverless
3742 serverless deploy --stage dev
3843 '''
3944 }
4045 }
4146 }
47+
48+ post {
49+ failure {
50+ echo " Pipeline failed. Check logs above 👆"
51+ }
52+ success {
53+ echo " ✅ Deployed to AWS Lambda successfully!"
54+ }
55+ }
4256}
0 commit comments