Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Datree
Commits
7a0726ce
Commit
7a0726ce
authored
3 years ago
by
myishay
Browse files
Options
Download
Email Patches
Plain Diff
fix: check execution policy + require Powershell version >=5
parent
934c66bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
windows_install.ps1
+20
-2
windows_install.ps1
with
20 additions
and
2 deletions
+20
-2
windows_install.ps1
+
20
-
2
View file @
7a0726ce
[
Net.ServicePointManager
]::
SecurityProtocol
=
[
Net.SecurityProtocolType
]::
Tls12
#Requires -Version 5
$old_erroractionpreference
=
$erroractionpreference
$erroractionpreference
=
'stop'
# quit if anything goes wrong
if
((
$PSVersionTable
.
PSVersion
.
Major
)
-lt
5
)
{
Write-Output
"PowerShell 5 or later is required to run Datree."
Write-Output
"Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
}
# show notification to change execution policy:
$allowedExecutionPolicy
=
@(
'Unrestricted'
,
'RemoteSigned'
,
'ByPass'
)
if
((
Get-ExecutionPolicy
)
.
ToString
()
-notin
$allowedExecutionPolicy
)
{
Write-Output
"PowerShell requires an execution policy in [
$(
$allowedExecutionPolicy
-join
", "
)
] to run Datree."
Write-Output
"For example, to set the execution policy to 'RemoteSigned' please run :"
Write-Output
"'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
break
}
$DOWNLOAD_URL
=
(
Invoke-WebRequest
-Uri
'https://api.github.com/repos/datreeio/datree/releases/latest'
|
select-string
-Pattern
'https://github.com/datreeio/datree/releases/download/\d+\.\d+\.\d+/datree-cli_\d+\.\d+\.\d+_windows_x86_64.zip'
)
.
Matches
.
Value
$OUTPUT_BASENAME
=
"datree-latest"
...
...
@@ -21,7 +39,7 @@ Remove-Item $OUTPUT_BASENAME_WITH_POSTFIX
$dotDatreePath
=
"
$home
/.datree"
mkdir
-Force
$dotDatreePath
|
Out-Null
$k8sDemoPath
=
Join-Path
"
$dotDatreePath
"
"k8s-demo.yaml"
$k8sDemoPath
=
Join-Path
"
$dotDatreePath
"
"k8s-demo.yaml"
Invoke-WebRequest
-Uri
"https://get.datree.io/k8s-demo.yaml"
-OutFile
$k8sDemoPath
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment