deploy.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .deploy_job_template:
  2. stage: deploy
  3. image: $ESP_ENV_IMAGE
  4. tags:
  5. - deploy
  6. # Check this before push_to_github
  7. check_submodule_sync:
  8. extends:
  9. - .deploy_job_template
  10. - .rules:test:submodule
  11. stage: test_deploy
  12. tags:
  13. - github_sync
  14. retry: 2
  15. variables:
  16. GIT_STRATEGY: clone
  17. SUBMODULES_TO_FETCH: "none"
  18. PUBLIC_IDF_URL: "https://github.com/espressif/esp-idf.git"
  19. dependencies: []
  20. script:
  21. - git submodule deinit --force .
  22. # setting the default remote URL to the public one, to resolve relative location URLs
  23. - git config remote.origin.url ${PUBLIC_IDF_URL}
  24. # check if all submodules are correctly synced to public repository
  25. - git submodule init
  26. - git config --get-regexp '^submodule\..*\.url$' || true
  27. - git submodule update --recursive
  28. - echo "IDF was cloned from ${PUBLIC_IDF_URL} completely"
  29. push_to_github:
  30. extends:
  31. - .deploy_job_template
  32. - .before_script_minimal
  33. - .rules:protected-no_label
  34. dependencies: []
  35. script:
  36. - add_github_ssh_keys
  37. - git remote remove github &>/dev/null || true
  38. - git remote add github git@github.com:espressif/esp-idf.git
  39. - tools/ci/push_to_github.sh
  40. deploy_test_result:
  41. extends:
  42. - .deploy_job_template
  43. - .before_script_minimal
  44. - .rules:ref:master-always
  45. image: $CI_DOCKER_REGISTRY/bot-env:1
  46. dependencies: []
  47. tags:
  48. - deploy_test
  49. artifacts:
  50. when: always
  51. paths:
  52. - ${CI_PROJECT_DIR}/test-management/*.log
  53. expire_in: 1 week
  54. variables:
  55. BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
  56. TEST_RESULTS_PATH: "${CI_PROJECT_DIR}/TEST_RESULTS"
  57. script:
  58. - add_gitlab_ssh_keys
  59. - export GIT_SHA=$(echo ${CI_COMMIT_SHA} | cut -c 1-8)
  60. - export REV_COUNT=$(git rev-list --count ${GIT_SHA} --)
  61. - export SUMMARY="IDF CI test result for $GIT_SHA (r${REV_COUNT})"
  62. # Download test result
  63. - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
  64. - python3 ${IDF_PATH}/tools/ci/get_all_test_results.py --path ${TEST_RESULTS_PATH} --include_retried
  65. - if [[ -z $(find ${TEST_RESULTS_PATH} -name "*.xml") ]]; then exit 0; fi
  66. # Clone test-management repo
  67. - retry_failed git clone $TEST_MANAGEMENT_REPO
  68. - python3 $CHECKOUT_REF_SCRIPT test-management test-management
  69. - cd test-management
  70. - echo $BOT_JIRA_ACCOUNT > ${BOT_ACCOUNT_CONFIG_FILE}
  71. # Make sure all requirements are installed
  72. - pip3 install -r requirements.txt
  73. # Update test cases
  74. - python3 ImportTestCase.py $JIRA_TEST_MANAGEMENT_PROJECT from_xml -d ${TEST_RESULTS_PATH} -r $GIT_SHA -l IDFCI
  75. # update test results
  76. - python3 ImportTestResult.py -r "$GIT_SHA (r${REV_COUNT})" -j $JIRA_TEST_MANAGEMENT_PROJECT -s "$SUMMARY" -l IDFCI -p ${TEST_RESULTS_PATH} --pipeline_url ${CI_PIPELINE_URL}
  77. # May need a long time to upload all test results.
  78. timeout: 4 hours