Prabash
Prabash

Reputation: 21

GitLab CI Pipeline on specific branch composer: command not found

I'm trying to implement GitLab CI Pipelines to build and deploy an app.

In our project we have two branches: master and others. For a particular branch(eg:p-01-sprint-04), I want to run a Pipeline in order to build the application and deploy the build on a test environment.

The build failed during execution.

This is how my .gitlab-ci.yml looks like:

stages:
  - test

unit_test:
  stage: test
  script:
    - composer install
    - php artisan migrate
    - php artisan db:seed
    - composer require laravel/passport
    - php artisan passport:client --personal
    - php artisan storage:link
    - php artisan serve

The build failed with these errors :

Running with gitlab-runner 11.8.0 (4745a6f3)
  on gitlab-runner-gitlab-runner-64c48b5865-wx6wl BS2DZ3GP
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image ubuntu:16.04 ...
Waiting for pod gitlab/runner-bs2dz3gp-project-924-concurrent-0tzq4t to be running, status is Pending
Waiting for pod gitlab/runner-bs2dz3gp-project-924-concurrent-0tzq4t to be running, status is Pending
Running on runner-bs2dz3gp-project-924-concurrent-0tzq4t via gitlab-runner-gitlab-runner-64c48b5865-wx6wl...
Cloning into '/mk2/billeterie/bo'...
Cloning repository...
Checking out 841a7daf as p-01-sprint-04...
Skipping Git submodules setup
$ composer install
/bin/bash: line 72: composer: command not found
ERROR: Job failed: command terminated with exit code 1

Upvotes: 2

Views: 2690

Answers (1)

Nicolas Pepinster
Nicolas Pepinster

Reputation: 6249

Log shows you use ubuntu:16.04 with kubernetesexecutor :

Using Kubernetes executor with image ubuntu:16.04 ...

composer is not installed in ubuntu:16.04 docker image.

Use composer image instead which provide phpand composer binaries.

Upvotes: 1

Related Questions