有时添加 discourse-code-review 时缺少 CMake

这看起来与 ERROR: CMake is required to build Rugged 类似,但我刚刚尝试了一次引导(bootstrap),结果发现如果不执行以下操作就会失败:

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

错误信息如下:

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

但在另一台系统上,我无需此步骤就能成功添加该插件。两台系统都使用了相当标准的 web_only.yml 配置(出问题的系统部署在 Kubernetes 上,正常工作的系统使用 Traefik 作为反向代理,但我不明白这如何会影响引导过程是否运行)。

我留下这段信息,以防我的变通方法能帮助其他人,或者让了解情况的人意识到需要修改某些地方。

最新镜像中已安装 cmake。您是否停留在旧镜像上?重新构建即可完成更新。

啊哈。rebuild 会执行更新,但 bootstrap 不会。而在另一台系统上,我最近刚做过一次 rebuild。这就解释得通了,我想我需要再确认一下我的 bootstrap 脚本是否执行了 git pull