-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-entrypoint.sh
64 lines (50 loc) · 2.01 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
set -eu
# Create a directory to store the IDEs in.
mkdir -p /ides
# Set the correct JAVA_HOME path in case this is overwritten by a setup-java
# action.
JAVA_HOME="/opt/java/openjdk"
# Create an empty file to write the versions to. This is a small hack since
# appending to a string is not possible in sh pipes.
directories="/tmp/directories.txt"
echo "" > $directories
# Parse the versions array into a list of download links.
java -cp "/parser.jar" parser.Main | while read -r line; do
# Find the name of the zip file.
dir=$(echo "$line" | egrep -o "(ideaIU-.*)")
dir=$(echo "${dir%.zip}")
zipfile=$(echo "$dir.zip")
# Write the name of the directory to the file
sed -i "$ s+$+/ides/$dir +g" $directories
# Download the required IntelliJ version.
echo "Downloading $zipfile..."
curl -L --output "$zipfile" "$line"
# Extract the zip.
echo "Unzipping $dir..."
unzip -qq -d "/ides/$dir" "$zipfile"
done
# Reopen the created file to get the list of directories as a space-separated
# string.
ides=$(cat $directories)
# Write the plugin zips to a file.
for f in $(echo "$INPUT_PLUGIN"); do echo "$f" >> plugins.txt; done
# Download the Jetbrains' IntelliJ Plugin Verifier
curl -L --output /verifier.jar "https://packages.jetbrains.team/maven/p/intellij-plugin-verifier/intellij-plugin-verifier/org/jetbrains/intellij/plugins/verifier-cli/$INPUT_VERIFIER_VERSION/verifier-cli-$INPUT_VERIFIER_VERSION-all.jar"
# Execute the verifier.
echo "Running verifications..."
verification_log="/tmp/verification.log"
java -jar /verifier.jar check-plugin "@plugins.txt" $ides 2>&1 > "$verification_log"
# Output the log.
cat "$verification_log"
## Validate the log
if egrep -q "^Plugin (.*) against .*: .* compatibility problems?$" "$verification_log"; then
# An error has occurred.
exit 1
elif egrep -q "^The following files specified for the verification are not valid plugins:$" "$verification_log"; then
# An error has occurred.
exit 1
else
# Everything's fine.
exit 0
fi