Gitlab 16.0 CE return error on a simple gitlab-ci file

290 Views Asked by At

Today I updated my Gitlab CE to latest version 16.0.4 but after that I couldn't run pipeline on my old projects.

Installation type: Self-managed (sudo apt install gitlab-ce)

The version of the runner: 16.0.2

Executor: Docker

Default image: Python 3.8

I using docker a runner.

I set CI_DEBUG_TRACE: "true" in variables and getting below detail:

shell not found
Cleaning up project directory and file based variables

  • set -o
  • grep pipefail
  • set -o pipefail
  • set -o errexit
  • set +o noclobber
  • :
  • eval '$'''rm''' -f /builds/xx/xxxxx.tmp/CI_SERVER_TLS_CA_FILE ' ++ rm -f /builds/xx/xxxxx.tmp/CI_SERVER_TLS_CA_FILE
  • exit 0 ERROR: Job failed: exit code 1

My gitlab-ci file like:

stages: 
  - build
  - test
variables:
  CI_DEBUG_TRACE: "true"
build the car:
  stage: build
  script:
    - ls
  artifacts:
    paths:
      - build/

test the car:
  stage: test
  script:
    - ls

I tried to run this file on a new project and it works perfectly.

I think Gitlab couldn't run the below command: rm -f /builds/xx/xxxxx.tmp/CI_SERVER_TLS_CA_FILE

2

There are 2 best solutions below

2
Jeffrey Mixon On

Your error message "shell not found" is the primary clue.

The issue is that your default image, python:3.8 has no ENTRYPOINT defined but has a CMD defined as python3

When GitLab tries to run this container, instead of getting a POSIX shell, it instead runs python interpreter. Hence the error message of a missing shell.

You can work around this issue in the following manner:

test-job:
  image:
    name: python:3.8-alpine
    entrypoint: [ '/bin/sh', '-c' ]
...

Alternatively, you can use a different image which does define an ENTRYPOINT or a CMD which is a valid shell.

0
AngelFalse On

I forgot to gitlab-ee and gitlab-runner as same in docker network

https://docs.gitlab.com/runner/executors/docker.html#configure-a-network-with-container-links

So I changed network_mode bridge(default) to host

  [runners.docker]
    network_mode = "host"