From badc46e14f7a18c6dee712003865137d006bc41f Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> Date: Thu, 15 Apr 2021 14:25:36 +0000 Subject: [PATCH] gitlab-ci.yml: Fix aggregation logic After the deployment of the new .workspace job and its application to the aggregate-docs job, the job was subtly broken. The initial working directory that the script was executing in was no longer the docs directory but the root of the workspace. Fix this by adjusting the logic slightly, this will also make the rename of the aggregated git repository easier. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> --- .gitlab-ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c6d8be..a77a9a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,18 +67,19 @@ deploy: stage: deploy script: - !reference [.workspace, script] - - git clone https://user:$OHOS_AGGREGATED_DOCS_TOKEN@git.ostc-eu.org/OSTC/infrastructure/openharmony-readthedocs-aggregated.git - - cd openharmony-readthedocs-aggregated - - git checkout origin/main # only main for now - needs to match the rules - - find . -maxdepth 1 -not -path ./.git -not -path . -exec rm -rf {} \; - - tar -c --dereference -C .. --exclude openharmony-readthedocs-aggregated --exclude ./.repo --exclude ./.git --exclude ./.gitlab-ci.yml . | tar -x + # We are in the root of the git-repo workspace. + - git clone https://user:$OHOS_AGGREGATED_DOCS_TOKEN@git.ostc-eu.org/OSTC/infrastructure/openharmony-readthedocs-aggregated.git aggregated + - (cd aggregated && git checkout origin/main) # only main for now - needs to match the rules + - (cd aggregated && find . -maxdepth 1 -not -path ./.git -not -path . -exec rm -rf {} \;) + - tar -c --dereference -C docs --exclude --exclude ./.git --exclude ./.gitlab-ci.yml . | tar -x -C aggregated # Commit and push back, if something changed. - | + cd aggregated; if [ -n "$(git status -s)" ]; then msg="docs repository snapshot - $CI_COMMIT_BRANCH:$CI_COMMIT_SHA"; git config --local user.name "OpenHarmony CI"; git config --local user.email "ci@ostc-eu.org"; - git add -A + git add -A; git commit -sm "$msg"; git push origin HEAD:main; else -- GitLab