Runner steps does not find required
In my Runner and the associated pipeline a crazy error occurred.
I use my own build image based on alpine and docker:dind as service.
The build of an docker image in the pipeline works. But after that I want to run
docker run --rm \ -e COMPOSER_HOME=/composer \ -e COMPOSER_ALLOW_SUPERUSER=1 \ -v ~/.composer:/composer \ $user_id \ -v $mount_path:/var/www \ -w /var/www $build_image php composer.phar install
Which leads to a
Could not open input file: composer.phar
The crazy thing, directly above I did a ls -la $mount_path
and the composer.phar is available.
And the second crazy thing, on the runner in the builds-dir the folder structure exist, but no code. this is realy weird.
I hope that someone has an idea what is wrong.
gitlab-ci.yml
workflow:
rules:
- if: '$CI_COMMIT_TAG == null && $CI_COMMIT_REF_NAME == "master"'
stages:
- build
- tag
build:
stage: build
image: ************/infrastructure/ci-build-image/docker
variables:
DOCKER_HOST: tcp://172.17.0.1:2375
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:dind
command: [ "--tls=false" ]
before_script:
- echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
script:
- ./scripts/build.sh
- ./scripts/test.sh
when: on_success
after_script:
- docker logout ${CI_REGISTRY}
tag:
stage: tag
script:
- semver-tag-patch
My runner config.toml:
config.toml
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "kmaster"
url = "***************"
id = 12
token = "***************"
token_obtained_at = 2023-04-20T08:43:25Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
builds_dir = "/home/gitlab-runner/builds"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.builds]
clone_depth = 0
[runners.docker]
tls_verify = false
image = "***********/infrastructure/ci-build-image"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
clone_url = "$CI_REPOSITORY_URL"
strategy = "fetch"
the Pipeline-Output:
pipeline output
Running with gitlab-runner 15.10.1 (dcfb4b66)
on kmaster AcSmMh2q, system ID: s_8a6db7c8ce9e
Preparing the "docker" executor
00:36
Using Docker executor with image ***********/infrastructure/ci-build-image/docker ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:7918c105b85a93f5031aef9fddfe4c05247861b4de6a74e2a39f2ff221bda139 for docker:dind with digest docker@sha256:e40881e5e9ab5361c288a1ab43b4120f6115be61fa21019b43adf0b27b1fbfb1 ...
Waiting for services to be up and running (timeout 30 seconds)...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image ***********/infrastructure/ci-build-image/docker ...
Using docker image sha256:6aabb960e0acdfeb002b16f2979f3d7e743d698a4013d7718c7e83a27b3833f8 for ***********/infrastructure/ci-build-image/docker with digest ***********/infrastructure/ci-build-image/docker@sha256:009022d2e9ebd056d07c25cb5fa45931496cdd4b467d17097fc5807c3f26f1b1 ...
Preparing environment
00:07
Running on runner-acsmmh2q-project-9-concurrent-0 via kmaster...
Getting source from Git repository
00:10
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /home/gitlab-runner/builds/libraries/service-kit/.git/
Checking out 7d7e17f6 as detached HEAD (ref is master)...
Removing composer.phar
Removing scripts/common/
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:6aabb960e0acdfeb002b16f2979f3d7e743d698a4013d7718c7e83a27b3833f8 for ***********/infrastructure/ci-build-image/docker with digest ***********/infrastructure/ci-build-image/docker@sha256:009022d2e9ebd056d07c25cb5fa45931496cdd4b467d17097fc5807c3f26f1b1 ...
$ echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ ./scripts/build.sh
Cloning into './scripts/common'...
[INFO] Downloading composer if not present...
[INFO] Checking if binary wget is present
Connecting to getcomposer.org (54.36.53.46:443)
saving to 'composer.phar'
composer.phar 100% |********************************| 2767k 0:00:00 ETA
'composer.phar' saved
[INFO] Building PHP base image (service-kit-base-build)...
#1 [internal] load .dockerignore
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile_build
#2 transferring dockerfile: 36B
#2 transferring dockerfile: 932B 0.0s done
#2 DONE 1.2s
#1 [internal] load .dockerignore
#1 transferring context: 2B 0.0s done
#1 DONE 1.7s
#3 [internal] load metadata for docker.io/library/php:8.2-fpm-alpine
#3 DONE 0.9s
#4 [1/6] FROM docker.io/library/php:8.2-fpm-alpine@sha256:8f277c8e6f161a3a9b74f3a43b450eb40ba7870eac75cd0be711c512ffbb2f6b
#4 DONE 0.0s
#5 [internal] load build context
#5 transferring context: 2.99MB 0.3s done
#5 DONE 0.9s
#6 [2/6] RUN apk --no-cache add git libxml2-dev zlib-dev openssl-dev curl cyrus-sasl-dev bzip2-dev
#6 CACHED
#7 [3/6] RUN set -xe && apk add --no-cache --virtual .build-deps autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c coreutils oniguruma-dev linux-headers && docker-php-ext-install -j"$(/usr/bin/nproc)" mbstring opcache bz2 && pecl install xdebug-3.2.0 && docker-php-ext-enable mbstring opcache bz2 && apk del .build-deps
#7 CACHED
#8 [4/6] COPY . /var/www
#8 DONE 4.8s
#9 [5/6] WORKDIR /var/www
#9 DONE 2.0s
#10 [6/6] RUN mkfifo /tmp/stdout && chmod 777 /tmp/stdout
#10 DONE 4.1s
#11 exporting to image
#11 exporting layers
#11 exporting layers 1.4s done
#11 writing image sha256:c872b5795f67d883674c4a5282075dd58bc2348789f07f0ac94ce1d69757ab55 0.1s done
#11 naming to docker.io/library/service-kit-base-build 0.0s done
#11 DONE 1.5s
[INFO] Building PHP base image (service-kit-base-build)... DONE
[INFO] Installing PHP dependencies...
[INFO] Checking if binary docker is present
[INFO] Checking if binary tar is present
total 2836
drwxrwxrwx 6 root root 4096 Apr 21 08:07 .
drwxrwxrwx 4 root root 4096 Apr 20 19:08 ..
drwxrwxrwx 6 root root 4096 Apr 21 08:06 .git
-rw-rw-rw- 1 root root 159 Apr 20 19:08 .gitignore
-rw-rw-rw- 1 root root 655 Apr 21 08:06 .gitlab-ci.yml
-rw-rw-rw- 1 root root 8650 Apr 20 19:08 .php_cs-fixer.php
-rw-rw-rw- 1 root root 8499 Apr 20 19:08 README.md
-rw-rw-rw- 1 root root 846 Apr 20 19:08 composer.json
-rwxr-xr-x 1 root root 2834111 Apr 21 08:07 composer.phar
-rw-rw-rw- 1 root root 473 Apr 20 19:08 docker-compose.yml
-rw-rw-rw- 1 root root 897 Apr 20 19:08 phpunit.xml
drwxrwxrwx 5 root root 4096 Apr 21 08:07 scripts
drwxrwxrwx 7 root root 4096 Apr 20 19:08 src
drwxrwxrwx 5 root root 4096 Apr 20 19:08 tests
Could not open input file: composer.phar
Running after_script
Running after script...
$ docker logout ${CI_REGISTRY}
Removing login credentials for registry.s-p-it.de
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1```
</details>