From 559a3e08a54351fe12231e5a38079d0d76932de7 Mon Sep 17 00:00:00 2001 From: Arvid Jakobsson Date: Thu, 1 Jun 2023 12:11:26 +0200 Subject: [PATCH 1/2] CI: move [publish_documentation] to the start [master_branch] pipeline This helps to ensure that this job is not interrupted by subsequent merges to the master branch. We do this by setting [needs: []] instead of re-ordering the stages. Re-ordering stages would affect other pipelines as well. --- .gitlab/ci/jobs/doc/publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab/ci/jobs/doc/publish.yml b/.gitlab/ci/jobs/doc/publish.yml index 1b4856b5eb88..92def03e326b 100644 --- a/.gitlab/ci/jobs/doc/publish.yml +++ b/.gitlab/ci/jobs/doc/publish.yml @@ -12,6 +12,9 @@ publish:documentation: - .default_settings_template - .image_template__runtime_build_test_dependencies_template stage: doc + # Make the publish_documentation run in the beginning of the master + # pipeline to ensure it has time to run before the next merge. + needs: [] before_script: - echo "${CI_PK_GITLAB_DOC}" > ~/.ssh/id_ed25519 - echo "${CI_KH}" > ~/.ssh/known_hosts -- GitLab From 875f09833a94a6a1ec823fbaad8b5ac39f8a03ae Mon Sep 17 00:00:00 2001 From: Arvid Jakobsson Date: Thu, 1 Jun 2023 12:58:52 +0200 Subject: [PATCH 2/2] CI: refactor [scripts/ci/doc_publish.sh] Build the documentation unconditionally. This makes the job easier to test in artificial [master_branch] pipelines. Move the last conditional checking whether there is any changes to commit inside the conditional that checks whether we are running on master. Indeed, there is no point of pushing unless we've checked out the documentation repository. --- scripts/ci/doc_publish.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/ci/doc_publish.sh b/scripts/ci/doc_publish.sh index d404adc7fe68..6a1abb15ca5e 100755 --- a/scripts/ci/doc_publish.sh +++ b/scripts/ci/doc_publish.sh @@ -2,20 +2,21 @@ cd "${CI_PROJECT_DIR}" || exit 1 +make all ; +make -C docs -j full ; + if [ "${CI_COMMIT_REF_NAME}" == "master" ] ; then - make all ; - make -C docs -j full ; git clone --depth 5 git@gitlab.com:"${CI_PROJECT_NAMESPACE}"/"${CI_PROJECT_NAMESPACE}".gitlab.io gitlab.io ; rsync --recursive --links --perms --delete --exclude=.doctrees --exclude={{main,alpha,zero}net,master}/index.html docs/_build/ gitlab.io/public/ ; cd gitlab.io || exit 2; -else - echo "Skip pushing documentation. Only pushing for real master" ; -fi -if [ -z "$(git status -s)" ] ; then - echo "Nothing to commit!" ; + if [ -z "$(git status -s)" ] ; then + echo "Nothing to commit!" ; + else + git add public ; + git commit -m "Import doc of ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA}" ; + git push origin master ; + fi else - git add public ; - git commit -m "Import doc of ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA}" ; - git push origin master ; + echo "Skip pushing documentation. Only pushing for real master" ; fi -- GitLab