From e5adb4b5064927626d7f14886602959ed83e519e Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 11 Mar 2021 13:56:44 -0800 Subject: [PATCH] GitLab CI: Speed up our fetching/cloning. Fetching the complete Wireshark repository in GitLab's CI currently takes about 3.5 minutes. GitLab CI lets you do shallow cloning, but only up to 1000 commits. This isn't sufficient for any of our jobs that might need a reachable tag since it's currently about 1200 commits away in master. Set GIT_DEPTH to 1 (which appears to trigger the required shallow clone logic in GitLab's CI), then deepen it by setting GIT_FETCH_EXTRA_FLAGS to "--depth=5000". This is *should* be much faster than a full checkout and still give us a reachable tag: $ git rev-list --count v3.3.0rc0..v3.5.0rc0 2330 $ git rev-list --count v3.1.0rc0..v3.3.0rc0 2198 $ git rev-list --count v2.9.0rc0..v3.1.0rc0 3449 --- .gitlab-ci.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c70d668ef2..2b7c13efbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,12 @@ # https://hub.docker.com/r/wireshark/wireshark-ubuntu-dev variables: + # Ensure that checkouts are a) fast and b) have a reachable tag. In a + # brighter, more glorious future we might be able to use --shallow-since: + # https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3460 + # In the mean time, fetching the last 5000 commits does the job. + GIT_DEPTH: "1" + GIT_FETCH_EXTRA_FLAGS: "--depth=5000" CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" .build: @@ -264,8 +270,6 @@ merge-req:commit-checks: - docker rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - variables: - GIT_DEPTH: 10 script: # build-ubuntu puts us in `build`. - cd .. @@ -278,8 +282,6 @@ merge-req:ubuntu-dpkg: - docker rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - variables: - GIT_DEPTH: 10 script: # build-ubuntu puts us in `build`. - cd .. @@ -296,8 +298,6 @@ merge-req:ubuntu-gcc-ctest: - docker rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - variables: - GIT_DEPTH: 10 script: # build-ubuntu puts us in `build`. - CC=gcc CXX=g++ cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja .. @@ -312,8 +312,6 @@ merge-req:ubuntu-clang-other-tests: - docker rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - variables: - GIT_DEPTH: 10 script: # build-ubuntu puts us in `build`. - cd .. @@ -348,8 +346,6 @@ merge-req:windows: # The wireshark-windows-dev image is only available via a dedicated runner. - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/' when: always - variables: - GIT_DEPTH: 10 before_script: # XXX Find a better location. - cmd.exe /c "set CI_PIPELINE_SOURCE"