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

Update language server version for fix: Dockerfile linting problems with variables in RUN instructions #952

Closed
mrweiland opened this issue May 22, 2019 · 14 comments · Fixed by #1078
Labels
Milestone

Comments

@mrweiland
Copy link

Im running VSCode

Version: 1.34.0 (user setup)
Commit: a622c65b2c713c890fcf4fbf07cf34049d5fe758
Date: 2019-05-15T21:59:37.030Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

When i writing Dockerfile with escape=` i always get "lint" error in file - see below image.
image

Here you can see in dockerfile that it indicate error
image

I can build docker image still - but i guess this has something todo with vscode-docker extension and linting?

@mrweiland mrweiland changed the title Linting powershell file with # escape=` Dockerfile linting problem with # escape=` on top of file May 22, 2019
@rcjsuen
Copy link
Contributor

rcjsuen commented May 22, 2019

Hi, @mrweiland. Thank you for your bug report.

Can you share (or trim down) your Dockerfile and post it here?

@mrweiland
Copy link
Author

Ok - i take first part of docker file the problems starts at Remove-Item -Force -Recurse..

# escape=`

ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.8-windowsservercore-ltsc2016

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install NuGet CLI
ENV NUGET_VERSION 4.4.1
RUN New-Item -Type Directory $Env:ProgramFiles\NuGet; `
    Invoke-WebRequest -UseBasicParsing "https://dist.nuget.org/win-x86-commandline/v$Env:NUGET_VERSION/nuget.exe" -OutFile $Env:ProgramFiles\NuGet\nuget.exe

# Install VS Test Agent
RUN Invoke-WebRequest -UseBasicParsing "https://download.visualstudio.microsoft.com/download/pr/446c5efe-9162-41a1-b380-704c82d13afa/8c6c6f404ed99e477007f16a336f99a6/vs_testagent.exe" -OutFile vs_TestAgent.exe; `
    Start-Process vs_TestAgent.exe -ArgumentList '--quiet', '--norestart', '--nocache' -NoNewWindow -Wait; `
    Remove-Item -Force vs_TestAgent.exe; `
    # Install VS Build Tools
    Invoke-WebRequest -UseBasicParsing "https://download.visualstudio.microsoft.com/download/pr/df649173-11e9-4af2-8eb7-0eb02ba8958a/cadb5bdac41e55bb8f6a6b7c45273370/vs_buildtools.exe" -OutFile vs_BuildTools.exe; `
    # Installer won't detect DOTNET_SKIP_FIRST_TIME_EXPERIENCE if ENV is used, must use setx /M
    setx /M DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1; `
    Start-Process vs_BuildTools.exe `
    -ArgumentList `
    '--add', 'Microsoft.VisualStudio.Workload.MSBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.NetCoreBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.VCTools', `
    '--add', 'Microsoft.VisualStudio.Workload.NodeBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.MSBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.WebBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.AzureBuildTools', `
    '--add', 'Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools', `
    '--add', 'Microsoft.Net.ComponentGroup.4.7.DeveloperTools', `
    '--add', 'Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools', `
    '--add', 'Microsoft.VisualStudio.Workload.NetCoreBuildTools', `
    '--add', 'Microsoft.Component.ClickOnce.MSBuild', `
    '--add', 'Microsoft.VisualStudio.Component.VC.v141.MFC', `
    '--add', 'Microsoft.VisualStudio.Component.VC.v141.ATL', `
    '--remove', 'Microsoft.VisualStudio.Component.Windows81SDK', `
    '--quiet','--includeRecommended','--includeOptional', '--norestart', '--nocache' `
    -NoNewWindow -Wait; `
    Remove-Item -Force vs_buildtools.exe; `
    Remove-Item -Force -Recurse \"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\"; `
    Remove-Item -Force -Recurse ${Env:TEMP}\*; `
    Remove-Item -Force -Recurse \"${Env:ProgramData}\Package Cache\"

@mrweiland
Copy link
Author

Here you can also see color coding gets messy

image

@rcjsuen
Copy link
Contributor

rcjsuen commented May 22, 2019

Thank you for posting your Dockerfile, @mrweiland.

  1. The error looks similar to what was reported in Accept bash syntax for variable non-nullness rcjsuen/dockerfile-utils#56. I think I'll change the code so that we don't do any variable substitution checks in RUN instructions.
  2. With regards to the syntax colouring looking weird, that is a separate problem. You can refer to Dockerfile syntax highlighting for escaped quotes is not quite right #75, Remapping of escape character not handled #245, and Syntax colorization stops working after RUN command in visual studio code with docker 0.0.27 plugin #292.

@mrweiland
Copy link
Author

Then we hope for a quick update on this issue. :)

@rcjsuen
Copy link
Contributor

rcjsuen commented May 22, 2019

@mrweiland I have fixed the linting issue in rcjsuen/dockerfile-utils#60. It will take some time before it get adopted into this VS Code extension though.

Thank you again for your bug report!

@StephenWeatherford StephenWeatherford changed the title Dockerfile linting problem with # escape=` on top of file Update language server version for fix: Dockerfile linting problem with # escape=` on top of file May 22, 2019
@StephenWeatherford
Copy link
Contributor

Boy, Remy, you're fast!

@rcjsuen Leaving this open so that we can track that we need to update to the new language server once there is a released version.

@StephenWeatherford StephenWeatherford added this to the 0.7.0 milestone May 22, 2019
@rcjsuen
Copy link
Contributor

rcjsuen commented May 22, 2019

@StephenWeatherford Haha, I knew you would reopen this for tracking purposes.

Nobody likes seeing false positives so I'm just trying to do my job. :)

@PrashanthCorp
Copy link
Contributor

Need to update our dependency on the lang server to 0.0.13.

@StephenWeatherford
Copy link
Contributor

@rcjsuen Well, the bug's not actually fixed until it makes it to our repo. :-) Thanks for the quick response!

@rcjsuen
Copy link
Contributor

rcjsuen commented May 23, 2019

@StephenWeatherford When do you plan to cut and release 0.7.0?

@StephenWeatherford
Copy link
Contributor

Probably a couple weeks or so.

@rcjsuen
Copy link
Contributor

rcjsuen commented May 29, 2019

@StephenWeatherford I understand. I'll try to get something for you all this week or next.

Can someone change the title so that it says "Dockerfile linting problems with variables in RUN instructions"?

The linting issue is not related to the escape parser directive at the top of the file. The syntax highlighting problem is covered by #75, #245, and #292.

@ejizba ejizba changed the title Update language server version for fix: Dockerfile linting problem with # escape=` on top of file Update language server version for fix: Dockerfile linting problems with variables in RUN instructions May 29, 2019
@rcjsuen
Copy link
Contributor

rcjsuen commented Jun 21, 2019

I've opened #1078 to update the language server to 0.0.21.

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants