From 76469dda5967335ca1ffc5eaa994f9746bd522b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= Date: Fri, 14 Aug 2020 14:38:27 +0200 Subject: [PATCH 1/2] ci: make jobs interruptible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Redundant pipelines are only canceled if no uninterruptible job has started. Let's mark all the jobs as interruptible hoping the redundant pipelines will get canceled, to try to reduce the load on the build server. There is one exception: the certification cannot currently be interrupted, because the UCC wouldn't stop properly. Signed-off-by: Raphaël Mélotte --- .gitlab-ci.yml | 3 +++ ci/certification/generic.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d16118f24..7714e4f812 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,7 @@ variables: PYTHONUNBUFFERED: "1" +default: + interruptible: true stages: - containers @@ -325,6 +327,7 @@ test-on-netgear-rax40: needs: ["build-for-netgear-rax40"] run-certification-tests: + interruptible: false stage: test variables: # TESTS_TO_RUN needs to be set by the user (or the pipeline schedule) diff --git a/ci/certification/generic.yml b/ci/certification/generic.yml index 6e78d8665d..f95f257b90 100644 --- a/ci/certification/generic.yml +++ b/ci/certification/generic.yml @@ -1,4 +1,5 @@ .certification-generic: + interruptible: false variables: # DEVICE_UNDER_TEST need to be set when extending the job GIT_CLONE_PATH: "/builds/prpl-foundation/prplmesh/prplMesh/" From 6fdbad4a78cda79ff12b0fd3c88b2ba1f53eebe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= Date: Fri, 14 Aug 2020 15:18:35 +0200 Subject: [PATCH 2/2] ci: certification: clean up the repository manually MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The certification tests generate files owned by root, since the different sigma agents need to run as root. To prevent the next job from failing to remove files owned by root, the files have their ownership reset at the end of every job (by the run_test_file.py script). When a job is canceled however, there is no way to change the ownership of those files, neither is there a way to remove them at the next run (because the very first thing the gitlab-runner does is to try to remove them). One way to solve this would be to use 'none' as the git clean flags, and do the cleanup ourselves. A downside of this approach is that we risk either not removing some parts (example, files under .tmp added by Gitlab CI) or to removing too much (for example if we run git clean, it would delete the downloaded artifacts...). Another way is to use the 'clone' strategy to always remove the repository entirely and start with an empty folder every time. This approach has been chosen because as the certification tests already take a lot of time to run, it shouldn't have a significant impact on the total time. While we're at it, also remove the 'echo $CI_COMMIT_DESCRIPTION' leftover. Note that this commit still won't allow us to mark the certification tests as interruptible, because the UCC does not terminate properly when canceling a job anyway. Signed-off-by: Raphaël Mélotte --- .gitlab-ci.yml | 1 + ci/certification/generic.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7714e4f812..2d62457839 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -330,6 +330,7 @@ run-certification-tests: interruptible: false stage: test variables: + GIT_STRATEGY: clone # TESTS_TO_RUN needs to be set by the user (or the pipeline schedule) GIT_CLONE_PATH: "/builds/prpl-foundation/prplmesh/prplMesh/" # device to test with: prplmesh for dummy bwl, axepoint for dwpal on axepoint diff --git a/ci/certification/generic.yml b/ci/certification/generic.yml index f95f257b90..614ddd725d 100644 --- a/ci/certification/generic.yml +++ b/ci/certification/generic.yml @@ -1,10 +1,10 @@ .certification-generic: interruptible: false variables: + GIT_STRATEGY: clone # DEVICE_UNDER_TEST need to be set when extending the job GIT_CLONE_PATH: "/builds/prpl-foundation/prplmesh/prplMesh/" script: - - echo $CI_COMMIT_DESCRIPTION - ci/git-clean-reset.sh /easymesh_cert "$(<"ci/easymesh_cert_version")" - sudo /easymesh_cert/run_test_file.py -v -o logs -d $DEVICE_UNDER_TEST "${CI_JOB_NAME%%:*}" artifacts: