chore(duo): install ruby in Duo agent sessions
What does this MR do and why?
release-platform-canary is joining the MR Risk Labeler pilot for its Renovate merge requests (gitlab-org/gitlab#638927). The flow will rate those bumps against rules held in components/agents-and-flows/gitlab-merge-request. For now it only labels, and nothing it says approves or merges anything.
A flow run in CI takes this project's .gitlab/duo/agent-config.yml: its image, its setup_script and its network policy. Every run_command step of the MR Risk Labeler runs ruby, and duo-workflow-sandbox ships git, node, mise and python but no Ruby. Without it, every run here would end at its first Ruby step and write nothing. This MR:
- pins Ruby in
.tool-versions(ruby 3.4.12, with the copier template'sruby-versionannotation), so Renovate keeps it current like the project's other tools..gitlab-ci-asdf-versions.ymlis regenerated from it.mise installnow installs Ruby in local development and invalidate_mise_tool_versionstoo. Nothing setsMISE_RUBY_COMPILEthere, so mise picks the build: with mise 2026.10 on an Apple Silicon Mac that is the precompiled one, in seconds, and where mise has no precompiled build it compiles Ruby from source. - installs mise's precompiled build of it in the setup script (
MISE_RUBY_COMPILE=false), on a line of its own that only warns when it fails. The mainmise installskips Ruby (MISE_DISABLE_TOOLS=ruby), so a Renovate bump to a version thatjdx/rubyhas not built yet costs only the MR Risk Labeler, and the project's other flows are unaffected. The build's source (jdx/ruby) and its attestation check are set as variables, which outrank the checkout's.mise.toml, so the merge request under review can't change where that Ruby comes from. It can change the version, as it can for the other pinned tools. - puts it on
PATHon a line of its own, so a Ruby restored from the cache is still found when the install can't run. If both fail, the setup script warns and the session goes on.
The image's base already sets LANG and LC_ALL to C.UTF-8, so this sets no locale.
For the template and image owners
This file comes from the gl-infra copier template. The template's current version replaces this setup_script with eval "$(/usr/local/bin/duo-workflow-setup)", so the next template update will conflict with the lines this MR adds and with the MISE_DISABLE_TOOLS=ruby it puts on the template's install line. Their comment says to keep them.
Ruby in the duo-workflow-sandbox image would serve every project built from the template, and would let these lines go. This project needs it there before a verdict of the flow can approve anything here: the setup script runs outside the sandbox, with the session's tokens, on the project's checkout, and installs whatever that checkout's pins name, and the Ruby it installs lands in a cached directory a session can write to.
Related
- The rules for this project, and its entry in the flow's consumers: components/agents-and-flows/gitlab-merge-request!125 (merged).
- gitlab-org/quality/triage-ops!4541 (merged), which starts the flow on Renovate's merge requests here, waits for this to merge.
How to validate
- Run locally on macOS under
set -eo pipefail, the setup script's lines install Ruby 3.4.12 fromjdx/rubyin seconds while the main install skips it, and that Ruby loadszlibandopenssl, which the flow's steps need. With no network they still export a cached Ruby, and they only warn when.tool-versionsnames a version that has no precompiled build. - After the catalog sync creates this project's consumer, mention
@ai-mr-risk-labeler-gitlab-orgon a Renovate merge request. The workload job's log should showruby@3.4.12installed by the setup script, and the session should get past its first Ruby step,extract_iid.