2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2020-09-08 10:59:26 +01:00
|
|
|
################################################################################
|
|
|
|
|
## File: codeql-bundle.sh
|
|
|
|
|
## Desc: Install the CodeQL CLI Bundle to the toolcache.
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2020-09-08 15:23:49 +01:00
|
|
|
source $HELPER_SCRIPTS/install.sh
|
|
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
# Retrieve the CLI version of the latest CodeQL bundle.
|
2023-07-28 20:18:41 +02:00
|
|
|
base_url="$(curl -fsSL https://raw.githubusercontent.com/github/codeql-action/v2/src/defaults.json)"
|
2023-10-02 09:45:16 +01:00
|
|
|
bundle_version="$(echo "$base_url" | jq -r '.cliVersion')"
|
|
|
|
|
bundle_tag_name="codeql-bundle-v$bundle_version"
|
2020-09-08 10:59:26 +01:00
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
echo "Downloading CodeQL bundle $bundle_version..."
|
|
|
|
|
# Note that this is the all-platforms CodeQL bundle, to support scenarios where customers run
|
|
|
|
|
# different operating systems within containers.
|
|
|
|
|
download_with_retries "https://github.com/github/codeql-action/releases/download/$bundle_tag_name/codeql-bundle.tar.gz" "/tmp" "codeql-bundle.tar.gz"
|
|
|
|
|
codeql_archive="/tmp/codeql-bundle.tar.gz"
|
2020-09-08 10:59:26 +01:00
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
codeql_toolcache_path="$AGENT_TOOLSDIRECTORY/CodeQL/$bundle_version/x64"
|
|
|
|
|
mkdir -p "$codeql_toolcache_path"
|
2020-09-08 10:59:26 +01:00
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
echo "Unpacking the downloaded CodeQL bundle archive..."
|
|
|
|
|
tar -xzf "$codeql_archive" -C "$codeql_toolcache_path"
|
2020-09-17 12:02:44 +01:00
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
# Touch a file to indicate to the CodeQL Action that this bundle shipped with the toolcache. This is
|
|
|
|
|
# to support overriding the CodeQL version specified in defaults.json on GitHub Enterprise.
|
|
|
|
|
touch "$codeql_toolcache_path/pinned-version"
|
2023-01-29 05:46:43 -08:00
|
|
|
|
2023-10-02 09:45:16 +01:00
|
|
|
# Touch a file to indicate to the toolcache that setting up CodeQL is complete.
|
|
|
|
|
touch "$codeql_toolcache_path.complete"
|