sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
338 stars 690 forks source link

CI / CD Gitlab kitchen dokken #673

Closed bdietrich12 closed 6 months ago

bdietrich12 commented 2 years ago

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

Hi, I've got some error when i push and execute a kitchen test on my gitlab server . (the kitchen test is working on my personal computer)

When I try to run the kitchen test in the CI\CD i got the following errors :

update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up libhtml-parser-perl (3.72-5) ...
Setting up libhttp-message-perl (6.22-1) ...
Setting up mysql-server-8.0 (8.0.27-0ubuntu0.20.04.1) ...
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
invoke-rc.d: policy-rc.d denied execution of stop.
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 13 - Permission denied)
mysqld: [ERROR] Stopped processing the 'includedir' directive in file /etc/mysql/my.cnf at line 20.
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libcgi-pm-perl (4.46-1) ...
Setting up libhtml-template-perl (2.97-1) ...
Setting up libcgi-fast-perl (1:2.15-1) ...
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
 mysql-server-8.0
STDERR: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.UTF-8",
    LC_ALL = "en_US.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
E: Sub-process /usr/bin/dpkg returned an error code (1)
---- End output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "mysql-server-8.0=8.0.27-0ubuntu0.20.04.1"] ----
Ran ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "mysql-server-8.0=8.0.27-0ubuntu0.20.04.1"] returned 100

:pancakes: Cookbook version

mysql:11.0.0

:woman_cook: Chef-Infra Version

Version of chef-client in your environment: 17.6.18

:tophat: Platform details

Ubuntu 20.04 Docker version 20.10.5, build 55c4c88 ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu] kitchen-dokken (2.14.0) kitchen-inspec (2.5.0) kitchen-vagrant (1.11.0) kitchen-vcenter (2.11.0) test-kitchen (3.1.0)

Steps To Reproduce

Content of my recipe :

personal_mysql.rb:

case node[:platform]
  when "rocky"
    file "/etc/yum.repos.d/mariadb.repo"do
      owner 'root'
      group 'root'
      mode 0755
      action :create_if_missing
    end
    template "etc/yum.repos.d/mariadb.repo" do
      source "repos.erb"
    end
    mariadb_server_install 'MariaDB Server install' do
        action [ :install, :create]
        setup_repo false
    end
  when "centos", "redhat"
    if node['platform_version'].to_f > 6
      mariadb_server_install 'MariaDB Server install' do
        version '10.3'
        action [ :install, :create ]
      end
    end
  when "ubuntu"
    mysql_service 'default' do
      bind_address '0.0.0.0'
      port '3306'
      initial_root_password root_pass
      action [ :create, :start ]
    end

Content of kitchen.yml

driver:
  name: dokken
  chef_version: latest
  privileged: true
  pid_one_command: /usr/lib/systemd/systemd
  volumes:
    - /sys/fs/cgroup:/sys/fs/cgroup:ro
transport:
  name: dokken
provisioner:
  name: dokken
verifier:
  name: inspec
  privileged: true
  pid_one_command: /usr/lib/systemd/systemd
  volumes:
    - /sys/fs/cgroup:/sys/fs/cgroup:ro
  attributes:
    service: mysql
platforms:
- name: centos-7
  driver:
    image: dokken/centos-7
- name: rocky-8
  driver:
    image: dokken/rockylinux-8
- name: ubuntu-20.04
  driver:
    image: dokken/ubuntu-20.04
- name: ubuntu-18.04
  driver:
    image: dokken/ubuntu-18.04
    pid_one_command: /bin/systemd
  verifier:
    pid_one_command: /bin/systemd
    attributes:
      service: mysql
suites:
  - name: personal_mysql
    run_list:
      - recipe[personnal-mysql::config]
    verifier:
      inspec_tests:
        - tests/default.rb

I don't understand how it can work on my computer but not on my gitlab server.

PS : I've run manually the kitchen test command on the gitlab server.

ramereth commented 2 years ago

Do you have a link to this CI job so we can have some more context on how this is working?