在 gitlab 上执行 .gitlab-ci.yml 文件之前 CI 失败

问题描述 投票:0回答:2

我是 gitlab CI 的新手。

我的 .gitlab-ci.yml 文件是

stages:
  - build

my_simple_job:
  stage: build
  script:
    - echo "Hello, GitLab CI/CD!"
  tags:
    - my_tag

我尝试通过 gitlab-ci-local 激活 .gitlab-ci.yml ,它工作得很好。输出是:

Using fallback git user.email
Using fallback git user.name
parsing and downloads finished in 24 ms
my_simple_job starting shell (build)
my_simple_job $ echo "Hello, GitLab CI/CD!"
my_simple_job > Hello, GitLab CI/CD!
my_simple_job finished in 7.43 ms

 PASS  my_simple_job
pipeline finished in 223 ms

但是,在gitlab上,在执行.gitlab-ci.yml文件之前,该过程似乎失败了。

(为了搜索引擎友好,这是我的gitlab的日志)

Running with gitlab-runner 14.4.0 (44444444)
  on dddddddddddddd-mmm-mmmm.local 7777777-N
Preparing the "shell" executor
Using Shell executor...
Preparing environment
Running on dddddddddddddd-mmm-mmm.local...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /Users/dddddddddddddd/builds/7777777-N/0/dddd/dddd/.git/
Cleaning up project directory and file based variables
ERROR: Job failed: exit status 1

我没有管理员权限(是的,这是我公司分配给我的任务)。我怎样才能找出或解决问题?

gitlab gitlab-ci gitlab-ci-runner
2个回答
0
投票

删除

tags
部分,GitLab CI 使用标签来

从项目可用的所有运行程序列表中选择特定运行程序。

来源官方

.gitlab-ci.yml
关键字参考
tags


0
投票

也许问题与您的运行程序(因为它是 Shell 执行器) 用于获取项目的 Git 策略有关。您可以尝试从

git fetch
切换到
git clone
策略,如下所示:

  • 到达您的存储库,然后设置 -> CI/CD -> 常规管道 -> Git 策略
  • 选择
    git clone
  • 保存更改


请注意,此解决方法在生产用例中可能成本高昂,因为它将在每个作业上克隆存储库。

© www.soinside.com 2019 - 2024. All rights reserved.