You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-10Lines changed: 32 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,6 @@ You can set environment variables to use the following supported options:
56
56
`SAVE_CACHE_FLAG` | Value `--save-cache`. Aggressively save intermediate results to the disk cache. This may speed up subsequent queries if they are similar. Be aware that using this option will greatly increase disk usage and initial evaluation time.
57
57
`ACTION` | Value `create-database-only`. Creating CodeQL database only without executing CodeQL analysis.
58
58
`COMMAND` | Value `<command>`. The variable used when you create a CodeQL database for one or more compiled languages, omit if the only languages requested are Python and JavaScript. This specifies the build commands needed to invoke the compiler. If you don't set this variable, CodeQL will attempt to detect the build system automatically, using a built-in autobuilder.
59
-
`JAVA_VERSION` | Value `<java_version>`. Set the Java version. The default Java version is Java 11. It must be `8` or `11`.
60
59
-----
61
60
62
61
***Disclaimer:** CodeQL Agent directly forwards these options to the command arguments while running the container. Please take it as your security responsibility.*
@@ -128,16 +127,39 @@ docker run --rm --name codeql-agent-docker \
128
127
<details>
129
128
<summary> Specify the Java version and the build database command</summary>
130
129
131
-
```bash
132
-
docker run --rm --name codeql-agent-docker \
133
-
-v "$PWD:/opt/src"\
134
-
-v "$PWD/codeql-agent-results:/opt/results"\
135
-
-e "LANGUAGE=java"\
136
-
-e "JAVA_VERSION=8"\
137
-
-e "COMMAND=mvn clean install"\
138
-
doublevkay/codeql-agent
130
+
By default, we use JDK 11 and Maven 3.6.3 forthe CodeQL agent image. We can change the versions of Java and Maven by mounting a volume and setting the JAVA_HOME and MAVEN_HOME environment variablesin the CodeQL agent container. For example:
139
131
140
-
```
132
+
1. Create a Dockerfile (named Dockerfile-java) forthe specific versions of Java and Maven, and place itin the directory that will be used for mounting later:
133
+
```Dockerfile
134
+
FROM --platform=amd64 maven:3-jdk-8-slim
135
+
136
+
RUN mkdir -p /opt/jdk/ /opt/maven/
137
+
138
+
RUN cp -r $JAVA_HOME/* /opt/jdk/
139
+
140
+
RUN cp -r $MAVEN_HOME/* /opt/maven/
141
+
142
+
CMD ["echo"]
143
+
```
144
+
2. Build and run the Docker container, mounting the JDK and Maven directories to the respective volumes:
if [[ "${SupportedLanguage[*]}"=~"${lang}" ]];then
69
+
LANGUAGE=$lang
70
+
break
53
71
fi
72
+
done
73
+
if [[ $LANGUAGE=="" ]];then
74
+
print_red "[!] Can not auto detect language. Please check the source code or specify the LANGUAGE variable."
75
+
finalize
76
+
exit 4
77
+
fi
54
78
fi
55
79
56
80
# Set options
57
81
LANGUAGE=${LANGUAGE,,}
58
-
if [[ "$LANGUAGE"=="python"||"$LANGUAGE"=="javascript"||"$LANGUAGE"=="cpp"||"$LANGUAGE"=="csharp"||"$LANGUAGE"=="java"||"$LANGUAGE"=="go"||"$LANGUAGE"=="typescript"||"$LANGUAGE"=="c" ]]
59
-
then
60
-
if [[ "$LANGUAGE"=="typescript" ]]
61
-
then
82
+
if [[ "$LANGUAGE"=="python"||"$LANGUAGE"=="javascript"||"$LANGUAGE"=="cpp"||"$LANGUAGE"=="csharp"||"$LANGUAGE"=="java"||"$LANGUAGE"=="go"||"$LANGUAGE"=="typescript"||"$LANGUAGE"=="c" ]];then
0 commit comments