From d093dcbbb721a0227cced2d62365ed9eced327cf Mon Sep 17 00:00:00 2001 From: Yinling Date: Sun, 6 Nov 2016 22:43:12 +0800 Subject: [PATCH 1/3] try to checkout same branch for submodule in CI jobs --- .gitlab-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad5a13ad03..b06eccb75f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,12 +12,16 @@ before_script: - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - + # CI may download a cached project. Need to re-sync submodule + - git submodule deinit -f . # if testing master branch, use github wifi libs. # if testing other branches, use gitlab wifi libs (as maybe changes aren't merged to master yet) - test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-wifi-lib%ssh://git@gitlab.espressif.cn:27227/idf/esp32-wifi-lib%" .gitmodules # fetch all submodules - git submodule update --init --recursive + # try use submodule with same branch + - SUBMODULES=`cat .gitmodules | grep path | awk '{print $3}'` + - for MODULE in $SUBMODULES;do (cd $MODULE;git fetch;git checkout ${CI_BUILD_REF_NAME} || echo "using default branch";cd $CI_PROJECT_DIR); done build_template_app: stage: build From 3051c74488e8e0f44839d03ff1faeeb8a3ff9f20 Mon Sep 17 00:00:00 2001 From: Yinling Date: Sun, 6 Nov 2016 22:53:23 +0800 Subject: [PATCH 2/3] No need to deinit submodules as use clean clone by config --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b06eccb75f..3e88ddc638 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,6 @@ before_script: - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - # CI may download a cached project. Need to re-sync submodule - - git submodule deinit -f . # if testing master branch, use github wifi libs. # if testing other branches, use gitlab wifi libs (as maybe changes aren't merged to master yet) - test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-wifi-lib%ssh://git@gitlab.espressif.cn:27227/idf/esp32-wifi-lib%" .gitmodules From 522f83ae3d71357683a62f69a139b8c1eda8f362 Mon Sep 17 00:00:00 2001 From: Yinling Date: Sun, 6 Nov 2016 22:58:31 +0800 Subject: [PATCH 3/3] remove unnecessary "git fetch" and add echo submodule path --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e88ddc638..6f050d1fcb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ before_script: - git submodule update --init --recursive # try use submodule with same branch - SUBMODULES=`cat .gitmodules | grep path | awk '{print $3}'` - - for MODULE in $SUBMODULES;do (cd $MODULE;git fetch;git checkout ${CI_BUILD_REF_NAME} || echo "using default branch";cd $CI_PROJECT_DIR); done + - for MODULE in $SUBMODULES;do (echo $MODULE;cd $MODULE;git checkout ${CI_BUILD_REF_NAME} || echo "using default branch";cd $CI_PROJECT_DIR); done build_template_app: stage: build