Search code examples
azure-devopsazure-pipelinesdevopsjekyllazure-pipelines-build-task

Azure Devops Jekyll site build fails, worked previously


My blog site https://davidjones.sportronics.com.au I submit to Azure Devops where it is built as a Jekyll site. Has worked fine for a several years with only minor updates. Scripts run using Win 2019 VM.

Yesterday the build failed:

Pipeline steps:

  • Use Ruby > 3.0.0
  • Install Jekyll and Bundler
  • Install Gems
  • Build
  • Copy site to staging directory
  • Publish Artifact: _site

Pipeline step: Use Ruby > 3.0.0
Script: Version Spec 3.1.4

Was this (this worked for some time) but failed today. Devops says available versions are 3.0.7 or 3.1.5

Worked on previous submission mid May and for a long time prior.

Tried Version specs as below but fails at Build

  • 3.1.5
  • 3.0.7
  • > 3.0.0 Fir this: Found tool in cache: Ruby 3.1.5 x64

Nb: Local build uses 3.2.2

With these, got past the version check runs next 2 steps OK but build fails:

C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/3.1.0/csv/parser.rb:3:in `require': 126: The specified module could not be found. 

Install Jekyll and bundler: Script:gem install jekyll bundler

Final lines:

Done installing documentation for bundler after 0 seconds
29 gems installed
Finishing: Install Jekyll and bundler

Install Gems Script: bundle install

Final Lines:

Bundle complete! 10 Gemfile dependencies, 43 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Finishing: Install Gems

Build: Script: bundle exec jekyll build

Output:

Starting: Build
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.237.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents: shell
bundle exec jekyll build
========================== Starting Command Output ===========================
"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\9815d7ee-08b2-4491-934a-b1fb6ffcea97.cmd""
C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/3.1.0/csv/parser.rb:3:in `require': 126: The specified module could not be found.   - C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/gems/3.1.0/gems/strscan-3.1.0/lib/strscan.so (LoadError)
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/3.1.0/csv/parser.rb:3:in `<top (required)>'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/3.1.0/csv.rb:98:in `require_relative'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/3.1.0/csv.rb:98:in `<top (required)>'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.3/lib/jekyll.rb:28:in `require'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.3/lib/jekyll.rb:28:in `<top (required)>'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.3/exe/jekyll:8:in `require'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/lib/ruby/gems/3.1.0/gems/jekyll-4.3.3/exe/jekyll:8:in `<top (required)>'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/bin/jekyll:32:in `load'
    from C:/hostedtoolcache/windows/Ruby/3.1.5/x64/bin/jekyll:32:in `<main>'
##[error]Cmd.exe exited with code '1'.
Finishing: Build

I have posted a detailed blog on this: Azure Pipelines: Jekyll Site Build failure


Solution

  • I can reproduce the same issue when using the Microsoft-hosted agent: Windows-2019 in Azure Pipeline.

    enter image description here

    The cause of the issue could be that the environment settings or the configurations have issues when using the Ruby version 3.1.5 on Windows-2019 agent. You can report the issue to this feedback site: Agent image feedback

    To solve this issue, you can refer to the following methods:

    Method1: You can change to use the Ruby version: 3.0.7 in Windows-2019 agent.

    For example:

    - task: UseRubyVersion@0
      inputs:
        versionSpec: '3.0.7'
    

    Method2: You can re-install Ruby version 3.1.5 or other versions in Pipeline with the script. Then the pipeline can run successfully.

    Here is an example:

    pool:
      vmImage: windows-2019
    
    steps:
    
    - script:  choco install ruby --version=3.1.5.1
    - script: |
        gem install jekyll bundler
     
      displayName: Install Jekyll and bundler
    
    - script: 
         bundle install
      displayName: Install Gems
      
    
    
    - script: 'bundle exec jekyll build'
      displayName: Build
    

    Result:

    enter image description here

    Method3: You can change to use Microsoft-hosted agent: image Ububtu- 20.04, Ububtu-22.04.

    For example:

    pool:
      vmImage: ubuntu-latest
    

    Update:

    @David Jones has posted the issue report ticket: Using the Ruby version 3.1.5 on Windows-2019 Agent failure. We can keep focus on the feedback from image management team.