强制重新运行失败的Gitlab测试或禁用测试缓存

时间:2019-11-21 11:00:27

标签: gitlab gitlab-ci

我正在使用Gitlab并使用以下测试说明:

   ldap:
   stage: test
   script:
     - cd ZEDAT-HPC-LDAP
     - ls -la /usr/share/perl5/Test
     - prove -l t
   tags:
     - perl

该测试最初失败,因为该测试使用的标准Perl库未安装在Gitlab服务器上。安装缺少的库之后,测试仍然失败,并且测试中的ls显示文件系统的旧状态。显然,该测试尚未重新运行,并且显示了测试结果的缓存版本。

问题似乎是安装缺少的库不会更改存储库中的任何内容,因此Gitlab似乎认为不重新运行测试是可以的。在date测试通过后,通过插入ls修改测试后。

那么,如何强制运行测试,或者如何禁用缓存机制?

[更新]

测试的输出是

Skipping Git submodules setup
$ date
Fri Nov 22 11:51:33 CET 2019
$ cd ZEDAT-HPC-LDAP
$ ls -la /usr/share/perl5/Test
total 24
drwxr-xr-x  4 root root 4096 Apr 23  2018 .
drwxr-xr-x 49 root root 4096 Jun 21 06:09 ..
drwxr-xr-x  3 root root 4096 Apr 23  2018 Perl
drwxr-xr-x  2 root root 4096 Apr 23  2018 Pod
-rw-r--r--  1 root root 7533 Jul  4  2015 Pod.pm

我以用户gitlab-runner登录到服务器

gitlab-runner@sc-git:~$ date
Fri Nov 22 12:55:53 CET 2019
gitlab-runner@sc-git:~$ ls -la /usr/share/perl5/Test/
total 68
drwxr-xr-x  6 root root  4096 Nov 21 09:53 .
drwxr-xr-x 54 root root  4096 Nov 21 09:53 ..
-rw-r--r--  1 root root 11301 Dec 10  2014 Fatal.pm
drwxr-xr-x  2 root root  4096 Nov 21 09:53 MockObject
-rw-r--r--  1 root root 23464 Dec  3  2016 MockObject.pm
drwxr-xr-x  3 root root  4096 May 31  2018 Net
drwxr-xr-x  3 root root  4096 Apr 23  2018 Perl
drwxr-xr-x  2 root root  4096 Apr 23  2018 Pod
-rw-r--r--  1 root root  7533 Jul  4  2015 Pod.pm

那怎么可能?

2 个答案:

答案 0 :(得分:1)

您可以使用UI(CI / CD>管道)重新运行管道:

enter image description here

并选择要运行的分支。或使用API

单击“运行管道”旁边的“清除运行器缓存”按钮,可以清除缓存manually

enter image description here

答案 1 :(得分:0)

所以问题似乎出在跑步者和gitlab本身之间不匹配。本周初,我们安装了gitlab-runner从12.4.1到12.5.0的更新。软件包gitlab-ce的版本为12.4.3。今天下午,我们正式安装了gitlab-ce到12.5.0的更新。现在,奇怪的“过去的文件系统”问题已经消失,剩下的是正常的,非时间旅行错误。哇!

第一点:不要仅仅因为有更新而安装更新。

第二点:Gitlab似乎加入了一些极其奇怪和令人不安的缓存。