Skip to content

Commit 8f4106c

Browse files
committed
hackajob: Support for Java21
1 parent 8a5ef8c commit 8f4106c

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed

che-theia-plugins.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,27 @@ plugins:
376376
https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix
377377
- >-
378378
https://open-vsx.org/api/vscjava/vscode-java-test/0.24.0/file/vscjava.vscode-java-test-0.24.0.vsix
379+
- id: redhat/java21
380+
repository:
381+
url: 'https://github.com/redhat-developer/vscode-java'
382+
revision: v1.0.0
383+
featured: true
384+
sidecar:
385+
image: 'docker.io/hackajobchallenges/che-sidecar-java:21'
386+
name: vscode-java
387+
memoryLimit: 1500Mi
388+
cpuLimit: 500m
389+
cpuRequest: 30m
390+
volumeMounts:
391+
- name: m2
392+
path: /home/theia/.m2
393+
extensions:
394+
- >-
395+
https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.63.0-2222.vsix
396+
- >-
397+
https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix
398+
- >-
399+
https://open-vsx.org/api/vscjava/vscode-java-test/0.24.0/file/vscjava.vscode-java-test-0.24.0.vsix
379400
- id: redhat/java8
380401
repository:
381402
url: 'https://github.com/redhat-developer/vscode-java'

sidecars/java21/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2018 Red Hat, Inc.
2+
# This program and the accompanying materials are made
3+
# available under the terms of the Eclipse Public License 2.0
4+
# which is available at https://www.eclipse.org/legal/epl-2.0/
5+
#
6+
# SPDX-License-Identifier: EPL-2.0
7+
#
8+
# Contributors:
9+
# Red Hat, Inc. - initial API and implementation
10+
11+
FROM eclipse-temurin:21-alpine
12+
13+
ENV HOME=/home/theia
14+
15+
RUN mkdir /projects ${HOME} && \
16+
# Change permissions to let any arbitrary user
17+
for f in "${HOME}" "/etc/passwd" "/projects"; do \
18+
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
19+
chmod -R g+rwX ${f}; \
20+
done
21+
22+
RUN apk --update --no-cache add procps nss
23+
ADD etc/before-start.sh /before-start.sh
24+
25+
ADD etc/entrypoint.sh /entrypoint.sh
26+
27+
WORKDIR /projects
28+
29+
ENTRYPOINT ["/entrypoint.sh"]
30+
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}

sidecars/java21/PLATFORMS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
linux/amd64,linux/ppc64le,linux/s390x,linux/arm64

sidecars/java21/etc/before-start.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2020 Red Hat, Inc.
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# Red Hat, Inc. - initial API and implementation
12+
#
13+
14+
m2="$HOME/.m2"
15+
settingsXML="$m2/settings.xml"
16+
17+
set_maven_mirror() {
18+
[ ! -d "$m2" ] && mkdir -p "$m2"
19+
20+
if [ ! -f "$settingsXML" ]; then
21+
{
22+
echo "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\""
23+
echo " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
24+
echo " xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0"
25+
echo " https://maven.apache.org/xsd/settings-1.0.0.xsd\">"
26+
echo " <mirrors>"
27+
echo " <mirror>"
28+
echo " <url>\${env.MAVEN_MIRROR_URL}</url>"
29+
echo " <mirrorOf>external:*</mirrorOf>"
30+
echo " </mirror>"
31+
echo " </mirrors>"
32+
echo "</settings>"
33+
} >> "$settingsXML"
34+
else
35+
if ! grep -q "<url>\${env.MAVEN_MIRROR_URL}</url>" "$settingsXML"; then
36+
if grep -q "<mirrors>" "$settingsXML"; then
37+
# shellcheck disable=SC2154
38+
sed -i "s/<mirrors>/<mirrors>\n <mirror>\n <url>${env.MAVEN_MIRROR_URL}<\/url>\n <mirrorOf>external:\*<\/mirrorOf>\n <\/mirror>/" "$settingsXML"
39+
else
40+
# shellcheck disable=SC2154
41+
sed -i "s/<\/settings>/ <mirrors>\n <mirror>\n <url>${env.MAVEN_MIRROR_URL}<\/url>\n <mirrorOf>external:*<\/mirrorOf>\n <\/mirror>\n <\/mirrors>\n<\/settings>/" "$settingsXML"
42+
fi
43+
fi
44+
fi
45+
}
46+
47+
[ -n "$MAVEN_MIRROR_URL" ] && set_maven_mirror
48+
return 0

sidecars/java21/etc/entrypoint.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2018-2020 Red Hat, Inc.
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# Red Hat, Inc. - initial API and implementation
12+
#
13+
14+
set -e
15+
16+
USER_ID=$(id -u)
17+
GROUP_ID=$(id -g)
18+
export USER_ID
19+
export GROUP_ID
20+
21+
if ! whoami >/dev/null 2>&1; then
22+
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
23+
fi
24+
25+
# Grant access to projects volume in case of non root user with sudo rights
26+
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
27+
sudo chown "${USER_ID}:${GROUP_ID}" /projects
28+
fi
29+
30+
exec "$@"

0 commit comments

Comments
 (0)