From ec64e7e8c7c5ea1d743f72dc347058e643b14e62 Mon Sep 17 00:00:00 2001 From: lenape Date: Tue, 5 Aug 2025 21:07:07 +0000 Subject: [PATCH] automated terminal push --- infrastructure/services/Jenkinsfile | 55 +++++++++++++++++++---------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/infrastructure/services/Jenkinsfile b/infrastructure/services/Jenkinsfile index 72bd10a..33125f7 100644 --- a/infrastructure/services/Jenkinsfile +++ b/infrastructure/services/Jenkinsfile @@ -204,35 +204,54 @@ sonar.terraform.provider.aws=true sh ''' echo "=== Application Testing ===" - # Install Python dependencies - python3 -m pip install --user -r requirements.txt - python3 -m pip install --user pytest flask + # Create virtual environment + echo "๐Ÿ“ฆ Creating Python virtual environment..." + python3 -m venv venv + + # Activate virtual environment + source venv/bin/activate + + # Upgrade pip in virtual environment + pip install --upgrade pip + + # Install dependencies in virtual environment + echo "๐Ÿ“ฅ Installing dependencies..." + pip install -r requirements.txt + pip install pytest flask + + # Show installed packages for debugging + echo "๐Ÿ“‹ Installed packages:" + pip list # Basic syntax check - python3 -m py_compile app.py + echo "๐Ÿ” Running syntax check..." + python -m py_compile app.py echo "โœ… Python syntax check passed" # Test Flask app imports and basic functionality - python3 -c " -import sys -sys.path.append('.') -from app import app -print('โœ… Flask app import successful') + echo "๐Ÿงช Testing Flask application..." + python -c " + import sys + sys.path.append('.') + from app import app + print('โœ… Flask app import successful') -# Test app creation -with app.test_client() as client: - response = client.get('/health') - assert response.status_code == 200 - print('โœ… Health endpoint test passed') - print(f'Health response: {response.get_json()}') -" + # Test app creation + with app.test_client() as client: + response = client.get('/health') + assert response.status_code == 200 + print('โœ… Health endpoint test passed') + print(f'Health response: {response.get_json()}') + " echo "โœ… Application tests completed" + + # Deactivate and clean up (optional, workspace will be cleaned anyway) + deactivate || true ''' } } - } - + } stage('๐Ÿณ Build & Push Docker Image') { when { equals expected: 'deploy', actual: params.ACTION