Skip to content

Docker error when validating report schema

Mike Lindsay requested to merge docker_instructions_update into master

What does this MR do and why?

Small docker documentation and schema version change. The default instructions for docker ruby:3-slim do not work as given. I had to use the full Ruby to validate my report schema.

Screenshots or screen recordings

When running docker run -it --rm -v $(pwd):/ci ruby:3-slim ruby /ci/validate.rb /ci/container-scanning-format_15-0-6.json /ci/gl-container-scanning-report.json an error is generated;

/usr/local/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:190:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)

    current directory: /usr/local/bundle/gems/unf_ext-0.0.8.2/ext/unf_ext
/usr/local/bin/ruby extconf.rb
checking for -lstdc++... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/$(RUBY_BASE_NAME)
        --with-static-libstdc++
        --without-static-libstdc++
        --with-stdc++-dir
        --without-stdc++-dir
        --with-stdc++-include
        --without-stdc++-include=${stdc++-dir}/include
        --with-stdc++-lib
        --without-stdc++-lib=${stdc++-dir}/lib
        --with-stdc++lib
        --without-stdc++lib
/usr/local/lib/ruby/3.2.0/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

        from /usr/local/lib/ruby/3.2.0/mkmf.rb:583:in `try_link0'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:601:in `try_link'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:819:in `try_func'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1062:in `block in have_library'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:989:in `block in checking_for'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:354:in `block (2 levels) in postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:354:in `block in postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:350:in `postpone'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:988:in `checking_for'
        from /usr/local/lib/ruby/3.2.0/mkmf.rb:1057:in `have_library'
        from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/bundle/extensions/x86_64-linux/3.2.0/unf_ext-0.0.8.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/unf_ext-0.0.8.2 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/3.2.0/unf_ext-0.0.8.2/gem_make.out

  /usr/local/lib/ruby/3.2.0/rubygems/ext/builder.rb:119:in `run'
  /usr/local/lib/ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:27:in `build'
  /usr/local/lib/ruby/3.2.0/rubygems/ext/builder.rb:187:in `build_extension'
  /usr/local/lib/ruby/3.2.0/rubygems/ext/builder.rb:221:in `block in build_extensions'
  /usr/local/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `each'
  /usr/local/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `build_extensions'
  /usr/local/lib/ruby/3.2.0/rubygems/installer.rb:843:in `build_extensions'
  /usr/local/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /usr/local/lib/ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /usr/local/lib/ruby/3.2.0/bundler/source/rubygems.rb:200:in `install'
  /usr/local/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:54:in `install'
  /usr/local/lib/ruby/3.2.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/local/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:156:in `do_install'
  /usr/local/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /usr/local/lib/ruby/3.2.0/bundler/worker.rb:62:in `apply_func'
  /usr/local/lib/ruby/3.2.0/bundler/worker.rb:57:in `block in process_queue'
  /usr/local/lib/ruby/3.2.0/bundler/worker.rb:54:in `loop'
  /usr/local/lib/ruby/3.2.0/bundler/worker.rb:54:in `process_queue'
  /usr/local/lib/ruby/3.2.0/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing unf_ext (0.0.8.2), and Bundler cannot continue.

In Gemfile:
  json_schemer was resolved to 1.0.3, which depends on
    simpleidn was resolved to 0.2.1, which depends on
      unf was resolved to 0.1.4, which depends on
        unf_ext

        from /usr/local/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:96:in `call'
        from /usr/local/lib/ruby/3.2.0/bundler/installer/parallel_installer.rb:67:in `call'
        from /usr/local/lib/ruby/3.2.0/bundler/installer.rb:244:in `install_in_parallel'
        from /usr/local/lib/ruby/3.2.0/bundler/installer.rb:201:in `install'
        from /usr/local/lib/ruby/3.2.0/bundler/installer.rb:89:in `block in run'
        from /usr/local/lib/ruby/3.2.0/bundler/process_lock.rb:12:in `block in lock'
        from /usr/local/lib/ruby/3.2.0/bundler/process_lock.rb:9:in `open'
        from /usr/local/lib/ruby/3.2.0/bundler/process_lock.rb:9:in `lock'
        from /usr/local/lib/ruby/3.2.0/bundler/installer.rb:71:in `run'
        from /usr/local/lib/ruby/3.2.0/bundler/installer.rb:23:in `install'
        from /usr/local/lib/ruby/3.2.0/bundler/inline.rb:58:in `block (3 levels) in gemfile'
        from /usr/local/lib/ruby/3.2.0/bundler/settings.rb:131:in `temporary'
        from /usr/local/lib/ruby/3.2.0/bundler/inline.rb:57:in `block (2 levels) in gemfile'
        from /usr/local/lib/ruby/3.2.0/bundler/settings.rb:131:in `temporary'
        from /usr/local/lib/ruby/3.2.0/bundler/inline.rb:51:in `block in gemfile'
        from /usr/local/lib/ruby/3.2.0/bundler.rb:419:in `block in with_unbundled_env'
        from /usr/local/lib/ruby/3.2.0/bundler.rb:665:in `with_env'
        from /usr/local/lib/ruby/3.2.0/bundler.rb:419:in `with_unbundled_env'
        from /usr/local/lib/ruby/3.2.0/bundler/inline.rb:42:in `gemfile'
        from /ci/validate.rb:3:in `<main>'

To fix it, I updated the schema version to 15.0.6 from 14.0.6 and used a full Ruby image docker run -it --rm -v $(pwd):/ci ruby:3 ruby /ci/validate.rb /ci/container-scanning-format_15-0-6.json /ci/gl-container-scanning-report.json

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Mike Lindsay

Merge request reports

Loading