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

Added check to skip bundle if installed #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

esbenbach
Copy link

Added a check to the script so it skips if the bundle is already installed.

Basically just checks for path existence of the bundle version and the .complete file.

Added a check to the script so it skips if the bundle is already installed.

Basically just check for path existence of the bundle version and the .complete file.
@esbenbach
Copy link
Author

esbenbach commented Mar 4, 2024 via email

@@ -79,11 +79,21 @@
)

foreach ($Bundle in $Bundles) {
# Determine if the bundle is already installed.
$CodeQLToolcachePath = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath $Bundle.BundleVersion | Join-Path -ChildPath "x64"

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace

if ($BundleDirExists -And $CompletionFileExists)
{
Write-Host "CodeQL bundle $($Bundle.BundleVersion) already exists, skipping installation ..."

Check warning

Code scanning / PSScriptAnalyzer

File 'codeql-install-windows.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information. Warning

File 'codeql-install-windows.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.
Write-Host "CodeQL bundle $($Bundle.BundleVersion) already exists, skipping installation ..."
continue
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
Copy link
Contributor

@felickz felickz left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! This makes sense in the context that this was never intended to be run multiple times, we simply borrowed the packer script from the github/runner-images repo that is used to build AzDO and GH runners.

Copy link
Contributor

@felickz felickz left a comment

Choose a reason for hiding this comment

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

Only slight improvement we might make would be to align the other install scripts to do the same.

@esbenbach
Copy link
Author

Seems like a reasonable alignment, I however have no environments to test Ubuntu nor Mac OS scripts, so I would be developing "blindly" if i were to contribute the adjustments.

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.

2 participants