Tidy up CodeQL bundle Linux installer script in response to review comments.

This commit is contained in:
Chris Gavin
2020-09-08 15:23:49 +01:00
parent 79c4eb4910
commit 096464f38e

View File

@@ -4,6 +4,8 @@
## Desc: Install the CodeQL CLI Bundle to the toolcache. ## Desc: Install the CodeQL CLI Bundle to the toolcache.
################################################################################ ################################################################################
source $HELPER_SCRIPTS/install.sh
# Retrieve the name of the CodeQL bundle preferred by the Action (in the format codeql-bundle-YYYYMMDD). # 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)" codeql_bundle_name="$(curl -sSL https://raw.githubusercontent.com/github/codeql-action/main/src/defaults.json | jq -r .bundleVersion)"
# Convert the bundle name to a version number (0.0.0-YYYYMMDD). # Convert the bundle name to a version number (0.0.0-YYYYMMDD).
@@ -12,8 +14,9 @@ codeql_bundle_version="0.0.0-${codeql_bundle_name##*-}"
extraction_directory="$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64" extraction_directory="$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64"
mkdir -p "$extraction_directory" mkdir -p "$extraction_directory"
>&2 echo "Downloading CodeQL bundle $codeql_bundle_version..." echo "Downloading CodeQL bundle $codeql_bundle_version..."
curl -sSL "https://github.com/github/codeql-action/releases/download/$codeql_bundle_name/codeql-bundle.tar.gz" | tar -xzC "$extraction_directory" download_with_retries "https://github.com/github/codeql-action/releases/download/$codeql_bundle_name/codeql-bundle.tar.gz" "/tmp" "codeql-bundle.tar.gz"
tar -xzf "/tmp/codeql-bundle.tar.gz" -C "$extraction_directory"
# Test that the tool has been extracted successfully. # Test that the tool has been extracted successfully.
"$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64/codeql/codeql" version "$AGENT_TOOLSDIRECTORY/CodeQL/$codeql_bundle_version/x64/codeql/codeql" version