gitlab-cigitlab-pipelines

gitlab-ci testing build failed


I am new to gitlab-ci and I am trying to test my build phase but it keeps failing before last step. here is the section

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

This is the log, last few lines

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

How can I find out what ERROR: Job failed: exit code 1 is? I am using shared runners


Solution

  • The error ERROR: Job failed: exit code 1 is coming from git not finding anything to commit. In other words, the below message is causing the error:

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

    You can either may sure there is something to commit, or you can adjust your script as outlined in this related thread: How to git commit nothing without an error?