首页 > 解决方案 > gitlab-ci 测试构建失败

问题描述

我是 gitlab-ci 的新手,我正在尝试测试我的构建阶段,但在最后一步之前它一直失败。这是部分

build:
  stage: build
  before_script:
    - git config user.name "$GITLAB_USER_NAME"
    - git config user.email "$GITLAB_USER_EMAIL"
  script:
    - git add .
    - git commit -m "[skip ci] migrations"
    - git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL}" "HEAD:qa" -o ci.skip
  dependencies:
    - migrations
  only:
    - qa

这是日志,最后几行

Using docker image sha256:5b3b4504ff1f7b859dbc5d7fb86f4afc644be62f99b8ced636fbca64c8a6c2de for python:latest with digest python@sha256:73cc381fa0fe5e6d5dd38f1397da28c70096519d8818c2249f2bc8e1158ba015 ...
$ git config user.name "$GITLAB_USER_NAME"
$ git config user.email "$GITLAB_USER_EMAIL"
$ git add .
$ git commit -m "[skip ci] migrations"
HEAD detached at bf2a8e4
nothing to commit, working tree clean
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

我怎样才能知道ERROR: Job failed: exit code 1是什么?我正在使用共享跑步者

标签: gitlab-cigitlab-pipelines

解决方案


错误ERROR: Job failed: exit code 1来自 git 没有找到任何要提交的内容。换句话说,以下消息导致错误:

nothing to commit, working tree clean
Cleaning up file based variables

您可以确定有什么要提交的,或者您可以按照此相关线程中的概述调整您的脚本:How to git commit nothing without an error?


推荐阅读