-
Notifications
You must be signed in to change notification settings - Fork 10
Update DB setup instructions; tweak dummy data load script #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request enhances the local setup documentation by refining the database schema management service deployment section with a clearer heading and added setup instructions. The shell script for loading dummy data is revised to improve portability and readability by switching from associative arrays to standard indexed arrays and adjusting the iteration logic accordingly. Additionally, a new Jenkins pipeline script is introduced to automate the build, packaging, and deployment processes for multiple UI and API projects, including environment setup, source checkout, build, artifact archiving, and remote deployment. Changes
Sequence Diagram(s)sequenceDiagram
participant Jenkins as Jenkins Pipeline
participant Git as Git Repositories
participant Build as Build Tools (npm, Maven)
participant Archive as Artifact Storage
participant Remote as Remote WildFly Server
Jenkins->>Git: Checkout UI and API source code
Jenkins->>Build: Install dependencies and build projects
Build->>Archive: Archive WAR artifacts
Jenkins->>Remote: Undeploy existing WARs via SSH
Jenkins->>Remote: Deploy new WARs via SCP
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
amrit-local-setup/loaddummydata.sh (1)
Line range hint
1-8: Consider security and usability improvements for connection details.
- Database credentials are hardcoded. Consider:
- Using environment variables
- Adding a configuration file
- Implementing password prompt
- The SQL_DIR placeholder needs clearer instructions for users.
Apply this diff to improve security and usability:
#!/bin/sh # MySQL connection details -HOST="127.0.0.1" -PORT="3306" -USER="root" -PASSWORD="1234" +HOST="${MYSQL_HOST:-127.0.0.1}" +PORT="${MYSQL_PORT:-3306}" +USER="${MYSQL_USER:-root}" +PASSWORD="${MYSQL_PASSWORD:-}" # Prompt if not set + +if [ -z "$PASSWORD" ]; then + echo -n "Enter MySQL password: " + read -s PASSWORD + echo +fi # Path to the extracted SQL files -SQL_DIR=<PATH to the extracted files directory> +SQL_DIR="${SQL_DIR:-./sql_files}" # Default to ./sql_files + +if [ ! -d "$SQL_DIR" ]; then + echo "Error: Directory $SQL_DIR does not exist." + echo "Please set SQL_DIR to the path of your extracted SQL files." + exit 1 +fi
🧹 Nitpick comments (2)
amrit-local-setup/loaddummydata.sh (1)
12-14: Consider a more robust file-to-database mapping approach.While using parallel arrays works, it's prone to errors if the arrays get out of sync during maintenance. Consider using a configuration file that explicitly maps files to databases.
Example configuration file approach:
-# Files and their respective databases -FILES=("AmritMasterData.sql" "m_beneficiaryregidmapping_dump_1097.sql" "m_beneficiaryregidmapping_dump.sql") -DATABASES=("db_iemr" "db_1097_identity" "db_identity") +# Read mappings from config file +CONFIG_FILE="${CONFIG_FILE:-./db_mappings.conf}" + +if [ ! -f "$CONFIG_FILE" ]; then + cat > "$CONFIG_FILE" << EOF +AmritMasterData.sql:db_iemr +m_beneficiaryregidmapping_dump_1097.sql:db_1097_identity +m_beneficiaryregidmapping_dump.sql:db_identity +EOF + echo "Created default $CONFIG_FILE" +fiamrit-local-setup/README.md (1)
Line range hint
40-58: Enhance setup instructions with additional details.While the instructions are clear, they could be more comprehensive:
- Explain what properties need to be configured in
common_local.properties- Document the purpose of each Maven command
- Add prerequisites and expected outcomes
Apply this diff to improve the documentation:
### 2. Database Schema Management Service Deployment #### Repository Configuration ```bash git clone https://github.com/PSMRI/AMRIT-DB.git cd AMRIT-DBSetup instructions
-Follow these steps to setup datbase schema.
+Follow these steps to setup the database schema:
+
+1. Copy the example properties file:cp src/main/environment/common_example.properties src/main/environment/common_local.properties +``` + +2. Configure the properties file: + - Open `common_local.properties` + - Update database connection details to match your environment: + - `spring.datasource.url` + - `spring.datasource.username` + - `spring.datasource.password` + +3. Build and run the application: + +```bash mvn clean install -DENV_VAR=local mvn spring-boot:run -DENV_VAR=local
+Expected outcomes:
+- The build should complete successfully
+- The application should start and create/update database schemas
+- Check the logs for any errors during schema creation
+
+Troubleshooting:
+- Ensure MySQL is running and accessible
+- Verify database credentials in properties file
+- Check Maven and Java versions match requirements</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 58f5c8d2e278661ea8a0299c9a86e9894ce6015e and 59d142d858c3d0122f938972dfa82ecf2a070861. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `amrit-local-setup/README.md` (2 hunks) * `amrit-local-setup/loaddummydata.sh` (2 hunks) </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
| # Iterate over the files and execute them | ||
| for i in $(seq 0 $((${#FILES[@]} - 1))); do | ||
| FILE="${FILES[$i]}" | ||
| DATABASE="${DATABASES[$i]}" | ||
| echo "Running $FILE on $DATABASE..." | ||
|
|
||
| mysql -h 127.0.0.1 -P 3306 -u root -p"$PASSWORD" "$DATABASE" < "$SQL_DIR/$FILE" | ||
| mysql -h "$HOST" -P "$PORT" -u "$USER" -p"$PASSWORD" "$DATABASE" < "$SQL_DIR/$FILE" | ||
|
|
||
| if [ $? -eq 0 ]; then | ||
| echo "Successfully executed $FILE on $DATABASE." | ||
| else | ||
| echo "Error executing $FILE on $DATABASE." | ||
| fi | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve iteration logic and error handling.
The current implementation has a few potential issues:
seqcommand isn't guaranteed in all sh implementations- Error messages could be more informative
- No overall status tracking
Apply this diff to improve robustness:
-# Iterate over the files and execute them
-for i in $(seq 0 $((${#FILES[@]} - 1))); do
- FILE="${FILES[$i]}"
- DATABASE="${DATABASES[$i]}"
+# Track overall success
+SUCCESS=true
+
+# Process each mapping from config
+while IFS=: read -r FILE DATABASE; do
+ # Skip empty lines and comments
+ [ -z "$FILE" ] || [ "${FILE#\#}" != "$FILE" ] && continue
+
echo "Running $FILE on $DATABASE..."
- mysql -h "$HOST" -P "$PORT" -u "$USER" -p"$PASSWORD" "$DATABASE" < "$SQL_DIR/$FILE"
+ # Validate file exists
+ if [ ! -f "$SQL_DIR/$FILE" ]; then
+ echo "Error: SQL file $SQL_DIR/$FILE not found"
+ SUCCESS=false
+ continue
+ }
+
+ # Execute with detailed error output
+ ERROR_LOG=$(mktemp)
+ if ! mysql -h "$HOST" -P "$PORT" -u "$USER" -p"$PASSWORD" "$DATABASE" < "$SQL_DIR/$FILE" 2>"$ERROR_LOG"; then
+ echo "Error executing $FILE on $DATABASE:"
+ cat "$ERROR_LOG"
+ rm "$ERROR_LOG"
+ SUCCESS=false
+ continue
+ fi
+ rm "$ERROR_LOG"
- if [ $? -eq 0 ]; then
- echo "Successfully executed $FILE on $DATABASE."
- else
- echo "Error executing $FILE on $DATABASE."
- fi
-done
+ echo "Successfully executed $FILE on $DATABASE."
+done < "$CONFIG_FILE"
+
+# Exit with appropriate status
+if [ "$SUCCESS" = true ]; then
+ echo "All files processed successfully."
+ exit 0
+else
+ echo "Some files failed to process. Please check the errors above."
+ exit 1
+fiCommittable suggestion skipped: line range outside the PR's diff.
|
@Asp-irin made a few changes. |
|
@drtechie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (3)
Jenkinsfile (3)
1-6: Define and validate theprojectparameter
Theprojectchoice parameter is useful but lacks validation for missing or unsupported values. Consider adding a default, grouping environments into a map, and validatingparams.projectearly to fail fast on invalid selections.
578-615: Remove or formalize commented-out Helpline1097-UI stage
The large commented block forHelpline1097-UIclutters the pipeline and risks bit rot. If it’s not needed, delete it. Otherwise, convert it into a parameterized or toggleable stage so it can be enabled via configuration, not manual commenting.
892-901: Validate artifact presence before deployment
Before invokingscp, add a check to confirm thatTARGET_DIRcontains.warfiles. If no artifacts are found, fail the build or emit a clear warning to avoid silent deployment of empty directories.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Jenkinsfile(1 hunks)
🔇 Additional comments (1)
Jenkinsfile (1)
8-12: Verify Jenkins tool installation names
Ensure that'JDK_17','NODE_20', and'MAVEN_3.9.8'match the tool names configured in your Jenkins global tool configuration to avoid runtime errors.
| stage('Admin-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Admin-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('BeneficiaryID-Generation-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/BeneficiaryID-Generation-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Pbengenapi -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Common-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Common-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('ECD-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/ECD-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('FHIR-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/FHIR-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Helpline104-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Helpline104-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Helpline1097-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Helpline1097-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Identity-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Identity-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('HWC-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/HWC-API.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| stage('Scheduler-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Scheduler-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Inventory-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Inventory-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('MMU-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/MMU-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('TM-API') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/TM-API.git', | ||
| credentialsId: '' | ||
| ]] | ||
| ]) | ||
| sh 'mvn clean package -DENV_VAR=ci -Dmaven.test.skip -e' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Factor API build stages into reusable logic
The API stages (from Admin-API to TM-API) mirror each other in checkout, Maven invocation, and artifact handling. Extract common behavior into a function or shared library to apply consistent flags (-Dmaven.test.skip, profiles), reduce boilerplate, and simplify future maintenance.
| stage('Undeploy All') { | ||
| steps { | ||
| script { | ||
|
|
||
|
|
||
| // Delete all files in the remote folder | ||
| sh ''' | ||
| sshpass -p "${WILDFLY_PASSWORD}" ssh -o StrictHostKeyChecking=no ${WILDFLY_USER}@${WILDFLY_HOST} "del /q ${REMOTE_DEPLOY_DIR}\\*" | ||
| ''' | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Jenkins SSH credentials instead of sshpass
Passing passwords via sshpass and disabling StrictHostKeyChecking is insecure. Leverage the Jenkins SSH Agent or SSH Credentials Binding plugin to manage keys or passwords, remove -o StrictHostKeyChecking=no, and adhere to best security practices.
| } else if (params.project == 'Dev') { | ||
| } else if (params.project == 'UAT') { | ||
|
|
||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement or guard unconfigured Dev and UAT branches
The else if blocks for Dev and UAT are empty, leading to missing configuration when those environments are selected. Either populate these blocks with the correct settings or add a guard clause to error out if an unsupported environment is chosen.
| if (params.project == 'CICD_Test') { | ||
|
|
||
|
|
||
| env.WILDFLY_HOST = 'IP' | ||
| env.WILDFLY_USER = 'USER' | ||
| withCredentials([string(credentialsId: 'USER1', variable: 'WILDFLY_PASSWORD')]) { | ||
| env.WILDFLY_PASSWORD=WILDFLY_PASSWORD | ||
| } | ||
| env.TARGET_DIR = 'target' | ||
| env.REMOTE_DEPLOY_DIR='E:\\AppServer\\wildfly-30.0.0.Final\\wildfly-30.0.0.Final\\standalone\\deployments' | ||
| env.REMOTE_DEPLOY_DIR2='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/standalone/deployments' | ||
|
|
||
| env.COMMON_API="https://amritdemo.piramalswasthya.org/commonapi-v3.0.0/" | ||
| env.COMMON_API_BASE="https://amritdemo.piramalswasthya.org/commonapi-v3.0.0/" | ||
| env.COMMON_API_BASE_URL="https://amritdemo.piramalswasthya.org/commonapi-v3.0.0/" | ||
|
|
||
|
|
||
| env.ADMIN_API="https://amritdemo.piramalswasthya.org/adminapi-v3.0.0/" | ||
| env.ADMIN_API_BASE="https://amritdemo.piramalswasthya.org/adminapi-v3.0.0/" | ||
| env.ADMIN_API_BASE_URL="https://amritdemo.piramalswasthya.org/adminapi-v3.0.0/" | ||
|
|
||
| env.ECD_API="https://amritdemo.piramalswasthya.org/ecdapi/" | ||
| env.ECD_API_BASE="https://amritdemo.piramalswasthya.org/ecdapi/" | ||
| env.ECD_API_BASE_URL="https://amritdemo.piramalswasthya.org/ecdapi/" | ||
|
|
||
| env.COMMON_API_OPEN="https://amritdemo.piramalswasthya.org/commonapi-v3.0.0/" | ||
|
|
||
| env.INVENTORY_API="https://amritdemo.piramalswasthya.org/Inventoryapi-v3.0.0/" | ||
| env.INVENTORY_API_BASE="https://amritdemo.piramalswasthya.org/Inventoryapi-v3.0.0/" | ||
| env.INVENTORY_API_BASE_URL="https://amritdemo.piramalswasthya.org/Inventoryapi-v3.0.0/" | ||
|
|
||
| env.MMU_API="https://amritdemo.piramalswasthya.org/mmuapi-v3.0.0/" | ||
| env.MMU_API_BASE="https://amritdemo.piramalswasthya.org/mmuapi-v3.0.0/" | ||
| env.MMU_API_BASE_URL="https://amritdemo.piramalswasthya.org/mmuapi-v3.0.0/" | ||
|
|
||
| env.FHIR_API="https://amritdemo.piramalswasthya.org/fhirapi-v3.0.0/" | ||
| env.FHIR_API_BASE="https://amritdemo.piramalswasthya.org/fhirapi-v3.0.0/" | ||
| env.FHIR_API_BASE_URL="https://amritdemo.piramalswasthya.org/fhirapi-v3.0.0/" | ||
|
|
||
| env.SCHEDULER_API="https://amritdemo.piramalswasthya.org/schedulerapi-v3.0.0/" | ||
| env.SCHEDULER_API_BASE="https://amritdemo.piramalswasthya.org/schedulerapi-v3.0.0/" | ||
| env.SCHEDULER_API_BASE_URL="https://amritdemo.piramalswasthya.org/schedulerapi-v3.0.0/" | ||
|
|
||
| env.TM_API="https://amritdemo.piramalswasthya.org/tmapi-v3.0.0/" | ||
| env.TM_API_BASE="https://amritdemo.piramalswasthya.org/tmapi-v3.0.0/" | ||
| env.TM_API_BASE_URL="https://amritdemo.piramalswasthya.org/tmapi-v3.0.0/" | ||
|
|
||
| env.HWC_API="https://amritdemo.piramalswasthya.org/hwc-facility-service-v3.0.0/" | ||
| env.HWC_API_BASE="https://amritdemo.piramalswasthya.org/hwc-facility-service-v3.0.0/" | ||
| env.HWC_API_BASE_URL="https://amritdemo.piramalswasthya.org/hwc-facility-service-v3.0.0/" | ||
|
|
||
| env.GRIEVANCE_API_BASE_URL="https://grievance1097naco.piramalswasthya.org" | ||
| env.GRIEVANCE_USERNAME="" | ||
| env.GRIEVANCE_PASSWORD="" | ||
| env.GRIEVANCE_USER_AUTHENTICATE="" | ||
| env.GRIEVANCE_DATA_SYNC_DURATION=15 | ||
| env.SESSION_STORAGE_ENC_KEY="" | ||
| env.JWT_SECRET_KEY="" | ||
|
|
||
| env.SERVER_IP="" | ||
| env.SWYMED_IP="IP" | ||
| env.COMMON_API_OPEN_SYNC="https://amritdemo.piramalswasthya.org/commonapi-v3.0.0/" | ||
| env.SCHEDULER_UI="https://amritdemo.piramalswasthya.org/hwc-scheduler/" | ||
| env.INVENTORY_UI="https://amritdemo.piramalswasthya.org/hwc-inventory/" | ||
|
|
||
| env.IDENTITY_API="https://amritdemo.piramalswasthya.org/identity-v3.0.0/" | ||
| env.IDENTITY_API_BASE="https://amritdemo.piramalswasthya.org/identity-v3.0.0/" | ||
| env.IDENTITY_API_BASE_URL="https://amritdemo.piramalswasthya.org/identity-v3.0.0/" | ||
|
|
||
| env.HELPLINE104_API="https://amritdemo.piramalswasthya.org/104api-v3.0.0/" | ||
| env.HELPLINE104_API_BASE="https://amritdemo.piramalswasthya.org/104api-v3.0.0/" | ||
| env.MMU_UI="https://amritdemo.piramalswasthya.org/mmu" | ||
| env.IOT_API="" | ||
| env.DATABASE_URL="jdbc:mysql://localhost:3306/db_iemr?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" | ||
| env.DATABASE_USERNAME="dbuser" | ||
| withCredentials([string(credentialsId: 'DB_PASS_CICD_TEST', variable: 'DATABASE_PASSWORD')]) { | ||
| env.DATABASE_PASSWORD=DATABASE_PASSWORD | ||
| } | ||
| env.DATABASE_IDENTITY_URL="jdbc:mysql://localhost:3306/db_identity?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" | ||
| env.DATABASE_1097_IDENTITY_URL="jdbc:mysql://localhost:3306/db_1097_identity?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" | ||
| env.DATABASE_IDENTITY_USERNAME="dbuser" | ||
| withCredentials([string(credentialsId: 'DATABASE_IDENTITY_PASSWORD_CICD_TEST', variable: 'DATABASE_IDENTITY_PASSWORD')]) { | ||
| env.DATABASE_IDENTITY_PASSWORD=DATABASE_IDENTITY_PASSWORD | ||
| } | ||
| env.CALLCENTRE_SERVER_IP="IP" | ||
| withCredentials([string(credentialsId: 'SWYMED_APIKEY_CICD_TEST', variable: 'SWYMED_APIKEY')]) { | ||
| env.SWYMED_APIKEY=SWYMED_APIKEY | ||
| } | ||
| env.SWYMED_BASE_URL="https://psmri.swymed.com:9274" | ||
| env.REPORTING_DATABASE_USERNAME="dbuser" | ||
| withCredentials([string(credentialsId: 'REPORTING_DATABASE_PASSWORD_CICD_TEST', variable: 'REPORTING_DATABASE_PASSWORD')]) { | ||
| env.REPORTING_DATABASE_PASSWORD=REPORTING_DATABASE_PASSWORD | ||
| } | ||
| env.REPORTING_DATABASE_URL="jdbc:mysql://localhost:3306/db_reporting?autoReconnect=true&useSSL=false" | ||
| env.KM_API_BASE_URL="http://localhost:8084/OpenKM" | ||
| env.KM_API_BASE_PATH="localhost:8084/OpenKM" | ||
| env.CTI_SERVER_IP="IP" | ||
| env.CTI_SERVER_LOGGER_BASE="http://IP/logger" | ||
| env.IDENTITY_API_URL="http://localhost:8080/identity-v3.0.0" | ||
| env.IDENTITY_1097_API_URL="http://localhost:8080/1097identityapi-v3.0.0" | ||
| env.BEN_GEN_API_URL="http://localhost:8080/bengenapi-v3.0.0" | ||
| env.MMU_API="http://localhost:8080/mmuapi-v3.0.0" | ||
|
|
||
| env.MMU_CENTRAL_SERVER="http://localhost:8080/mmuapi-v3.0.0" | ||
| env.TM_CENTRAL_SERVER="http://localhost:8080/tmapi-v3.0.0" | ||
| env.SCHEDULER_API="http://localhost:8080/schedulerapi-v3.0.0" | ||
| withCredentials([string(credentialsId: 'FETOSENSE_API_KEY_CICD_TEST', variable: 'FETOSENSE_API_KEY')]) { | ||
| env.FETOSENSE_API_KEY=FETOSENSE_API_KEY | ||
| } | ||
|
|
||
| env.TM_API="http://localhost:8080/telemedicineapi-v1.0" | ||
| env.SERVICE_POINT_ID= 235 | ||
| env.PARKING_PLACE_ID= 233 | ||
| env.PROVIDER_SERVICE_MAP_ID= 1261 | ||
| env.VAN_ID= 220 | ||
| env.SERVICE_ID= 4 | ||
| env.PROVIDER_ID= 500 | ||
| env.APP_ID= 85696 | ||
| env.AUTH_KEY= "" | ||
| env.AUTH_SECRET= "" | ||
| env.MMU_FILE_BASE_PATH="C:/apps/Neeraj/mmuDoc" | ||
| env.HWC_IDENTITY_API="" | ||
| env.FILE_SYNC_SERVER_IP="" | ||
| env.FILE_SYNC_SERVER_DOMAIN="" | ||
| env.FILE_SYNC_SERVER_USERNAME="" | ||
| env.FILE_SYNC_SERVER_PASSWORD="" | ||
| env.LOCAL_FOLDER_TO_SYNC="" | ||
| env.SEND_SMS="TRUE" | ||
| env.CARESTREAM_SOCKET_IP="IP" | ||
| env.CARESTREAM_SOCKET_PORT="1235" | ||
| env.SEND_SMS_URL="http://localhost:8080/commonapi-v3.0.0/sms/sendSMS" | ||
| env.SMS_USERNAME="" | ||
| withCredentials([string(credentialsId: 'SMS_PASSWORD_CICD_TEST', variable: 'SMS_PASSWORD')]) { | ||
| env.SMS_PASSWORD=SMS_PASSWORD | ||
| } | ||
| env.SMS_SOURCE_ADDRESS="" | ||
| env.SMS_MESSAGE_URL="https://openapi.airtel.in/gateway/airtel-iq-sms-utility/sendSingleSms" | ||
| env.SEND_EMAIL="" | ||
| env.MAIL_HOST="" | ||
| env.MAIL_PORT="" | ||
| env.MAIL_USERNAME="" | ||
| env.MAIL_PASSWORD="" | ||
| env.EVERWELL_USERNAME="" | ||
| env.EVERWELL_PASSWORD="" | ||
| env.EVERWELL_AMRIT_USERNAME="" | ||
| env.EVERWELL_AMRIT_PASSWORD="" | ||
| env.EVERWELL_BASE_URL="" | ||
| env.SWAASA_EMAIL="" | ||
| env.SWAASA_PASSWORD="" | ||
| env.ESANJEEVANI_URL="" | ||
| env.ESANJEEVANI_USERNAME="" | ||
| env.ESANJEEVANI_PASSWORD="" | ||
| env.ESANJEEVANI_SALT="" | ||
| env.ESANJEEVANI_SOURCE="" | ||
| env.ESANJEEVANI_REGISTER_PATIENT_URL="" | ||
| env.ESANJEEVANI_ROUTE_URL="" | ||
| env.BIOMETRIC_URL="" | ||
| env.EAUSHADHI_URL="" | ||
| env.FHIR_USER_NAME="" | ||
| env.FHIR_PASSWORD="" | ||
| env.MONGO_HOST="IP" | ||
| env.MONGO_AUTH_DBNAME="" | ||
| env.MONGO_DBNAME="" | ||
| env.MONGO_USERNAME="" | ||
| withCredentials([string(credentialsId: 'MONGO_PASSWORD_CICD_TEST', variable: 'MONGO_PASSWORD')]) { | ||
| env.MONGO_PASSWORD=MONGO_PASSWORD | ||
| } | ||
| env.BAHMINI_URL="" | ||
| env.FEED_AUTH_URL="" | ||
| env.FEED_AUTH_PASSWORD="" | ||
| env.NDHM_ABHA_CLIENT_ID="" | ||
| env.NDHM_ABHA_CLIENT_SECRET_KEY="" | ||
| env.ABDM_BASE_URL="https://abhasbx.abdm.gov.in" | ||
| env.ABDM_HEALTH_ID_BASE_URL="https://healthidsbx.abdm.gov.in" | ||
|
|
||
| env.NHM_AGENT_REAL_TIME_DATA_URL="http://IP/apps/utility/alive_api.php" | ||
|
|
||
| env.BASE_URL = 'AnotherValueForType1' | ||
| env.TERM='xterm' | ||
| env.COMMON_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/common-api.log' | ||
| env.ADMIN_UI_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/admin-ui.log' | ||
| env.ADMIN_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/admin-api.log' | ||
| env.HELPLINEMCTS_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/helplinemcts-api.log' | ||
| env.TM_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/tm-api.log' | ||
| env.FHIR_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/fhir-api.log' | ||
| env.IDENTITY_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/identity-api.log' | ||
| env.HWC_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/hwc-api.log' | ||
| env.INVENTORY_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/inventory-api.log' | ||
| env.BENEFICIARYID_GENERATION_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/beneficiaryid-generation-api.log' | ||
| env.HELPLINE104_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/helpline104-api.log' | ||
| env.MMU_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/mmu-api.log' | ||
| env.HELPLINE1097_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/helpline1097-api.log' | ||
| env.SCHEDULER_UI_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/scheduler-ui.log' | ||
| env.SCHEDULER_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/scheduler-api.log' | ||
| env.ECD_API_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/ecd-api.log' | ||
| env.ECD_UI_LOGGING_FILE_NAME='E:/AppServer/wildfly-30.0.0.Final/wildfly-30.0.0.Final/Logs/ecd-ui.log' | ||
|
|
||
| env.SWAGGER_DOC_ENABLED='true' | ||
|
|
||
|
|
||
|
|
||
|
|
||
| } else if (params.project == 'Dev') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Externalize and DRY environment configuration
Embedding over 200 lines of environment variable assignments for CICD_Test makes this stage very hard to review and maintain. Consider:
- Loading these settings from an external YAML/JSON configuration.
- Defining a single
Mapin Groovy for each environment. - Iterating over the map to assign
env.*values.
This will reduce duplication, simplify updates, and make adding new environments trivial.
| stage('Load Environment Variables') { | ||
| steps { | ||
| echo "Setting environment variables based on the selected project" | ||
|
|
||
| script { | ||
|
|
||
| sh "rm -rf ${env.WORKSPACE}/repos" | ||
| sh "mkdir -p ${env.WORKSPACE}/repos" | ||
| sh "rm -rf ${env.WORKSPACE}/target " | ||
| sh "mkdir -p ${env.WORKSPACE}/target" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Replace shell cleanup with Jenkins workspace steps
Using sh "rm -rf ..." and sh "mkdir -p ..." is error-prone and platform-dependent. Prefer deleteDir() or the cleanWs() pipeline step to reset the workspace and manage directories in a more Jenkins-native way.
| stage('Admin-UI') { | ||
|
|
||
| steps { | ||
| dir('repos'){ | ||
|
|
||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/ADMIN-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| stage('ECD-UI') { | ||
|
|
||
| steps { | ||
| dir('repos'){ | ||
|
|
||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/ECD-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| stage('HWC-Inventory-UI') { | ||
|
|
||
| steps { | ||
| dir("${env.WORKSPACE}/repos") { | ||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/HWC-Inventory-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'npm config set legacy-peer-deps true' | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "echo ${env.WORKSPACE}" | ||
|
|
||
| sh " cp target/*.war ${env.WORKSPACE}/target/ " | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('HWC-Scheduler-UI') { | ||
|
|
||
| steps { | ||
| dir('repos') { | ||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/HWC-Scheduler-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| stage('HWC-UI') { | ||
|
|
||
| steps { | ||
| script { | ||
|
|
||
| dir('repos/') { | ||
| cleanWs() | ||
|
|
||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/HWC-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/Common-UI') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Common-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/') { | ||
|
|
||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Inventory-UI') { | ||
|
|
||
| steps { | ||
| dir('repos'){ | ||
|
|
||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Inventory-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('MMU-UI') { | ||
|
|
||
| steps { | ||
| script { | ||
|
|
||
| dir('repos/') { | ||
| cleanWs() | ||
|
|
||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'feature/test']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:psmri/MMU-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/Common-UI') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:psmri/Common-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/') { | ||
|
|
||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Scheduler-UI') { | ||
|
|
||
| steps { | ||
| dir('repos'){ | ||
|
|
||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Scheduler-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('TM-UI') { | ||
|
|
||
| steps { | ||
| script { | ||
|
|
||
| dir('repos/') { | ||
| cleanWs() | ||
|
|
||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/TM-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/Common-UI') { | ||
|
|
||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Common-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
|
|
||
| } | ||
| dir('repos/') { | ||
| sh 'git submodule init' | ||
| sh 'git submodule update --recursive' | ||
| sh 'npm install --force' | ||
| sh 'npm run build-ci' | ||
| sh 'mvn -B package --file pom.xml -P ci' | ||
| archiveArtifacts 'target/*.war' | ||
| sh "cp target/*.war ${env.WORKSPACE}/target/" | ||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Helpline104-UI') { | ||
|
|
||
| steps { | ||
| dir('repos'){ | ||
|
|
||
|
|
||
| cleanWs() | ||
| checkout([$class: 'GitSCM', | ||
| branches: [[name: 'develop']], | ||
| userRemoteConfigs: [[ | ||
| url: 'git@github.com:PSMRI/Helpline104-UI.git', | ||
| credentialsId: '' // Specify your SSH credentials ID | ||
| ]] | ||
| ]) | ||
| script { | ||
| // sh 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash' | ||
| sh ''' | ||
| export NVM_DIR="/var/lib/jenkins/.nvm" | ||
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
| git submodule init | ||
| git submodule update --recursive | ||
| nvm install 14 | ||
| nvm use 14 | ||
| npm i | ||
| npm run build | ||
| ''' | ||
| sh ''' | ||
| cd dist/ | ||
| mkdir WEB_INF/ | ||
| touch WEB_INF/web.xml | ||
| jar -cvf Helpline104.war * | ||
| ''' | ||
| archiveArtifacts 'dist/*.war' | ||
| sh "cp dist/*.war ${env.WORKSPACE}/target/" | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Abstract repetitive UI build stages and enable parallelism
Each UI project—from Admin-UI through Helpline104-UI—repeats the same checkout, build, and archive steps. You can:
- Define a list of UI repos and loop over them.
- Encapsulate the logic in a shared library or helper method.
- Use a
parallel {}block to run independent UI builds concurrently and reduce overall pipeline duration.
📋 Description
✅ Type of Change
Summary by CodeRabbit
Documentation
Chores
New Features