Have given up on getting an Azure Windows Host Agent to build my Jekyll blog site in an Azure DevOps pipeline, as the previous post here. Have a Ubuntu solution that works.

Context

This blog site is authored using Markdown and built upon Jekyll. Building occurs in an Azure Pipeline when it is committed to the app’s Azure Git repository. From there the pipeline releases it to Azure Blob Storage where it manifests as a Static Web Site. As discussed in the previous post, an issue has arisen wrt Azure Devops Pipeline HostAgent updates. Namely, that the versions of some components of Host Agents get updated. In particular, the version of Ruby changes, which is required for Jekyll as used by this site. It seems that the components that are automatically in Ruby versions changes and so you need to explicitly include them, if you know what is excluded.

This blog site used an Azure Windows Host Agent, using an unchanged version of Ruby (3.1.4) for a long period. But when this was updated to version 3.1.5 in May-June this year, it broke this blog site’s Jekyll build. Indeed it has now been updated again to version 3.1.6. The previous post explored many suggested pipeline workarounds when using the Windows Host Agent. Whilst partial solutions were found, none were complete for this site. The interim solution was to build the site on the development machine and manually copy it from there to Azure Blob Storage. This post discusses using an Ubuntu Host Agent for building this Jekyll blog site, which works.

Some Comments

  • The issue is the version of Ruby that ADO hosted agents come with, they need to be 3.2 at least
  • My VS Code Windows desktop version of Ruby is version 3.2.2. Jekyll builds OK there.
  • rexml (part of ruby) is missing strscan

The Solution

A new build pipeline was created using an Ubuntu pipeline rather than a Windows one. The pipeline was created using a yaml script:

# Ruby
# Package your Ruby project.
# Add steps that install rails, analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/ruby

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: UseRubyVersion@0
  inputs:
    versionSpec: '>= 2.4'

- script: |
    gem install jekyll bundler
 
  displayName: Install Jekyll and bundler

- script: 
     bundle install
  displayName: Install Gems
  


- script: 'bundle exec jekyll build'
  displayName: Build

- task: CopyFiles@2
  displayName: 'Copy "_site" to staging directory'
  inputs:
    SourceFolder: '_site'
    TargetFolder: '$(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: _site'
  inputs:
    ArtifactName: '_site'

Notes

  • The new build Ubuntu pipeline exists alongside the Windows one. So that the Windows pipeline does not trigger on a commit, its [ ] Enable continuous integration check point was disabled.
  • The sample source for the Ubuntu build had the trigger as Main whereas the repository branch is master. The site wouldn’t build automatically with a repository commit until this change was made.
  • Ruby 3.1.6 x64 was used in the build, as per the log.
  • In the Release pipeline, this new pipeline was added as an Artifact, THEN the Windows one was removed.
  • In the Artifacts box click the “lightning” icon top right of the inner box for Continuous Integration.
    • Enable it if not enabled.

All good now!


 TopicSubtopic
   
 This Category Links 
Category:Web Sites Index:Web Sites
<  Prev:   Azure Pipelines