deploy.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_update_SHA_in_esp-dockerfiles:
  41. extends:
  42. - .deploy_job_template
  43. - .rules:protected-no_label-always
  44. script:
  45. - 'curl --header "PRIVATE-TOKEN: ${ESPCI_SCRIPTS_TOKEN}" -o create_MR_in_esp_dockerfile.sh $GITLAB_HTTP_SERVER/api/v4/projects/1260/repository/files/create_MR_in_esp_dockerfile%2Fcreate_MR_in_esp_dockerfile.sh/raw\?ref\=master'
  46. - chmod +x create_MR_in_esp_dockerfile.sh
  47. - ./create_MR_in_esp_dockerfile.sh
  48. deploy_test_result:
  49. extends:
  50. - .deploy_job_template
  51. - .before_script_minimal
  52. - .rules:ref:master-always
  53. image: $CI_DOCKER_REGISTRY/bot-env:1
  54. dependencies: []
  55. tags:
  56. - deploy_test
  57. artifacts:
  58. when: always
  59. paths:
  60. - ${CI_PROJECT_DIR}/test-management/*.log
  61. expire_in: 1 week
  62. variables:
  63. BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
  64. TEST_RESULTS_PATH: "${CI_PROJECT_DIR}/TEST_RESULTS"
  65. script:
  66. - add_gitlab_ssh_keys
  67. - export GIT_SHA=$(echo ${CI_COMMIT_SHA} | cut -c 1-8)
  68. - export REV_COUNT=$(git rev-list --count ${GIT_SHA} --)
  69. - export SUMMARY="IDF CI test result for $GIT_SHA (r${REV_COUNT})"
  70. # Download test result
  71. - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
  72. - python3 ${IDF_PATH}/tools/ci/get_all_test_results.py --path ${TEST_RESULTS_PATH} --include_retried
  73. - if [[ -z $(find ${TEST_RESULTS_PATH} -name "*.xml") ]]; then exit 0; fi
  74. # Clone test-management repo
  75. - retry_failed git clone $TEST_MANAGEMENT_REPO
  76. - python3 $CHECKOUT_REF_SCRIPT test-management test-management
  77. - cd test-management
  78. - echo $BOT_JIRA_ACCOUNT > ${BOT_ACCOUNT_CONFIG_FILE}
  79. # Make sure all requirements are installed
  80. - pip3 install -r requirements.txt
  81. # Update test cases
  82. - python3 ImportTestCase.py $JIRA_TEST_MANAGEMENT_PROJECT from_xml -d ${TEST_RESULTS_PATH} -r $GIT_SHA -l IDFCI
  83. # update test results
  84. - 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}
  85. # May need a long time to upload all test results.
  86. timeout: 4 hours