You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.6 KiB

3 weeks ago
  1. pipeline {
  2. environment {
  3. develop_server_ip = ''
  4. develop_server_name = ''
  5. production_server_ip = "88.99.212.243"
  6. production_server_name = "newhorizon_germany_001_server"
  7. project_path = "/projects/mesbahi/mesbahi_dashboard_frontend"
  8. version = "master"
  9. gitBranch = "origin/master"
  10. }
  11. agent any
  12. stages {
  13. stage('deploy'){
  14. steps{
  15. script{
  16. if(gitBranch=="origin/master"){
  17. withCredentials([usernamePassword(credentialsId: production_server_name, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
  18. sh 'sshpass -p $PASSWORD ssh -p 1782 $USERNAME@$production_server_ip -o StrictHostKeyChecking=no "cd $project_path && ./runner.sh"'
  19. def lastCommit = sh(script: 'git log -1 --pretty=format:"%h - %s (%an)"', returnStdout: true).trim()
  20. sh """
  21. curl -F chat_id=1457670318 \
  22. -F document=@/var/jenkins_home/jobs/${env.JOB_NAME}/builds/${env.BUILD_NUMBER}/log \
  23. -F caption='Project name: #${env.JOB_NAME} \nBuild status is ${currentBuild.currentResult} \nBuild url: ${BUILD_URL} \nLast Commit: ${lastCommit}' \
  24. https://api.telegram.org/bot7207581748:AAFeymryw7S44D86LYfWqYK-tSNeV3TOwBs/sendDocument
  25. """
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
  32. }
  33. //TestLine