-
Notifications
You must be signed in to change notification settings - Fork 881
coder templates create
using the template docker-image-builds
and derivatives fails to build
#2815
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
Comments
coder templates create
using the template docker-image-builds
fails to buildcoder templates create
using the template docker-image-builds
and derivatives fails to build
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. |
@wale @phorcys420 Are you on Windows clients? I was only able to reproduce this when trying the I also confirmed moving the |
Yeah.
Maybe, but doing |
@phorcys420 You're able to make it through |
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. |
|
This comment was marked as outdated.
This comment was marked as outdated.
any news ? |
I also faced this when trying to |
apparently it doesn't even see other files at all, I tried to |
Is it a coder issue or the docker provide issue? |
I was able to reproduce this using Logs: PS C:\repro\coder_0.9.8_windows_amd64\docker-build-images> ..\coder.exe templates create
> Create and upload "C:\\repro\\coder_0.9.8_windows_amd64\\docker-build-images"? (yes/no) yes
✔ Queued [261ms]
✔ Setting up [66ms]
✔ Adding README.md... [65ms]
✔ Parsing template parameters [144ms]
⧗ Detecting persistent resources
Terraform 1.1.9
Error: Invalid value for variable
Invalid Docker image. The file does not exist in the images directory.
This was checked by the validation rule at main.tf:62,3-13.
✔ Detecting persistent resources [2130ms]
✘ Cleaning Up [111ms]
template import provision for start: recv import provision: plan terraform: terraform plan: exit status 1
Run 'coder templates create --help' for usage. I'm going to dig in and see if I can find the root cause. |
I'm currently getting a Windows workspace fully setup then my plan is to see if this is on the Coder side or Terraform side by:
If so, then it reproduces what @phorcys420 shared and would lead me to believe this is on the provider side. Stay tuned for more info. |
I was able to do the above + Therefore, I believe this issue is in the docker provider we're using. @bpmct did share this issue he found which may be related: kreuzwerker/terraform-provider-docker#325 Workarounds: @bpmct how would you like to proceed from here? |
please be aware that even if you did that you couldn't add files to the CT at all |
yes, I face this issue while using |
Thank you both for the additional context. I chatted a bit offline with @bpmct. He was surprised removing the validation steps allows to template to be uploaded.
Maybe it's an issue with Terraform on Windows? We'd have to dig in.
Additional notes shared by Ben. I'm going to ping a couple other team members and see if they have insight. Thanks all for your patience! |
Thank you! I wonder if that's a separate issue. |
I'm digging into this more to make sure we can identify what the actual problem is. My first thought is, "Can I create workspace using the Steps to reproduce
Expected Actual ✔ Starting workspace [1258ms]
✘ Cleaning Up [119ms]
send job update: insert job logs: pq: invalid byte sequence for encoding "UTF8": 0x00
Run 'coder create --help' for usage. Workspace Logs from UI: If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Terraform 1.3.0
data.coder_workspace.me: Refreshing...
data.coder_provisioner.me: Refreshing...
data.coder_provisioner.me: Refresh complete after 0s [id=eface01e-4cae-47b5-8b70-71db4f0c2f9b]
data.coder_workspace.me: Refresh complete after 0s [id=27cf56ec-2fc7-4b32-bba2-dd8fef127d74]
coder_agent.main: Plan to create
coder_app.code-server: Plan to create
docker_volume.home_volume: Plan to create
docker_image.main: Plan to create
docker_container.workspace[0]: Plan to create
Plan: 5 to add, 0 to change, 0 to destroy.
coder_agent.main: Creating...
coder_agent.main: Creation complete after 0s [id=dd7195be-2ed7-4b87-81a8-51d52cf4fd12]
docker_volume.home_volume: Creating...
coder_app.code-server: Creating...
docker_image.main: Creating...
coder_app.code-server: Creation complete after 0s [id=3fa2a7de-3f02-44c8-a922-aa3c39b476fc]
docker_volume.home_volume: Creation complete after 0s [id=coder-jp-test-docker-home]
docker_image.main: Creation errored after 0s "What is resource "docker_image" "main" {
name = "coder-${data.coder_workspace.me.id}"
build {
path = "./build"
}
triggers = {
dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)]))
}
} As you can see, this is relying on a subdirectory |
"Now let's try the Steps to reproduce
Expected Actual So here, not using subdirectories, everything works as expected ✅ |
Thus far, we have two factors that may be related to this:
Let's see if we can eliminate the first one. "Can I create workspace using the docker template on a macOS client?" WIP |
On Windows, files in tar archives were stored with Windows path-separators resulting in them being individual files as opposed to contained in a folder. This commit ensures Unix-based paths (slash) are being used inside tar archives. Exmple of previous output: ``` /tmp/provisionerd673501182/images: /tmp/provisionerd673501182/: README.md images images\base.Dockerfile images\java.Dockerfile images\node.Dockerfile main.tf ``` Fixes #2815
What about |
@matifali that should also be fixed by this since the files will now be in the correct folder. |
but I faced that on Linux client. so a path fix. I will test again after you merge. |
@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? |
I originally thought this was a Windows-only issue but I may have missed something! |
@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 Iff this template is uploaded by Windows, then it would succeed (assuming 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. |
Nice find @mafredri 🙌🏼 Once it's merged and a new release is cut, I'll re-test and verify the fix. |
On Windows, files in tar archives were stored with Windows path-separators resulting in them being individual files as opposed to contained in a folder. This commit ensures Unix-based paths (slash) are being used inside tar archives. Exmple of previous output: ``` /tmp/provisionerd673501182/images: /tmp/provisionerd673501182/: README.md images images\base.Dockerfile images\java.Dockerfile images\node.Dockerfile main.tf ``` Fixes #2815
I can confirm this is a Windows-only issue, just tried this on a Linux host and it worked just fine. |
This is out now: https://github.com/coder/coder/releases/tag/v0.10.0 |
Work for me on Windows with v0.10.1 ! |
Woohoo! Thanks for confirming! |
Problem
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:Logs:


Directory tree:
This is also reproducible with the default
docker-image-builds
template without any changes.Coder version (on both host and client): Coder v0.7.6+a494489
The text was updated successfully, but these errors were encountered: