edbizarro / gitlab-ci-pipeline-php

:coffee: Docker images for test PHP applications with Gitlab CI (or any other CI platform!)
https://hub.docker.com/r/edbizarro/gitlab-ci-pipeline-php
MIT License
529 stars 167 forks source link

PackageManifest.php Undefined index: name #119

Closed herreralv-dev closed 3 years ago

herreralv-dev commented 3 years ago

Good Day!

We are having issues after the update of Composer 2 release. It works fine the last few days, but when our developers started to commit and the pipeline starts.

Here's our gitlab-ci.yml:

image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine

stages:
  - test
  - deploy

# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
  - postgres:12.3
  - redis:latest

variables:
  POSTGRES_DB: "core"
  POSTGRES_USER: "root"
  POSTGRES_PASSWORD: "secret"
  POSTGRES_HOST: "postgres"
  REDIS_PORT: 6379

# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
# cache:
#   paths:
#    - vendor/
#    - node_modules/

# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
  # Install Composer and project dependencies.
  - composer install --prefer-dist --no-ansi --no-interaction --no-progress

  # Copy over testing configuration.
  # Don't forget to set the database config in .env.testing correctly
  # DB_HOST=mysql
  # DB_DATABASE=project_name
  # DB_USERNAME=root
  # DB_PASSWORD=secret
  - cp .env.testing .env

  # Generate an application key. Re-cache.
  - php artisan key:generate
  # - php artisan cache:clear -> not available in Laravel Lumen
  - php artisan optimize

  # Run database migrations.
  - php artisan migrate

  # Run the Laravel Passport table migrations.
  - php artisan passport:install --force

  # Run database seed.
  - php artisan db:seed

test:
  tags:
    - docker
  script:
    # run laravel tests
    - ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr

    # Run PHP Code Sniffer.
    - php vendor/bin/phpcs

deploy:
  stage: deploy
  image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine
  script:
    - echo "Deployment handled by Laravel Forge!"
  only:
    - master
  when: on_success

image

Looking forward to the resolution for this.

Thank you so much and have a good day!

edbizarro commented 3 years ago

hi @herreralv-dev have you tried to clear the cache gitlab cache?

herreralv-dev commented 3 years ago

Hi @edbizarro,

A bit hesitant on clearing the cache if you are talking on this: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41369

We've opted to downgrade the composer to version 1.x and force xdebug to check on coverage instead, here's a little snippet on what we did:

image

I think this is just a workaround and dependencies will be stale in the long run, our long term solution would be update our Laravel framework and some affected dependencies.

Thank you so much for your reply.

Cheers!

na2axl commented 3 years ago

Hi all, @edbizarro just to say that clearing the GitLab cache does nothing... Some older versions of Laravel are just not compatibles with Composer 2. As the OP said the only solution is to force the use of Composer 1 or to update the used version of Laravel (which is a bit complicated for complex projects...)

edbizarro commented 3 years ago

Yeah, i think because of this old Laravel thing i'll change back to composer 1 and wait a little longer or perhaps make 2 versions with composer 1 and 2