Azure Devops 管道 Jekyll 构建失败

时间:2021-02-10 05:55:34

标签: azure-devops jekyll

我正在使用 Azure Devops Pipeline 构建我的 Jekyll 博客站点并将其发布到 Azure Blob 存储。它最近工作正常,但我今天写了一篇新文章,但在构建步骤中失败了。一天左右前一切正常。注意:构建由对 Devops 存储库的提交触发。该网站在本地构建正常。

Generating script.
Script contents:
bundle exec jekyll build
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\3f5d7781-f35f-48db-b750-9feccaae9bb5.cmd""
C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `require': cannot load such file -- rexml/parsers/baseparser (LoadError)
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `<class:Kramdown>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:60:in `<module:Parser>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:19:in `<module:Kramdown>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:17:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll/converters/smartypants.rb:3:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll/converters/smartypants.rb:3:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll.rb:13:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll.rb:13:in `block in require_all'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll.rb:12:in `each'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll.rb:12:in `require_all'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/lib/jekyll.rb:194:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/exe/jekyll:8:in `require'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.7/exe/jekyll:8:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/bin/jekyll:23:in `load'
from C:/hostedtoolcache/windows/Ruby/3.0.0/x64/bin/jekyll:23:in `<main>'
##[error]Cmd.exe exited with code '1'.
Finishing: Build

我删除了帖子并重新提交,但仍然失败。

Pipeine 中的构建脚本是:

bundle exec jekyll build

我的 gemfile 如下

source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.8.5"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

# https://github.com/pmarsceill/just-the-docs
# gem "just-the-docs"

# https://github.com/pages-themes/leap-day
gem "jekyll-theme-leap-day"

# https://github.com/jekyll/jekyll-seo-tag
gem 'jekyll-seo-tag'
gem 'jekyll-paginate'

# https://www.r-bloggers.com/creating-an-rss-feed-to-add-your-jekyll-github-pages-blog-to-r-bloggers/#:~:text=%20Creating%20an%20RSS%20Feed%20to%20Add%20Your,put%20the%20.xml%20file%20in%20the...%20More%20
# gem 'jekyll-feed'

gem "webrick" 

管道脚本:

Pipeline: Agent pool: Hosted VS2017
Get Resources: The repository, Master Branch, also tried a branch gleaned for earlier submit. Clean:False
Use Ruby>-2.4: Version Spec >=2.4  AddToPath is checked
Install Jekyll and bundler: gem install jekyll bundler
Install Gems: bundle install
Build: bundle exec jekyll build

Following steps are Copy Site and Publish Artifact

2 个答案:

答案 0 :(得分:1)

<块引用>

Azure Devops 管道 Jekyll 构建失败

如果您使用的是私人代理,请尝试按照以下步骤解决此错误:

  • 运行 bundle info kramdown 将为您提供到达 kramdown 的路径 已安装。
  • 运行 gem env 以深入了解 Ruby 关注的所有路径。
  • 如果未列出从上面安装 kramdown目录gem env 输出中,您必须手动添加该路径

如果您使用的是托管代理,请尝试参考以下建议:

将 gem“webrick”添加到您网站中的 Gemfile。比运行 bundle install

此时您可以运行bundle exec jekyll build

答案 1 :(得分:0)

我玩过 Ruby 版本。如果我将该脚本版本规范设置为:

<3.0

成功了! :)