deploy.yml 3.3 KB

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