CMake missing when adding discourse-code-review, sometimes

AI-generated summary

When adding the discourse-code-review plugin, CMake may be missing, causing a build error. pfaffman encountered this issue and found a workaround by installing CMake before bootstrapping. However, Falco pointed out that the latest image already includes CMake. pfaffman realized that the issue was due to using bootstrap instead of rebuild, which does not update the image. To resolve the issue, users should ensure they are using the latest image and update their bootstraps to include a git pull command.

This seems similar to ERROR: CMake is required to build Rugged, but I just tried a bootstrap and it failed if I didn’t do

  before_code:
    - exec:
        cd: $home
        cmd:
          - apt update
          - apt -y install cmake

It failed like this.

I, [2020-06-22T17:13:16.381492 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'    
ERROR:  Error installing rugged:
        ERROR: Failed to build gem native extension.            
                                                                                                           
    current directory: /var/www/discourse/plugins/discourse-code-review/gems/2.6.5/gems/rugged-0.28.4.1/ext/rugged
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200622-21455-f9skgp.rb extconf.rb
checking for gmake... no                
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** 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-sha1dc
        --without-sha1dc
        --use-system-libraries

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

  /var/www/discourse/plugins/discourse-code-review/gems/2.6.5/extensions/x86_64-linux/2.6.0-static/rugged-0.28.4.1/mkmf.lo
g

extconf failed, exit code 1

But on another system I was able to add the plugin without it. Both are fairly standard web_only.yml (broken one launches to kubernetes, the working one has traefik as reverse proxy, but I don’t see how that would affect whether bootstrap would run!).

Just leaving this in case my workaround will help someone else or someone who knows something will recognize something that should be changed.

Latest image already contains cmake installed. Are you stuck on a old image? A rebuild does the update.

Aha. rebuild does an update, but bootstrap does not. And on the other system, I’d done a rebuild for something more recently. That explains it, and I guess I need to go double-check that my bootstraps are doing a git pull.