Bash error in ssh runner

Problem to solve

Hi all

I upgraded yesterday from 18.0.x to the latest.
Now my two ssh runners do this:

Saving cache for successful job 00:00
Creating cache yarn-19-protected...
bash: line 168: /home/gitlab-runner/builds/w-q2-u1_r/0/snip/snip/builds/w-q2-u1_r/0/snip/snip.tmp/gitlab_runner_cache_env: No such file or directory

then continues with uploading artifacts with no issue, but at the end ERROR: Job failed: Process exited with status 1, and pipelines fail

Has anyone seen this? We are kinda stuck :slight_smile:

Steps to reproduce

I tried recreating the runner, to clean up its home, to downgrade it to 18.3. No luck

Configuration

Something along the lines of

.yarn-cache:
  cache:
    key: yarn
    paths:
      - /home/gitlab-runner/.yarn/berry/cache

.builder:
  extends: .yarn-cache
  variables:
    GIT_SUBMODULE_STRATEGY: recursive
  before_script:
    - source "$HOME/.nvm/nvm.sh"
    - yarn install
    - yarn npm audit --severity moderate
  artifacts:
    paths:
      - dist/
    expire_in: 1 day

.linting: &linting
  - yarn run prettier-check
  - yarn run lint
  - src/guide/check.sh

build-prod:
  extends: .builder
  stage: build
  tags:
    - build_frontend
  script:
    - *linting
    - ./deploy.sh --build
    - >
      ./deploy.sh <snip>
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: never
    - if: '$CI_COMMIT_REF_NAME =~ $TODEPLOY'

Versions

Please select whether options apply, and add the version information.

  • Self-managed X
  • GitLab.com SaaS
  • Dedicated
  • Self-hosted Runners X

Versions

  • GitLab (Web: /help or self-managed system information sudo gitlab-rake gitlab:env:info): v18.4.1-ee
  • GitLab Runner, if self-hosted (Web /admin/runners or CLI gitlab-runner --version):18.4.0 both on the gitlab server and the target ssh server

We witnessed the same error. Seems to be related to the way the path to the temporary file is generated.

Gitlab v18.4.1-ee

Saving cache for successful job
00:00
Creating cache 684-097b7d1b66dca56343bd8d0c01f2e9c64a8df433-build-linux-debug64-2-non_protected...
sh: line 198: /home/ec2-user/builds/rZn2hSXiB/2/INF/INF-CMM/builds/rZn2hSXiB/2/INF/INF-CMM.tmp/gitlab_runner_cache_env: No such file or directory

We are getting the same error with gitlab runner 18.4 as ssh executor:

Saving cache for successful job 00:00
Creating cache feature-ort-3036-2-non_protected...
bash: line 167: /root/builds/1iDLpGhkY/0/mvp/frontend/builds/1iDLpGhkY/0/mvp/frontend.tmp/gitlab_runner_cache_env: No such file or directory
Uploading artifacts for successful job 00:00
Uploading artifacts...
Runtime platform                                    arch=amd64 os=linux pid=50665 revision=139a0ac0 version=18.4.0
frontend/junit.xml: found 1 matching artifact files and directories 
Uploading artifacts as "junit" to coordinator... 201 Created  correlation_id=01K7MMQKF8FGXFJAC5TXMBXPT5 id=23837 responseStatus=201 Created token=64_tRYhE_
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: Process exited with status 1

Path looks somehow “doubled” and i found only a file “gitlab_runner_env” but not “gitlab_runner_cache_env”

gitlab-ee:amd64/jammy 18.4.2-ee.0 uptodate
gitlab-runner:amd64/jammy 18.4.0-1 uptodate

Unfortunately, today’s update to GitLab 18.5.0 and Runner 18.5.0 has not brought any changes.

bash: line 165: /root/builds/1iDLpGhkY/0/mvp/backend/builds/1iDLpGhkY/0/mvp/backend.tmp/gitlab_runner_cache_env: No such file or directory

Suggest opening a bug report in Issues · GitLab.org / gitlab-runner · GitLab

Done:

1 Like

For me, this workaround helped the runner successfully complete the job. Disable the cache in the .gitlab-ci.yml-file by adding to the job:
cache: []

1 Like