diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..eaa93870 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,45 @@ +pipeline { + agent any + + stages { + + stage('SonarAnalysis') { + steps { + echo 'SonarAnalysis..' + sh 'cd webapp && sudo docker run --rm -e SONAR_HOST_URL="http://3.12.35.119:9000" -e SONAR_LOGIN="sqp_61675ccbe677383921c6eb020644d0a56cd116c0" -v ".:/usr/src" sonarsource/sonar-scanner-cli -Dsonar.projectKey=lms' + } + } + stage('Build') { + steps { + echo 'Building..' + sh 'cd webapp && npm install && npm run build' + } + } + stage('Release LMS') { + steps { + script { + echo "Releasing.." + def packageJSON = readJSON file: 'webapp/package.json' + def packageJSONVersion = packageJSON.version + echo "${packageJSONVersion}" + sh "zip webapp/dist-${packageJSONVersion}.zip -r webapp/dist" + sh "curl -v -u admin:Admin123* --upload-file webapp/dist-${packageJSONVersion}.zip http://3.12.35.119:8081/repository/lms/" + } + } + } + stage('Deploy') { + steps { + script { + echo "Deploying.." + def packageJSON = readJSON file: 'webapp/package.json' + def packageJSONVersion = packageJSON.version + echo "${packageJSONVersion}" + sh "curl -u admin:Admin123* -X GET \'http://3.12.35.119:8081/repository/lms/dist-${packageJSONVersion}.zip\' --output dist-'${packageJSONVersion}'.zip" + sh 'sudo rm -rf /var/www/html/*' + sh "sudo unzip -o dist-'${packageJSONVersion}'.zip" + sh "sudo cp -r webapp/dist/* /var/www/html" + } + } + } + } +} \ No newline at end of file diff --git a/webapp/index.html b/webapp/index.html index 14402119..74cd1e20 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -9,7 +9,7 @@ @@ -19,4 +19,4 @@ - \ No newline at end of file + diff --git a/webapp/package.json b/webapp/package.json index 3986e58f..3bc09ad0 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,7 +1,7 @@ { "name": "webapp", "private": true, - "version": "0.0.0", + "version": "4.1", "type": "module", "scripts": { "dev": "vite",