Skip to content

Commit 67b4b9e

Browse files
Update Jenkinsfile
1 parent d8fbfe9 commit 67b4b9e

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

Jenkinsfile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,50 @@ pipeline {
33

44
environment {
55
VENV = 'venv'
6+
VENV_PYTHON = './venv/bin/python'
7+
VENV_PIP = './venv/bin/pip'
8+
VENV_FLAKE8 = './venv/bin/flake8'
9+
VENV_BANDIT = './venv/bin/bandit'
10+
VENV_ISORT = './venv/bin/isort'
11+
VENV_MYPY = './venv/bin/mypy'
12+
VENV_PYTEST = './venv/bin/pytest'
613
}
714

815
stages {
916
stage('Set Up Python') {
1017
steps {
1118
sh '''
1219
python3 -m venv venv
13-
. venv/bin/activate
14-
pip install --upgrade pip
15-
pip install -r requirements.txt
20+
./venv/bin/pip install --upgrade pip
21+
./venv/bin/pip install -r requirements.txt
1622
'''
1723
}
1824
}
1925

2026
stage('Lint & Security') {
2127
steps {
2228
sh '''
23-
. venv/bin/activate
24-
flake8 . --exclude=venv
25-
bandit -r . || true
26-
isort . --check-only || true
27-
mypy . || true
29+
${VENV_FLAKE8} . --exclude=venv,tests,.serverless
30+
${VENV_BANDIT} -r . -x venv,tests,.serverless || true
31+
${VENV_ISORT} . --skip venv --skip tests --skip .serverless --check-only || true
32+
${VENV_MYPY} . --exclude '(venv|tests|\\.serverless)' || true
2833
'''
2934
}
3035
}
3136

3237
stage('Run Tests') {
3338
steps {
3439
sh '''
35-
. venv/bin/activate
36-
pytest tests/ --junitxml=results.xml
40+
${VENV_PYTEST} tests/ --junitxml=results.xml
3741
'''
3842
}
3943
}
4044

4145
stage('Deploy to Lambda') {
4246
steps {
4347
sh '''
44-
. venv/bin/activate
4548
npm install -g serverless
46-
serverless deploy --stage dev
49+
./venv/bin/serverless deploy --stage dev
4750
'''
4851
}
4952
}

0 commit comments

Comments
 (0)