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 regex for FROM image overwrite #1109

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Conversation

mthalman
Copy link
Member

@mthalman mthalman commented Jan 17, 2023

The changes from dotnet/dotnet-buildtools-prereqs-docker#754 caused a failure in the internal build:

Error response from daemon: dockerfile parse error line 1: FROM requires either one or three arguments

This occurs because Image Builder is incorrectly rewriting the Dockerfile to target the locally built tag instead of the public MCR tag. It ends up replacing the whitespace between the end of the tag and the AS keyword, producing this FROM instruction: FROM dotnetdocker.azurecr.io/build-staging/2090449/dotnet-buildtools/prereqs:ubuntu-20.04-crossdeps-localAS binutils. Notice there's no space before AS. This is invalid syntax and causes the error to occur.

This is fixed by using the correct character class in the Regex which does the string replacement. The string its search to replace should stop before hitting any whitespace (\s) but it was using the non-whitespace character class (\S).

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@mthalman mthalman merged commit 4a6de1c into dotnet:main Jan 17, 2023
@mthalman mthalman deleted the dockerfile-rewrite branch January 17, 2023 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants