cockpit-project / cockpit-project.github.io

Cockpit Project Website
https://cockpit-project.org/
MIT License
114 stars 192 forks source link

Error when running _scripts/container-jekyll #725

Closed deadmeu closed 1 month ago

deadmeu commented 2 months ago

I'm trying to run an instance of the website in an EndeavourOS VM but am getting the following error:

[test@test cockpit-project.github.io]$ _scripts/container-create
## Creating website container...
STEP 1/2: FROM ghcr.io/github/pages-gem
Trying to pull ghcr.io/github/pages-gem:latest...
Getting image source signatures
Copying blob f12c0bb1b56e skipped: already exists
Copying blob 7bb465c29149 skipped: already exists
Copying blob 49b40be4436e skipped: already exists
Copying blob c558fac597f8 skipped: already exists
Copying blob d13bbd9d0903 skipped: already exists
Copying blob 3624f0415588 skipped: already exists
Copying blob 1aec4714ae57 skipped: already exists
Copying blob 2b9b41aaa3c5 skipped: already exists
Copying blob 0abfbb302d12 skipped: already exists
Copying blob 5dd011617356 skipped: already exists
Copying blob 6409e148743c skipped: already exists
Copying blob 95eaf8e4f682 skipped: already exists
Copying blob 5d3f8fce2cd4 skipped: already exists
Copying blob 3cfb8ed124d4 skipped: already exists
Copying blob 7b1dcf51c52a skipped: already exists
Copying blob b46f0b255d80 skipped: already exists
Copying blob c2eb13e07edc skipped: already exists
Copying config 0fd5994aba done   |
Writing manifest to image destination
STEP 2/2: RUN bundle config path /src/site/.gem
--> Using cache a1ee55dc16a49a02f30aef26fc3a2b99e2cd03250e3d052ecb888bd17f367a14
COMMIT cockpit-website
--> a1ee55dc16a4
Successfully tagged localhost/cockpit-website:latest
a1ee55dc16a49a02f30aef26fc3a2b99e2cd03250e3d052ecb888bd17f367a14
Bundle complete! 4 Gemfile dependencies, 96 gems now installed.
Bundled gems are installed into `./.gem`
## Done!
## Run _scripts/container-jekyll
[test@test cockpit-project.github.io]$ _scripts/container-jekyll
/src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll.rb:28: warning: csv was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec. Also contact author of jekyll-3.9.3 to add csv into its gemspec.
jekyll 3.9.3 | Error:  undefined method `[]' for nil
/usr/local/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll/log_adapter.rb:43:in `adjust_verbosity'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb:157:in `config_files'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll.rb:113:in `configuration'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll/command.rb:43:in `configuration_from_options'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:89:in `start'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
        from /src/site/.gem/ruby/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from /src/site/.gem/ruby/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from /src/site/.gem/ruby/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from /src/site/.gem/ruby/3.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from /src/site/.gem/ruby/3.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from /src/site/.gem/ruby/3.3.0/gems/jekyll-3.9.3/exe/jekyll:15:in `<top (required)>'
        from /src/site/.gem/ruby/3.3.0/bin/jekyll:25:in `load'
        from /src/site/.gem/ruby/3.3.0/bin/jekyll:25:in `<top (required)>'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:451:in `exec'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:34:in `dispatch'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:28:in `start'
        from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
        from /usr/local/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
        from /usr/local/bin/bundle:25:in `load'
        from /usr/local/bin/bundle:25:in `<main>'

It may be due to a configuration error on my part but I'm not sure.

martinpitt commented 2 months ago

Indeed, I can reproduce. There's no "configuration" on your part, it's all happening in the container.

@garrett can you please have a look? Thanks!

garrett commented 1 month ago

Apologies for the 2 week delay! It's holiday time in Europe so workdays are limited this month. As a result, I've been focused on various designs and PRs for two different teams (Cockpit included), so I've been mostly ignoring my GitHub notifications as to be able to get some specific tasks done. No one pinged me specifically about this issue, so I'm just getting around to it now. :wink:

We inherit from GitHub Pages (on purpose) and stack a few Gems on top, locking them in place (as to be reproducible) and the containers help with that.

However, the container for GitHub Pages is at :latest, as GitHub is also using the latest container for building. I suspect that something changed in their container or in a minor version of a gem (probably the later, where they didn't test a combination of gems that we happened to use). I'd dig into the exact reason, except that I found a fix that works. I've nuked the Gemfile.lock and generated a new dependency of gems and the bug doesn't show up.

Updating our gem dependency tree is good to do from time to time (and we do this from time to time anyway). As we're generating a static site, it isn't as important as code running in production, but still a good idea nonetheless. Updating to the latest sets of gem dependencies fixes this bug, so the gems are all actually fully compatible again with Jekyll (instead of just saying they are).

I'll be pushing up a PR in a couple minutes that fixes this. Thanks for your patience! Apologies again for being away to fix this!