Search code examples
gitlabgitlab-cigitlab-ci-runner

CI failed before execute the .gitlab-ci.yml file on gitlab


I am new to gitlab CI.

My .gitlab-ci.yml file is

stages:
  - build

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

I had tried to activate the .gitlab-ci.yml by gitlab-ci-local and it work perfectly. The output is:

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

However, on the gitlab, it seems the process failed before executing .gitlab-ci.yml file.

the log in gitlab

(for search engine friendly, here is the log of my 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

I don't have the admin permission (yes, this is my task assigned by my company). How can I find out or fix the problem?


Solution

  • I finally solved this problem.

    On the terminal, input this command:

    echo 'unset cd'>>~/.bash_profile; source ~/.bash_profile

    Problem solved.

    p.s.:

    For checking the gitlab-runner log, run gitlab-runner --debug run on the gitlab server would help.

    reference: Gitlab CI runner job failed exit status 1 when changing directory