You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
coder templates create using the template docker-image-builds and derivatives fails to build #2815
The images folder is seemingly not pushed to the host when running coder templates create on Windows clients. The second validation rule in the below template snippet seemingly always fails regardless of the availability of the relevant images folder:
variable"docker_image" {
description="What Docker image would you like to use for your workspace?"default="alpine"# List of images available for the user to choose from.# Delete this condition to give users free text input.validation {
condition=contains([
"alpine",
"ubuntu"
], var.docker_image)
error_message="Invalid Docker image!"
}
# Prevents admin errors when the image is not foundvalidation {
condition=fileexists("images/${var.docker_image}.Dockerfile")
error_message="Invalid Docker image. The file does not exist in the images directory."
}
}
Logs:
Directory tree:
This is also reproducible with the default docker-image-builds template without any changes.
changed the title [-]`coder templates create` using the template `docker-image-builds` fails to build[/-][+]`coder templates create` using the template `docker-image-builds` and derivatives fails to build[/+]on Jul 4, 2022
Apparently this is a bug that doesn't import Dockerfiles in a given directory, but importing them from the template root works fine?
Can confirm, the same error is occuring in a template of mine.
Maybe this issue should be re-named to something more generic ? Also, the weird part is that it doesn't seem to come from the docker provider itself, since even fileexists fails.
@wale@phorcys420 Are you on Windows clients? I was only able to reproduce this when trying the docker-image-builds using coder on Windows. This appears to be a Coder bug as it's not recursively uploading the folder and subfolders to Coder.t
I also confirmed moving the images/ to root on WIndows fixed it.
@phorcys420 You're able to make it through coder templates create and pull the template? Mine is failing at the create step because of the validation rule.
@phorcys420 You're able to make it through coder templates create and pull the template? Mine is failing at the create step because of the validation rule.
No, I had to remove that one, and it still didn't work afterwards. I'm just pointing out that it does upload them because I can pull the subfolders afterwards.
@matifali if the archive was created on Windows, then it would affect a Linux client as well. But if the flow was Linux -> Linux then this change would have no effect. If that's still a problem for you we should perhaps move it to a new separate issue?
@bpmct I would agree with that assessment. However, it can affect other OS-es via Windows systems.
So let's say you have the following structure:
data/bootstrap.sh
Dockerfile
main.tf
Relevant directive in Dockerfile would be ADD data/bootstrap.sh.
Iff this template is uploaded by Windows, then it would succeed (assuming main.tf doesn't do any special checks) but the tar file will not contain data/bootstrap.sh, instead it will be named data\\bootstrap.sh (single file, no folder).
Now when a Linux client tries to create the workspace and triggers the Docker build, it can't find the file.
^ This is the only way I see this issue affecting other operating systems.
I can confirm this is a Windows-only issue, just tried this on a Linux host and it worked just fine.
I will confirm whether it works or not on windows with the next release.
Activity
[-]`coder templates create` using the template `docker-image-builds` fails to build[/-][+]`coder templates create` using the template `docker-image-builds` and derivatives fails to build[/+]wale commentedon Jul 6, 2022
Apparently this is a bug that doesn't import Dockerfiles in a given directory, but importing them from the template root works fine?
phorcys420 commentedon Jul 20, 2022
Can confirm, the same error is occuring in a template of mine.
Maybe this issue should be re-named to something more generic ? Also, the weird part is that it doesn't seem to come from the docker provider itself, since even
fileexistsfails.bpmct commentedon Jul 25, 2022
@wale @phorcys420 Are you on Windows clients? I was only able to reproduce this when trying the
docker-image-buildsusingcoderon Windows. This appears to be a Coder bug as it's not recursively uploading the folder and subfolders to Coder.tI also confirmed moving the
images/to root on WIndows fixed it.phorcys420 commentedon Jul 25, 2022
Yeah.
Maybe, but doing
coder templates pullstill contains my subfolders.bpmct commentedon Jul 25, 2022
@phorcys420 You're able to make it through
coder templates createand pull the template? Mine is failing at the create step because of the validation rule.phorcys420 commentedon Jul 25, 2022
No, I had to remove that one, and it still didn't work afterwards. I'm just pointing out that it does upload them because I can pull the subfolders afterwards.
phorcys420 commentedon Aug 1, 2022
Stumbled across this today while pulling my template (v0.8.2+00c5116), maybe this has something to do with this issue?
misskniss commentedon Aug 9, 2022
phorcys420 commentedon Oct 2, 2022
any news ?
matifali commentedon Oct 8, 2022
I also faced this when trying to
ADDfiles in myDockerfile. Somehow docker provider doesn't see other files in theimagessubdirectory15 remaining items
matifali commentedon Oct 14, 2022
What about
Dockerfileunable to use anyADDcommands because it can not see the external files?mafredri commentedon Oct 14, 2022
@matifali that should also be fixed by this since the files will now be in the correct folder.
matifali commentedon Oct 14, 2022
but I faced that on Linux client. so a path fix. I will test again after you merge.
mafredri commentedon Oct 14, 2022
@matifali if the archive was created on Windows, then it would affect a Linux client as well. But if the flow was Linux -> Linux then this change would have no effect. If that's still a problem for you we should perhaps move it to a new separate issue?
bpmct commentedon Oct 14, 2022
I originally thought this was a Windows-only issue but I may have missed something!
mafredri commentedon Oct 14, 2022
@bpmct I would agree with that assessment. However, it can affect other OS-es via Windows systems.
So let's say you have the following structure:
Relevant directive in
Dockerfilewould beADD data/bootstrap.sh.Iff this template is uploaded by Windows, then it would succeed (assuming
main.tfdoesn't do any special checks) but thetarfile will not containdata/bootstrap.sh, instead it will be nameddata\\bootstrap.sh(single file, no folder).Now when a Linux client tries to create the workspace and triggers the Docker build, it can't find the file.
^ This is the only way I see this issue affecting other operating systems.
jsjoeio commentedon Oct 14, 2022
Nice find @mafredri 🙌🏼
Once it's merged and a new release is cut, I'll re-test and verify the fix.
fix: Fix template create with sub-folders on Windows (#4548)
phorcys420 commentedon Oct 17, 2022
I can confirm this is a Windows-only issue, just tried this on a Linux host and it worked just fine.
I will confirm whether it works or not on windows with the next release.
jsjoeio commentedon Oct 17, 2022
This is out now: https://github.com/coder/coder/releases/tag/v0.10.0
phorcys420 commentedon Oct 18, 2022
Work for me on Windows with v0.10.1 !
jsjoeio commentedon Oct 18, 2022
Woohoo! Thanks for confirming!