14

I am using my personal machine as a runner for an iOS project using Fastlane. This is mainly due to the fact that shared runners aren't setup for iOS as they don't have Xcode installed.

My jobs fail immediately when changing directory.

It's a shell runner, no other custom config at all.

Any suggestions?

enter image description here

This is the output when running gitlab-runner --debug run and starting a job.

Checking for jobs... received                       job=59131527 repo_url=https://gitlab.com/nickfarrant/aqualog-asset-collection.git runner=159b2b59
Failed to requeue the runner:                       builds=1 runner=159b2b59
Running with gitlab-ci-multi-runner 9.0.2 (fa8b86d)
  on Nicks-Bink-iMac (159b2b59)  job=59131527 project=5134442 runner=159b2b59
Shell configuration: environment: []
dockercommand:
- sh
- -c
- "if [ -x /usr/local/bin/bash ]; then\n\texec /usr/local/bin/bash --login\nelif [
  -x /usr/bin/bash ]; then\n\texec /usr/bin/bash --login\nelif [ -x /bin/bash ]; then\n\texec
  /bin/bash --login\nelif [ -x /usr/local/bin/sh ]; then\n\texec /usr/local/bin/sh
  --login\nelif [ -x /usr/bin/sh ]; then\n\texec /usr/bin/sh --login\nelif [ -x /bin/sh
  ]; then\n\texec /bin/sh --login\nelse\n\techo shell not found\n\texit 1\nfi\n\n"
command: bash
arguments:
- --login
passfile: false
extension: ""
  job=59131527 project=5134442 runner=159b2b59
Using Shell executor...                             job=59131527 project=5134442 runner=159b2b59
Waiting for signals...                              job=59131527 project=5134442 runner=159b2b59
WARNING: Job failed: exit status 1                  job=59131527 project=5134442 runner=159b2b59
vvvvv
  • 25,404
  • 19
  • 49
  • 81
nickjf89
  • 458
  • 1
  • 7
  • 18
  • Can you confirm the directory exists with a `ls` before that command? – Rekovni Mar 23 '18 at 10:23
  • Yep, have done this. It exists. If I use a shared runner, this works and only fails once it hits fastlane, as Xcode is not installed. So its got to be something wrong with my runner. – nickjf89 Mar 23 '18 at 10:24
  • Can you run the runner with `gitlab-runner --debug run` and post what it says? – Rekovni Mar 23 '18 at 10:48
  • Looks like it could be something to do with the runner not having access to some commands (https://gitlab.com/gitlab-org/gitlab-runner/issues/114) – Rekovni Mar 23 '18 at 10:48
  • Please see update. – nickjf89 Mar 23 '18 at 16:04
  • Afraid my best guess is that the runner doesn't have access to shell commands, and might need to do `source ~/.bash_profile` in a `before_script` in your ci file. – Rekovni Mar 26 '18 at 09:50
  • having a similar issue. In my case, after the npm install command it throws ERROR: Job failed: exit code 1. – viggy28 Jul 08 '18 at 05:17

2 Answers2

31

I hit the same situation, and I solve it.

I guess you used rvm.

Please follow below:

  1. Open terminal

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

  3. retry pipeline.

Refer to: https://juejin.im/post/5a65977bf265da3e4e25bfb8

barbsan
  • 3,418
  • 11
  • 21
  • 28
Wei
  • 324
  • 3
  • 10
  • this worked, can you explain what is happening with this code snippet? – ir2pid Jan 20 '21 at 09:23
  • The reference explains "cd is a method with rvm, cd is a shell builtin without it." – Wei Mar 24 '21 at 09:27
  • The clearly solution should be without rvm, and make env GEM_HOME, GEM_PATH that are not under system path. (I recommended.) – Wei Mar 24 '21 at 09:33
7

I added - unset cd before the - cd .. step and it worked.

Issa Shabo
  • 212
  • 3
  • 8