azure.databricks.cicd.tools icon indicating copy to clipboard operation
azure.databricks.cicd.tools copied to clipboard

Add-DatabricksDBFSFile does not support uploading hidden files in Powershell Core

Open alexpilon666 opened this issue 3 years ago • 0 comments

Hello,

By default in Windows Powershell (Powershell v5.x), the Get-ChildItem command returns all files, including hidden ones. When moving to Powershell Core (Powershell v7.x), the Get-ChildItem only returns standard files, and not hidden files anymore. To also show hidden files you need to add the -Force switch (there's a -Hidden switch, but this will only show hidden files, which is not the way to go).

This causes an issue where uploading hidden files cannot be done using the Add-DatabricksDBFSFile command, and in our case, breaks our workflow as we regularly upload .env files containing secrets and other environment variables, and we've just switched over from Windows Powershell to Powershell Core.

I've created this PR to add the -Force switch in the Add-DatabricksDBFSFile.ps1 to fix this. It has been tried locally and works like a charm. Adding the -Force switch in Windows Powershell will not break anything, as it does the exact same thing as in Powershell Core as it does in Windows Powershell.

Thanks, and let me know if there are any concerns with this fix!

alexpilon666 avatar Jun 21 '22 15:06 alexpilon666