2
2
set -e
3
3
4
4
CODEQL_HOME=/usr/local/codeql-home
5
-
5
+ CODEQL_TAG= " "
6
6
echo " Activating feature 'CodeQL'"
7
7
echo " The provided CodeQL version is: $CODEQL_VERSION "
8
8
echo " The CodeQL home directory is: $CODEQL_HOME "
@@ -19,59 +19,52 @@ echo "The effective dev container remoteUser's home directory is '$_REMOTE_USER_
19
19
echo " The effective dev container containerUser is '$_CONTAINER_USER '"
20
20
echo " The effective dev container containerUser's home directory is '$_CONTAINER_USER_HOME '"
21
21
22
+
22
23
check_version () {
23
- if [ -z " $1 " ]; then
24
- echo " Version is not provided"
25
- exit 1
26
- fi
24
+ echo " Checking version"
27
25
28
- if ! [[ " $1 " =~ ^[0-9]+\. [0-9]+\. [0-9]+$ ]]; then
29
- echo " Version is not valid. Please provide a valid version"
30
- exit 1
26
+ # Set the codeql version to the latest if it is not provided
27
+ if [ " $CODEQL_VERSION " = " latest" ]; then
28
+ CODEQL_TAG=$( curl -s https://api.github.com/repos/github/codeql-action/releases/latest | jq -r ' .tag_name' )
29
+ echo " Setting the CodeQL version to the latest: $CODEQL_TAG "
30
+ else
31
+ CODEQL_TAG=" codeql-bundle-v$CODEQL_VERSION "
32
+ echo " Using provided version: $CODEQL_TAG "
31
33
fi
32
34
}
33
35
34
- install_packages (){
36
+ install_packages () {
37
+ echo " Installing required packages"
38
+
35
39
apt-get update && \
36
40
apt-get upgrade -y && \
37
41
apt-get install -y --no-install-recommends \
38
- software-properties-common \
39
42
curl \
40
- git \
41
- git-lfs \
42
- build-essential \
43
- unzip \
44
- apt-transport-https \
45
- python3.10 \
46
- python3-venv \
47
- python3-pip \
48
- python3-setuptools \
49
- python3-dev \
50
- python-is-python3 \
51
- gnupg \
52
- g++ \
53
- make \
54
- gcc \
55
- apt-utils
56
-
57
- # Clean up
58
- apt-get clean && apt-get autoremove
43
+ jq \
44
+ ca-certificates
45
+
46
+ update-ca-certificates
47
+
48
+ echo " Installed packages:"
49
+ curl --version
50
+ jq --version
59
51
}
60
52
61
- install_codeql (){
53
+ install_codeql () {
54
+ echo " Installing CodeQL"
62
55
mkdir ${CODEQL_HOME}
63
56
64
57
# Install CodeQL
65
58
cd /tmp
66
59
67
- echo " Downloading CodeQL bundle v${CODEQL_VERSION } "
68
- curl -OL https://github.com/github/codeql-action/releases/download/codeql-bundle-v ${CODEQL_VERSION } /codeql-bundle-linux64.tar.gz
60
+ echo " Downloading CodeQL bundle v${CODEQL_TAG } "
61
+ curl -OL https://github.com/github/codeql-action/releases/download/${CODEQL_TAG } /codeql-bundle-linux64.tar.gz
69
62
tar -xvf /tmp/codeql-bundle-linux64.tar.gz --directory ${CODEQL_HOME}
70
63
rm /tmp/codeql-bundle-linux64.tar.gz
71
64
}
72
65
73
- check_version
66
+ install_packages
74
67
75
- # install_packages
68
+ check_version
76
69
77
70
install_codeql
0 commit comments