Skip to content

fix: interpolate ${{ }} expressions in job container volumes - #6141

Open
waterWang wants to merge 1 commit into
nektos:masterfrom
waterWang:fix/interpolate-container-volumes
Open

fix: interpolate ${{ }} expressions in job container volumes#6141
waterWang wants to merge 1 commit into
nektos:masterfrom
waterWang:fix/interpolate-container-volumes

Conversation

@waterWang

Copy link
Copy Markdown

Description

When a workflow job uses a container with volumes that contain ${{ }} expressions (e.g., ${{ vars.BUILDDOC_WEBDIR || /var/www/html/poubelle }}), the expressions are not interpolated before validation. This causes the volume to be rejected with an error like:

[${{ vars.BUILDDOC_WEBDIR || /var/www/html/poubelle }}] is not a valid volume, will be ignored

Root Cause

The GetBindsAndMounts() method processes job container volumes directly from the parsed YAML model without running them through the expression evaluator (rc.ExprEval.Interpolate).

In contrast, the service container volumes are correctly interpolated at line 310-312 before being passed to GetServiceBindsAndMounts(). The job container volumes path was simply missing this interpolation step.

Fix

  1. Added ctx context.Context parameter to GetBindsAndMounts()
  2. Added rc.ExprEval.Interpolate(ctx, v) call for each volume path before validation
  3. Updated the caller to pass ctx

Testing

  • The fix follows the same pattern already used for service container volumes (lines 310-312)
  • The ExprEval.Interpolate() method handles ${{ }} expressions that can't be evaluated (non-existent vars, syntax errors) by returning the original string unchanged, so existing workflows without expressions continue to work exactly as before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant