automated terminal push
This commit is contained in:
45
infrastructure/services/Jenkinsfile
vendored
45
infrastructure/services/Jenkinsfile
vendored
@@ -204,35 +204,54 @@ sonar.terraform.provider.aws=true
|
|||||||
sh '''
|
sh '''
|
||||||
echo "=== Application Testing ==="
|
echo "=== Application Testing ==="
|
||||||
|
|
||||||
# Install Python dependencies
|
# Create virtual environment
|
||||||
python3 -m pip install --user -r requirements.txt
|
echo "📦 Creating Python virtual environment..."
|
||||||
python3 -m pip install --user pytest flask
|
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
|
# Basic syntax check
|
||||||
python3 -m py_compile app.py
|
echo "🔍 Running syntax check..."
|
||||||
|
python -m py_compile app.py
|
||||||
echo "✅ Python syntax check passed"
|
echo "✅ Python syntax check passed"
|
||||||
|
|
||||||
# Test Flask app imports and basic functionality
|
# Test Flask app imports and basic functionality
|
||||||
python3 -c "
|
echo "🧪 Testing Flask application..."
|
||||||
import sys
|
python -c "
|
||||||
sys.path.append('.')
|
import sys
|
||||||
from app import app
|
sys.path.append('.')
|
||||||
print('✅ Flask app import successful')
|
from app import app
|
||||||
|
print('✅ Flask app import successful')
|
||||||
|
|
||||||
# Test app creation
|
# Test app creation
|
||||||
with app.test_client() as client:
|
with app.test_client() as client:
|
||||||
response = client.get('/health')
|
response = client.get('/health')
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
print('✅ Health endpoint test passed')
|
print('✅ Health endpoint test passed')
|
||||||
print(f'Health response: {response.get_json()}')
|
print(f'Health response: {response.get_json()}')
|
||||||
"
|
"
|
||||||
|
|
||||||
echo "✅ Application tests completed"
|
echo "✅ Application tests completed"
|
||||||
|
|
||||||
|
# Deactivate and clean up (optional, workspace will be cleaned anyway)
|
||||||
|
deactivate || true
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('🐳 Build & Push Docker Image') {
|
stage('🐳 Build & Push Docker Image') {
|
||||||
when {
|
when {
|
||||||
equals expected: 'deploy', actual: params.ACTION
|
equals expected: 'deploy', actual: params.ACTION
|
||||||
|
|||||||
Reference in New Issue
Block a user