yiisoft / yii2-docker

Official Docker images suitable for Yii 2.0
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
384 stars 202 forks source link

CI fails after the last image change on docker hub #104

Closed odai-alali closed 3 years ago

odai-alali commented 3 years ago

Hi,

I have a ci running on my private gitlab, It is failing now without changing my ci config. It seems that xdebud is missing from the last pushed image

error: 'xdebug' does not exist
usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
   ie: /usr/local/bin/docker-php-ext-enable gd mysqli
       /usr/local/bin/docker-php-ext-enable pdo pdo_mysql
       /usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc
Possible values for module-name:
bcmath.so curl.so exif.so gd.so iconv.so imagick.so intl.so mbstring.so mongodb.so opcache.so pdo_mysql.so pdo_pgsql.so soap.so zip.so
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.

I noticed from the logs that the docker image sha is changed sha256:8ecbf8e08cf8e30ff63e4f79b998e04014e7631be6ee2e3bbf1df03559266792. so I think the cause of the problem is in the last pushed image.

I am using yiisoftware/yii2-php:7.1-apache

Passed CI Log

Running with gitlab-runner 13.6.0 (8fa89735)
  on runner on internal server oyUbFdD6
Preparing the "docker" executor
00:18
Using Docker executor with image yiisoftware/yii2-php:7.1-apache ...
Starting service mariadb:latest ...
Pulling docker image mariadb:latest ...
Using docker image sha256:3a348a04a8159339ed3ca053ea925f854252e6a6c3df6fa82c17625d1026f18b for mariadb:latest with digest mariadb@sha256:cdc553f0515a8d41264f0855120874e86761f7c69407b5cfbe49283dc195bea8 ...
Waiting for services to be up and running...
Pulling docker image yiisoftware/yii2-php:7.1-apache ...
Using docker image sha256:54316e05094012f45f0b0968495341a55bfc19aaa6224926109c5670a30bf296 for yiisoftware/yii2-php:7.1-apache with digest yiisoftware/yii2-php@sha256:b31a7a5fa335de73fc113dd3c8625a6e1c33aa0e92476794fe41e3e942f9d93a ...
Preparing environment
00:02
Running on runner-oyubfdd6-project-76-concurrent-0 via b8e10b9b973b...
Getting source from Git repository
00:02
Fetching changes...
Reinitialized existing Git repository in /builds/dis/dis/.git/
Checking out f074541b as 363-12-special-value-lists...
Skipping Git submodules setup
Executing "step_script" stage of the job script
01:49
usermod: no changes
Enabled xdebug
....

Failed CI Log

Running with gitlab-runner 13.6.0 (8fa89735)
  on runner on internal server oyUbFdD6
Preparing the "docker" executor
00:18
Using Docker executor with image yiisoftware/yii2-php:7.1-apache ...
Starting service mariadb:latest ...
Pulling docker image mariadb:latest ...
Using docker image sha256:3a348a04a8159339ed3ca053ea925f854252e6a6c3df6fa82c17625d1026f18b for mariadb:latest with digest mariadb@sha256:cdc553f0515a8d41264f0855120874e86761f7c69407b5cfbe49283dc195bea8 ...
Waiting for services to be up and running...
Pulling docker image yiisoftware/yii2-php:7.1-apache ...
Using docker image sha256:ef909b8f5d93b29211b51956996bd5f9905a8f5f2fcb520b7d0dc3f3f87d22b6 for yiisoftware/yii2-php:7.1-apache with digest yiisoftware/yii2-php@sha256:8ecbf8e08cf8e30ff63e4f79b998e04014e7631be6ee2e3bbf1df03559266792 ...
Preparing environment
00:01
Running on runner-oyubfdd6-project-76-concurrent-0 via b8e10b9b973b...
Getting source from Git repository
00:02
Fetching changes...
Reinitialized existing Git repository in /builds/dis/dis/.git/
Checking out f074541b as 363-12-special-value-lists...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
usermod: no changes
error: 'xdebug' does not exist
usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
   ie: /usr/local/bin/docker-php-ext-enable gd mysqli
       /usr/local/bin/docker-php-ext-enable pdo pdo_mysql
       /usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc
Possible values for module-name:
bcmath.so curl.so exif.so gd.so iconv.so imagick.so intl.so mbstring.so mongodb.so opcache.so pdo_mysql.so pdo_pgsql.so soap.so zip.so
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

.gitlab-ci.yml

image: yiisoftware/yii2-php:7.1-apache

services:
  - name: mariadb:latest
    alias: db

variables:
  MYSQL_USER: db_user
  MYSQL_PASSWORD: db_password
  MYSQL_DATABASE: test_test
  MYSQL_ROOT_PASSWORD: root_password
  PHP_ENABLE_XDEBUG: 1

stages:
  - backend_test
  - frontend_test

test_backend:
  stage: backend_test
  before_script:
    - ln -s "$(pwd)/web" /app/web
    - apachectl start
  script:
    - cp .env-test .env
    - composer install
    - chmod +x yii
    - ./yii migrate --interactive=0
    - ./backend/vendor/bin/codecept run --coverage-text --coverage-html --no-colors
  coverage: '/^\s*Lines:\s*\d+.\d+\%/'
  artifacts:
    paths:
      - backend/tests/_output/coverage
  tags:
    - shared
  only:
    refs:
      - branches
samdark commented 3 years ago

@schmunk42 would you please take a look?

schmunk42 commented 3 years ago

Actually the latest 7.1 build also fails with the same error. See https://travis-ci.com/github/yiisoft/yii2-docker/jobs/448664571#L5751

In the end https://travis-ci.com/github/yiisoft/yii2-docker/jobs/448664571#L6023 the broken image gets pushed. I wonder if this is because the test is allowed to fail :disappointed:

For the future is should be fixed by https://github.com/yiisoft/yii2-docker/commit/7a3cbd9bd2aa54d8c34d665d2b5cdcd2d4f289ef

But we still need to fix and push the broken images somehow...

schmunk42 commented 3 years ago

Was there a Xdebug update?

From 7.1 build log https://api.travis-ci.com/v3/job/448664567/log.txt

 ---> 638bdca6abe8
Step 7/15 : RUN printf "\n" | pecl install         imagick         xdebug         mongodb &&     docker-php-ext-enable         imagick         mongodb
 ---> Running in 931e69005274
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/xdebug requires PHP (version >= 7.2.0, version <= 8.0.99), installed version is 7.1.33
downloading imagick-3.4.4.tgz ...

Even more strange that the Docker build is not failing here?!

odai-alali commented 3 years ago

@schmunk42 7.1 support is deprecated in xdebug 3.0.0

installing xdebug 2.9.8 solved it

Adding an Env variable for xdebug will be a solution for building all the tags

schmunk42 commented 3 years ago

fixed via #105

schmunk42 commented 3 years ago

@samdark I see this error on Travis...

Builds have been temporarily disabled for public repositories due to a negative credit balance. Please go to the Plan page to replenish your credit balance or alter your Consume paid credits for OSS setting.

I get an error, when I want to claim the OSS setting?!

schmunk42 commented 3 years ago

@samdark I see this error on Travis...

Builds have been temporarily disabled for public repositories due to a negative credit balance. Please go to the Plan page to replenish your credit balance or alter your Consume paid credits for OSS setting.

I get an error, when I want to claim the OSS setting?!

I get an error page here: https://travis-ci.com/github/yiisoft/yii2-docker/branches

odai-alali commented 3 years ago

@schmunk42 would it make sense to migrate CI to github actions?

I started a test here https://github.com/odai-alali/yii2-docker/blob/gh-actions/.github/workflows/docker-image.yml

result: https://github.com/odai-alali/yii2-docker/runs/1472928025

samdark commented 3 years ago

@schmunk42 Travis reduced OSS credit down to almost nothing so yeah, the only good way to fix it is to switch to GitHub actions.

schmunk42 commented 3 years ago

Let's switch to GH actions.