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.

27 lines
1.2 KiB

3 days 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/aqila/aqila_frontend/"
  8. version = "main"
  9. gitBranch = "origin/main"
  10. }
  11. agent any
  12. stages {
  13. stage('deploy'){
  14. steps{
  15. script{
  16. if(gitBranch=="origin/main"){
  17. withCredentials([usernamePassword(credentialsId: production_server_name, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
  18. sh 'sshpass -p $PASSWORD ssh $USERNAME@$production_server_ip -o StrictHostKeyChecking=no "cd $project_path && ./runner.sh"'
  19. sh "curl -F chat_id=-1002316394394 -F message_thread_id=11 -F document=@/var/jenkins_home/jobs/${env.JOB_NAME}/builds/${env.BUILD_NUMBER}/log -F caption='Project name: #${env.JOB_NAME} \nBuild status is ${currentBuild.currentResult} \nBuild url: ${BUILD_URL}' https://api.telegram.org/bot7207581748:AAFeymryw7S44D86LYfWqYK-tSNeV3TOwBs/sendDocument"
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }