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

coder templates pull does not work as expected on Windows #9291

Closed
bpmct opened this issue Aug 23, 2023 · 6 comments · Fixed by #9327
Closed

coder templates pull does not work as expected on Windows #9291

bpmct opened this issue Aug 23, 2023 · 6 comments · Fixed by #9327
Assignees
Labels
bug Used to filter all bug issues s1 Bugs that break core workflows. Only humans may set this.

Comments

@bpmct
Copy link
Member

bpmct commented Aug 23, 2023

Screen.Recording.2023-08-23.at.5.17.19.PM.mov

It creates a folder, but no files

@bpmct bpmct added the s1 Bugs that break core workflows. Only humans may set this. label Aug 23, 2023
@cdr-bot cdr-bot bot added the bug Used to filter all bug issues label Aug 23, 2023
@matifali
Copy link
Collaborator

matifali commented Aug 25, 2023

First Issue

I can pull a template just fine when I specify a path as instructed by coder templates pull --help

PS C:\Users\matif\tmp> coder templates pull deeplearning
Extracting template to "deeplearning/"
PS C:\Users\matif\tmp> coder templates pull deeplearning PATH
Extracting template to "PATH"
PS C:\Users\matif\tmp> ls .\deeplearning\
PS C:\Users\matif\tmp> ls .\PATH\

    Directory: C:\Users\matif\tmp\PATH

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          25/08/2023 10:17 am          10852 deeplearning-connect.png
-a---          25/08/2023 10:17 am          11401 main.tf
-a---          25/08/2023 10:17 am           2181 README.md

When we do not provide a path, the folder is empty
When we provide a path, the folder contains all the files

2nd Issue

When using the --tar and writing output to a file, the archive only contains the README.md and missing other files.

coder templates pull --tar deeplearning > zipped.tar.gz

other alternatives I have tried, but with the same effect.

coder templates pull --tar deeplearning | Out-File -Path zipped.tar.gz

image


PS: Both of these pull methods work as expected on Linux(Ubuntu) and macOS(confirmed by @mtojek)

@matifali matifali changed the title coder templates pull does not work on Windows coder templates pull does not work as expected on Windows Aug 25, 2023
@mtojek
Copy link
Member

mtojek commented Aug 25, 2023

Regarding 2nd issue -

I'm not a Windows developer, but it was always a problem to redirect binary output. See this article. Maybe you should try it @matifali .

@matifali
Copy link
Collaborator

matifali commented Aug 25, 2023

I investigated it a bit more and found out that by default, PowerShell converts the output to string and to keep the data as binary, we need to enable an experimental flag PSNativeCommandPreserveBytePipe as discussed in PowerShell/PowerShell#1908 (comment). This is only available in PowerShell version 7.4.x, while the current version on Windows 11 is 7.3.

@spikecurtis spikecurtis self-assigned this Aug 25, 2023
@matifali
Copy link
Collaborator

matifali commented Aug 25, 2023

Using PowerShell 7.4.0-preview.5 resolves issue 2 in #9291 (comment).

@spikecurtis
Copy link
Contributor

I think the 2nd issue that @matifali identified is out of scope of this GitHub issue. There isn't much we can do about Powershell breaking binary redirection.

However, we could add an option to take a --tarfile and write the tar directly to disk if Windows devs wanted it.

@matifali
Copy link
Collaborator

@spikecurtis For the second issue, I guess we should wait for PowerShell 7.4 to be widely available as it is not an issue with Coder. This issue can be closed if we solve 1st.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to filter all bug issues s1 Bugs that break core workflows. Only humans may set this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants