Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team6-Digital Insight for Health
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chen Liang
Team6-Digital Insight for Health
Commits
06074a84
Commit
06074a84
authored
5 months ago
by
Burhan Akbar
Browse files
Options
Downloads
Patches
Plain Diff
0
parent
ecee174e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Jenkinsfile
+13
-5
13 additions, 5 deletions
Jenkinsfile
migrate_db.sh
+29
-2
29 additions, 2 deletions
migrate_db.sh
with
42 additions
and
7 deletions
Jenkinsfile
+
13
−
5
View file @
06074a84
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
This diff is collapsed.
Click to expand it.
migrate_db.sh
+
29
−
2
View file @
06074a84
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment