Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inputs trimming for variables #4940

Merged
merged 5 commits into from
Aug 23, 2024

Conversation

aleksandrlevochkin
Copy link
Contributor

@aleksandrlevochkin aleksandrlevochkin commented Aug 15, 2024

WI

AB#2195400

Problem

Currently inputs are trimmed only before variables expansion, which does not account for the case when a variable with, for example, a leading space is defined, and then is passed as a task input:

variables:
  fileshare-path: ' \\fileshare\path'

steps:
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'FilePath '
    TargetPath: $(fileshare-path)

In the example above the target path input value will not be trimmed by the agent regardless of the DISABLE_INPUT_TRIMMING knob value.

Solution

Added trimming for variables after the expansion. This new behavior is disabled by default and can be enabled by setting the AGENT_ENABLE_VARIABLE_INPUT_TRIMMING knob to true.

@aleksandrlevochkin aleksandrlevochkin marked this pull request as ready for review August 15, 2024 09:21
@aleksandrlevochkin aleksandrlevochkin merged commit c2f1c4f into master Aug 23, 2024
12 checks passed
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.

4 participants