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

Dont trim line break characters from inputs #3025

Merged
merged 4 commits into from Jun 25, 2020
Merged

Conversation

damccorm
Copy link

This should fix this ticket - https://developercommunity.visualstudio.com/content/problem/1000335/azure-pipelines-trims-leading-and-trailing-rn-from.html.

Basically, some tasks/scripts can rely on their inputs not getting trimmed, we should respect the inputs.

This could break some people, but I think its the right thing to do and that they'd have to be relying on a bug.

@@ -190,7 +190,7 @@ public async Task RunAsync()
string key = input?.Name?.Trim() ?? string.Empty;
if (!string.IsNullOrEmpty(key))
{
inputs[key] = input.DefaultValue?.Trim() ?? string.Empty;
inputs[key] = input.DefaultValue ?? string.Empty;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests?

Is this going to break anyone that isn't currently broken? I guess anyone who has spacing now on accident will start to break. Will it be clear to them why it's broken?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to break anyone that isn't currently broken? I guess anyone who has spacing now on accident will start to break. Will it be clear to them why it's broken?

To be a little more exact, anyone who has spacing and is relying on there not being spacing is going to break. It probably won't be immediately clear, I didn't have a great solution for that. In theory we could warn that they have trailing spaces for a while, it would probably flag a bunch of false positives though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more about this - I think not trimming all whitespace scares me. I updated to still trim spaces, but this will leave linebreaks. It solves the ticket in question in what I think is a pretty safe way.

Because of how yaml is structured/the importance of whitespace, I think its not unreasonable to trim spaces.

@damccorm damccorm changed the title Dont trim whitespace from inputs Dont trim line break characters from inputs Jun 24, 2020
@Zhaph
Copy link

Zhaph commented Jul 16, 2020

This appears to have broken the MSBuild task when used as follows:

- task: VSBuild@1
  inputs:
    solution: |
        Client.WebJobs.*\Client.WebJobs.*.csproj
    configuration: '$(buildConfiguration)'
  displayName: 'Build Web Jobs projects in place'

This task ran as expected yesterday on pipeline agent 2.171.1 but is now failing on a hosted agent running 2.172.0 with the following error:

Starting: Build Web Jobs projects in place
==============================================================================
Task         : Visual Studio build
Description  : Build with MSBuild and set the Visual Studio version property
Version      : 1.166.2
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
==============================================================================
##[error]Solution not found using search pattern 'Client.WebJobs.*\Client.WebJobs.*.csproj
'.
Finishing: Build Web Jobs projects in place

Note the extra line break in the error message within the search pattern quotes.

mjroghelia pushed a commit that referenced this pull request Jul 16, 2020
mjroghelia added a commit that referenced this pull request Jul 16, 2020
This reverts commit 5e79b33.

Co-authored-by: maroghel <maroghel@microsoft.com>
mjroghelia added a commit that referenced this pull request Jul 16, 2020
This reverts commit 5e79b33.

Co-authored-by: maroghel <maroghel@microsoft.com>
@damccorm damccorm deleted the users/damccorm/dontTrim branch January 19, 2021 20:47
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.

None yet

3 participants