Scale.groovy 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. String cron_timezone = 'TZ=Asia/Shanghai'
  2. String cron_string = BRANCH_NAME == "master" ? "05 21 * * * " : ""
  3. int total_timeout_minutes = 90
  4. // pipeline
  5. pipeline {
  6. triggers {
  7. cron """${cron_timezone}
  8. ${cron_string}"""
  9. }
  10. options {
  11. timestamps()
  12. timeout(time: total_timeout_minutes, unit: 'MINUTES')
  13. }
  14. agent {
  15. kubernetes {
  16. // label 'milvus-scale-test'
  17. // inheritFrom 'milvus-test'
  18. defaultContainer 'milvus-test'
  19. yamlFile "build/ci/jenkins/pod/scale-test.yaml"
  20. customWorkspace "/home/jenkins/agent"
  21. // idle 5 minutes to wait clean up tasks
  22. idleMinutes 5
  23. }
  24. }
  25. environment {
  26. PROJECT_NAME = "milvus"
  27. TEST_TYPE = "scale-test"
  28. // SEMVER = "${BRANCH_NAME.contains('/') ? BRANCH_NAME.substring(BRANCH_NAME.lastIndexOf('/') + 1) : BRANCH_NAME}"
  29. ARTIFACTS = "${env.WORKSPACE}/_artifacts"
  30. MILVUS_LOGS = "/tmp/milvus_logs/*"
  31. }
  32. stages {
  33. stage ('Install'){
  34. steps {
  35. container('milvus-test') {
  36. dir ('tests/python_client'){
  37. sh """
  38. pip install --upgrade setuptools
  39. pip install --upgrade pip
  40. pip install -r requirements.txt
  41. """
  42. }
  43. }
  44. }
  45. }
  46. stage ('Scale Test') {
  47. steps {
  48. container('milvus-test') {
  49. dir ('tests/python_client/scale') {
  50. script {
  51. // pytest run scale case in parallel
  52. sh 'pytest test_data_node_scale.py -v -s'
  53. sh 'pytest test_index_node_scale.py -n 2 -v -s'
  54. sh 'pytest test_proxy_scale.py -v -s'
  55. sh 'pytest test_query_node_scale.py -n 3 -v -s'
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. post {
  63. unsuccessful {
  64. container ('jnlp') {
  65. script {
  66. emailext subject: '$DEFAULT_SUBJECT',
  67. body: '$DEFAULT_CONTENT',
  68. // recipientProviders: [requestor()],
  69. // replyTo: '$DEFAULT_REPLYTO',
  70. to: 'qa@zilliz.com'
  71. }
  72. }
  73. }
  74. always {
  75. container('milvus-test') {
  76. dir ('tests/scripts') {
  77. script {
  78. dir("${env.ARTIFACTS}") {
  79. sh "tar -zcvf artifacts-${PROJECT_NAME}-${TEST_TYPE}-pytest-logs.tar.gz /tmp/ci_logs --remove-files || true"
  80. archiveArtifacts artifacts: "artifacts-${PROJECT_NAME}-${TEST_TYPE}-pytest-logs.tar.gz ", allowEmptyArchive: true
  81. DIR_LIST = sh(returnStdout: true, script: 'ls -d1 ${MILVUS_LOGS}').trim()
  82. for (d in DIR_LIST.tokenize("\n")) {
  83. sh "echo $d"
  84. def release_name = d.split('/')[-1]
  85. sh "tar -zcvf artifacts-${PROJECT_NAME}-${TEST_TYPE}-${release_name}-logs.tar.gz ${d} --remove-files || true"
  86. archiveArtifacts artifacts: "artifacts-${PROJECT_NAME}-${TEST_TYPE}-${release_name}-logs.tar.gz ", allowEmptyArchive: true
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }