数字人管理平台
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.
 
 
 
 
 
 

45 lines
1.7 KiB

  1. node {
  2. // 版本
  3. def tag = "0.8"
  4. // 镜像仓库的地址
  5. // def harbor_url = "192.168.81.102:85"
  6. // 镜像仓库的项目,这里建议项目名称和jenkins的item项目名称、以及harbor的项目名称保持一致,否则用一下脚本会出问题
  7. // def harbor_project = "demo"
  8. // 拉取代码
  9. stage('pull code') {
  10. checkout([$class: 'GitSCM', branches: [[name: '*/${branch}']], extensions: [], userRemoteConfigs: [[credentialsId: '0f6d6eaa8754e735262afa495fe2828d611fca17', url: 'http://39.105.23.186:3000/develop/digimeta-MultiSaas.git']]])
  11. }
  12. // 代码静态检查
  13. stage('code check') {
  14. steps {
  15. }
  16. }
  17. // 编译并推送镜像仓库
  18. stage('build project') {
  19. if ("${project_name}" == 'digimeta-MultiSaas' ) {
  20. echo '打包根目录'
  21. sh 'mvn clean package'
  22. } else {
  23. echo "打包子目录 ${project_name}"
  24. sh "mvn clean package"
  25. }
  26. //echo "把jar上传镜像仓库"
  27. //def oldImageName = "${project_name}:latest"
  28. //def newImageName = "${harbor_url}/${harbor_project}/${project_name}:${tag}"
  29. // 改名称 做规范
  30. //sh "docker tag ${oldImageName} ${newImageName}"
  31. // 删除之前的 镜像
  32. //sh "docker rmi ${oldImageName}"
  33. // 推送到 dockers仓库
  34. //withCredentials([usernamePassword(credentialsId: '8a3d7ab1-4cd6-482c-86c9-a12aa6404d98', passwordVariable: 'harbor_password', usernameVariable: 'harbor_account')]) {
  35. // 登录
  36. //sh "docker login -u ${harbor_account} -p ${harbor_password} ${harbor_url}"
  37. // 上传
  38. //sh "docker push ${newImageName}"
  39. //echo "镜像推送成功"
  40. //}
  41. }
  42. }