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

Updated CLI installation script #69

Merged
merged 7 commits into from
Sep 24, 2024
Merged

Updated CLI installation script #69

merged 7 commits into from
Sep 24, 2024

Conversation

ruokun-niu
Copy link
Contributor

Description

Updated the CLI installation script to download from Github instead of Azure storage blob

also enabled the ability to download a specific version
TODO:

test with windows (will do this after I get back home today so that I can use my windows machine 😄 )
test in dev container

Type of change

  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Drasi (issue link optional).

Fixes: #issue_number

if ((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
Write-Output "PowerShell requires an execution policy of 'RemoteSigned'."
Write-Output "To make this change please run:"
Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"

Check warning

Code scanning / devskim

The Set-ExecutionPolicy cmdlet has been used to dynamically change the permissions available to PowerShell. Warning

Do not set a custom execution policy.
}

# Change security protocol to support TLS 1.2 / 1.1 / 1.0 - old powershell uses TLS 1.0 as a default protocol
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

Check notice

Code scanning / devskim

Generic: Hard-coded SSL/TLS Protocol Note

Generic: Hard-coded SSL/TLS Protocol
}

# Change security protocol to support TLS 1.2 / 1.1 / 1.0 - old powershell uses TLS 1.0 as a default protocol
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

Check notice

Code scanning / devskim

Generic: Hard-coded SSL/TLS Protocol Note

Generic: Hard-coded SSL/TLS Protocol
@@ -0,0 +1,150 @@
param (
[string]$Version,
[string]$DrasiRoot = "$env:LOCALAPPDATA\drasi"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Makefile install puts it in $env:ProgramFiles\drasi

$release = $Releases | Where-Object { $_.tag_name -notlike "*rc*" } | Select-Object -First 1
}
else {
$release = $Releases | Where-Object { $_.tag_name -eq "v$Version" } | Select-Object -First 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this always return the latest release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think the github api lists releases with the most recent release at the top. This will fetch the first (most recent) release

cli/installers/install-drasi-cli.ps1 Outdated Show resolved Hide resolved
}

# Version string
Write-Output "drasi CLI version: $(&$DrasiCliFilePath version -o json | ConvertFrom-JSON | Select-Object -ExpandProperty version)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this works drasi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right. Maybe we can just output the release tag/version that was used in the download

@ruokun-niu ruokun-niu marked this pull request as ready for review September 24, 2024 03:59
@ruokun-niu ruokun-niu merged commit d255445 into main Sep 24, 2024
32 checks passed
@danielgerlag danielgerlag deleted the cli-install-gh branch September 26, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants