From fb02608625c591c6f3e792bd6bdecf62414d6048 Mon Sep 17 00:00:00 2001 From: JanhviDahake <85737344+JanhviDahake@users.noreply.github.com> Date: Fri, 11 Jul 2025 19:09:53 +0530 Subject: [PATCH] Create Jenkinsfile --- src/flask/Jenkinsfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/flask/Jenkinsfile diff --git a/src/flask/Jenkinsfile b/src/flask/Jenkinsfile new file mode 100644 index 00000000..1e33b757 --- /dev/null +++ b/src/flask/Jenkinsfile @@ -0,0 +1,40 @@ +pipeline { + agent any + + environment { + VENV_DIR = 'venv' + } + + stages { + stage('Build') { + steps { + echo '📦 Creating virtual environment and installing dependencies...' + sh '/usr/bin/python3 -m venv $VENV_DIR' + sh '. $VENV_DIR/bin/activate && pip install -r requirements.txt' + } + } + + stage('Test') { + steps { + echo '✅ Running unit tests...' + sh '. $VENV_DIR/bin/activate && pytest' + } + } + + stage('Deploy') { + steps { + echo '🚀 Deploying Flask app...' + sh '. $VENV_DIR/bin/activate && nohup python app.py &' + } + } + } + + post { + success { + echo '✅ Build and deployment successful!' + } + failure { + echo '❌ Build or tests failed. Check logs.' + } + } +}