From c9374fe5932537c3c966e6d56f526bd0d4935d8c Mon Sep 17 00:00:00 2001 From: Guillaume Samson <guillaume.samson@mercator-ocean.fr> Date: Wed, 25 Sep 2024 16:28:20 +0000 Subject: [PATCH] Resolve "CI pipeline improvements" --- .gitlab-ci.yml | 84 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9438762..b910baa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,51 +1,99 @@ +# docker packages +image: registry.gitlab.com/islandoftex/images/texlive:TL2021-historic + + +workflow: + # avoid to trigger pipeline for each commit + # pipeline should be triggered using https://forge.nemo-ocean.eu/nemo/doc/manuals/-/pipelines/new + rules: + - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'schedule' + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_TITLE =~ /(?i).*\[ci\].*/ + + variables: - GIT_SUBMODULE_STRATEGY: recursive + MANUALS: + description: "Manual(s) to be built" + value: "all" + options: + - "all" + - "NEMO" + - "SI3" + - "TOP" # input version for release (available only when pipeline is run manually) + DRAFT_MODE: + description: "Enable/disable latex draft mode (faster rendering without figures)" + value: "yes" + options: + - "yes" + - "no" + DEBUG_MODE: + description: "Print or not latex compilation details in log file for debugging" + value: "no" + options: + - "yes" + - "no" VERSION: value: "" description: "Set version release number for manuals" + GIT_SUBMODULE_STRATEGY: recursive + + +before_script: + - if [[ ${DRAFT_MODE} == "no" ]]; then BUILD_OPT="-p"; fi + - if [[ ${DEBUG_MODE} == "yes" ]]; then BASH_OPT="-x"; fi -# docker packages -image: registry.gitlab.com/islandoftex/images/texlive:TL2021-historic NEMO manual: tags: - docker stage: build - #when: manual + rules: + - if: ($MANUALS == "NEMO" || $MANUALS == "all") script: - - version=${CI_COMMIT_REF_NAME} - - if [ "x${VERSION}" != "x" ] ; then version=${VERSION} ; fi - - bash -x manual_build.sh -r ${version} -p NEMO + - bash ${BASH_OPT} manual_build.sh ${BUILD_OPT} -r ${VERSION:-CI_COMMIT_REF_NAME} NEMO artifacts: paths: - NEMO_manual.pdf expire_in: 15 mins + +SI3 manual: + tags: + - docker + stage: build + rules: + - if: ($MANUALS == "SI3" || $MANUALS == "all") + script: + - bash ${BASH_OPT} manual_build.sh ${BUILD_OPT} -r ${VERSION:-CI_COMMIT_REF_NAME} SI3 + artifacts: + paths: + - SI3_manual.pdf + expire_in: 15 mins + + TOP manual: tags: - docker stage: build - #when: manual + rules: + - if: ($MANUALS == "TOP" || $MANUALS == "all") script: - - version=${CI_COMMIT_REF_NAME} - - if [ "x${VERSION}" != "x" ] ; then version=${VERSION} ; fi - - bash -x manual_build.sh -r ${version} -p TOP + - bash ${BASH_OPT} manual_build.sh ${BUILD_OPT} -r ${VERSION:-CI_COMMIT_REF_NAME} TOP artifacts: paths: - TOP_manual.pdf expire_in: 15 mins -SI3 manual: + +# generic job (needs to be parallelized) +.build_manual: tags: - docker stage: build - #when: manual script: - - version=${CI_COMMIT_REF_NAME} - - if [ "x${VERSION}" != "x" ] ; then version=${VERSION} ; fi - - bash -x manual_build.sh -r ${version} -p SI3 + - bash ${BASH_OPT} manual_build.sh ${BUILD_OPT} -r ${VERSION:-$CI_COMMIT_REF_NAME} ${MANUALS} artifacts: paths: - - SI3_manual.pdf - expire_in: 15 mins + - ./*_manual.pdf + expire_in: 15 mins \ No newline at end of file -- GitLab