-
Notifications
You must be signed in to change notification settings - Fork 191
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
Three related problems in buildDockerImageContextTar() #183
Comments
This issue is stale because it has been open 60 days with no activity. |
I am concerned that this issue has been marked |
Hi @jrobbins-LiveData this project is actively maintained. The Does the issue occur only on windows (assuming from the screenshots) or unix systems as well? |
@jrobbins-LiveData just to give an update: We just released It is still needed in calcuation the state-hash of the And if we will run into a breaking change anyway, we might as well get rid of the whole In short: the usage of this function is deprecated internally and we cannot change anything in this function => your suggestions will not make it into the code and it only makes sense to close this issue Disclaimer: I still need to verify all off the things written above. It might very well be that my assumptions are wrong, then I'll reopen this issue and work our suggestions in. What do you think? |
In this function:
terraform-provider-docker/internal/provider/resource_docker_registry_image_funcs.go
Line 270 in 2845519
this line:
terraform-provider-docker/internal/provider/resource_docker_registry_image_funcs.go
Line 299 in 2845519
there are three related problems. These problems prevent correct execution of
docker build
via the "build block" insideresource "docker_registry_image"
.Problem 1 (subfolder blanking)
The Replace call's last parameter is
-1
. Perhaps this is assuming that thebuildContext
will only appear once in the string, as the top-level folder? But if you have subfolders of that top-level context folder, with the same name as that top-level folder's, as the Go doc says "there is no limit on the number of replacements."I think that last parameter to
Replace
should be1
instead of-1
, to only replace the first occurence ofbuildContext
. Otherwise, a subfolder with the same name as thecontext
folder gets represented in the tar file as an empty string. For example, mycontext
folder is named "app". You can see what happens to a subfolder under "app" also named "app":Problem 2 (filename corruption)
You can also see in that image above what happens to a file named
appConfigExtension.zip
. The "app" part of its name is removed! This of course breaks the Dockerfile, which is expecting to see the file namedappConfigExtension.zip
.Problem 3 (blank object in tar file)
The
.Walk
callback gets passed thecontext
folder as the first callbackfile
. TheReplace
call has the effect of renamingheader.Name
to the empty string, which gets placed in the tar file.Placing this code after the
Replace
would prevent this problemThe text was updated successfully, but these errors were encountered: