automated terminal push
This commit is contained in:
53
infrastructure/services/Jenkinsfile
vendored
53
infrastructure/services/Jenkinsfile
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user