From 60d40e5dd5ab9498790068244fbe52fe91c072be Mon Sep 17 00:00:00 2001 From: Chris Gavin Date: Thu, 17 Sep 2020 18:41:07 +0100 Subject: [PATCH] Document the CodeQL version that is installed. --- images/linux/scripts/installers/codeql-bundle.sh | 5 +++++ .../scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 1 + .../win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/images/linux/scripts/installers/codeql-bundle.sh b/images/linux/scripts/installers/codeql-bundle.sh index 825ce0708..e07f2a082 100644 --- a/images/linux/scripts/installers/codeql-bundle.sh +++ b/images/linux/scripts/installers/codeql-bundle.sh @@ -5,6 +5,7 @@ ################################################################################ source $HELPER_SCRIPTS/install.sh +source $HELPER_SCRIPTS/document.sh # Retrieve the name of the CodeQL bundle preferred by the Action (in the format codeql-bundle-YYYYMMDD). codeql_bundle_name="$(curl -sSL https://raw.githubusercontent.com/github/codeql-action/main/src/defaults.json | jq -r .bundleVersion)" @@ -23,3 +24,7 @@ touch "$extraction_directory/pinned-version" # Test that the tool has been extracted successfully. "$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64/codeql/codeql" version + +# Document the version installed. +version="$("$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64/codeql/codeql" version --quiet)" +DocumentInstalledItem "CodeQL Action Bundle ($version)" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index eb8b35f0d..905b9da96 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -77,6 +77,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-BazelVersion), (Get-BazeliskVersion), (Get-CMakeVersion), + (Get-CodeQLBundleVersion), (Get-RVersion), (Get-DockerVersion), (Get-DockerComposeVersion), diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index e7235408f..e6d70fecb 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -30,6 +30,14 @@ function Get-CMakeVersion { return "CMake $cmakeVersion" } +function Get-CodeQLBundleVersion { + $CodeQLVersionsWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "codeql" | Join-Path -ChildPath "*" + $CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName + $CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe" + $CodeQLVersion = $($CodeQLPath version --quiet) + return "CodeQL Action Bundle $CodeQLVersion" +} + function Get-DockerVersion { $dockerVersion = $(docker version --format "{{.Server.Version}}") return "Docker $dockerVersion"