Skip to content
Snippets Groups Projects
Commit 06074a84 authored by Burhan Akbar's avatar Burhan Akbar
Browse files

0

parent ecee174e
No related branches found
No related tags found
No related merge requests found
pipeline {
agent any // Or specify a specific agent label
agent {
label 'my-agent-label'
}
stages {
stage('Checkout') {
......@@ -7,6 +9,11 @@ pipeline {
git credentialsId: 'your-repo-credentials', url: 'git@git.cardiff.ac.uk:c24025433/healthcare.git'
}
}
stage('Fix Permissions') {
steps {
sh 'chmod +x gradlew'
}
}
stage('Build') {
steps {
sh './gradlew clean build'
......@@ -24,7 +31,7 @@ pipeline {
}
stage('Deploy') {
steps {
sh 'pkill -f \'java -jar\''
sh 'pkill -f \'java -jar\' || true'
sh 'nohup java -jar build/libs/HealthCare-0.0.1-SNAPSHOT.jar --server.port=8081 > app.log 2>&1 &'
}
}
......@@ -38,9 +45,10 @@ pipeline {
}
failure {
echo "Pipeline failed"
mail to: 'your-email@example.com',
subject: "Jenkins Pipeline Failed",
body: "The pipeline ${env.JOB_NAME} build ${env.BUILD_NUMBER} failed."
// Comment out email until configured
// mail to: 'your-email@example.com',
// subject: "Jenkins Pipeline Failed",
// body: "The pipeline ${env.JOB_NAME} build ${env.BUILD_NUMBER} failed."
}
}
}
\ No newline at end of file
#!/bin/bash
# Simple database migration script
# filepath: c:\Users\atlas\Desktop\DevopsHealthcare\healthcare\migrate_db.sh
echo "Running database migrations..."
# Add your actual migration commands here
# Database connection details
DB_USER="root" # Change if different
DB_PASS="root" # Change if different
DB_HOST="localhost"
DB_PORT="3306" # Change if using a different port
# Path to your schema file
SCHEMA_FILE="src/main/resources/schema.sql"
# Check if schema file exists
if [ ! -f "$SCHEMA_FILE" ]; then
echo "Error: Schema file not found at $SCHEMA_FILE"
exit 1
fi
# Execute the SQL script
echo "Applying schema from $SCHEMA_FILE..."
mysql -h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PASS < $SCHEMA_FILE
# Check if the command was successful
if [ $? -eq 0 ]; then
echo "Database migration completed successfully!"
else
echo "Error: Database migration failed!"
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment