deploy.yml 2.9 KB

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