Skip to content

Commit c441912

Browse files
committed
Add midstream for JetBrains IDE component
Signed-off-by: Artem Zatsarynnyi <[email protected]>
1 parent b038f1f commit c441912

File tree

6 files changed

+248
-0
lines changed

6 files changed

+248
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (c) 2024 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+
# The Dockerfile works only in Brew, as it is customized for Cachito fetching
12+
# project sources and npm dependencies, and performing an offline build with them
13+
14+
# https://registry.access.redhat.com/ubi8/nodejs-20
15+
FROM registry.access.redhat.com/ubi8/nodejs-20:1-50.1720405266
16+
USER 0
17+
18+
WORKDIR $REMOTE_SOURCES_DIR/devspaces-images-jb-ide/app/devspaces-jb-ide/
19+
20+
# cachito:yarn step 1: copy cachito sources where we can use them; source env vars; set working dir
21+
COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR
22+
23+
# hadolint ignore=SC2086
24+
RUN source $REMOTE_SOURCES_DIR/devspaces-images-jb-ide/cachito.env
25+
26+
RUN cp -r build/dockerfiles/*.sh /
27+
RUN cp -r status-app /status-app/
28+
29+
# Create a folders structure for mounting a shared volume and copy the editor binaries to.
30+
RUN mkdir -p /idea-server/status-app
31+
32+
# Adjust permissions on some items so they're writable by group root.
33+
# hadolint ignore=SC2086
34+
RUN for f in "${HOME}" "/etc/passwd" "/etc/group" "/status-app" "/idea-server"; do\
35+
chgrp -R 0 ${f} && \
36+
chmod -R g+rwX ${f}; \
37+
done
38+
39+
# Build the status app.
40+
WORKDIR /status-app/
41+
RUN npm install
42+
43+
# Switch to unprivileged user.
44+
USER 1001
45+
46+
ENTRYPOINT /entrypoint.sh
47+
48+
ENV SUMMARY="Red Hat OpenShift Dev Spaces with JetBrains IDE container" \
49+
DESCRIPTION="Red Hat OpenShift Dev Spaces with JetBrains IDE container" \
50+
PRODNAME="devspaces" \
51+
COMPNAME="jb-ide-rhel8"
52+
LABEL summary="$SUMMARY" \
53+
description="$DESCRIPTION" \
54+
io.k8s.description="$DESCRIPTION" \
55+
io.k8s.display-name="$DESCRIPTION" \
56+
io.openshift.tags="$PRODNAME,$COMPNAME" \
57+
com.redhat.component="$PRODNAME-$COMPNAME-container" \
58+
name="$PRODNAME/$COMPNAME" \
59+
version="3.17" \
60+
license="EPLv2" \
61+
maintainer="Artem Zatsarynnyi <[email protected]>" \
62+
io.openshift.expose-services="" \
63+
usage=""
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2024 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+
set -e
14+
15+
# defaults
16+
CSV_VERSION=3.y.0 # csv 3.y.0
17+
DS_VERSION=${CSV_VERSION%.*} # tag 3.y
18+
19+
UPSTM_NAME="che-idea-dev-server"
20+
MIDSTM_NAME="jb-remote-dev-server"
21+
22+
usage () {
23+
echo "
24+
Usage: $0 -v [DS CSV_VERSION] [-s /path/to/${UPSTM_NAME}] [-t /path/to/generated]
25+
Example: $0 -v 3.y.0 -s ${HOME}/projects/${UPSTM_NAME} -t /tmp/devspaces-${MIDSTM_NAME}"
26+
exit
27+
}
28+
29+
if [[ $# -lt 6 ]]; then usage; fi
30+
31+
while [[ "$#" -gt 0 ]]; do
32+
case $1 in
33+
'-v') CSV_VERSION="$2"; DS_VERSION="${CSV_VERSION%.*}"; shift 1;;
34+
# paths to use for input and output
35+
'-s') SOURCEDIR="$2"; SOURCEDIR="${SOURCEDIR%/}"; shift 1;;
36+
'-t') TARGETDIR="$2"; TARGETDIR="${TARGETDIR%/}"; shift 1;;
37+
'--help'|'-h') usage;;
38+
esac
39+
shift 1
40+
done
41+
42+
if [[ ! -d "${SOURCEDIR}" ]]; then usage; fi
43+
if [[ ! -d "${TARGETDIR}" ]]; then usage; fi
44+
if [[ "${CSV_VERSION}" == "3.y.0" ]]; then usage; fi
45+
46+
# workaround for CRW-4328 and broken rhpkg release -- add a .spec file (that will be ignored)
47+
# ignore changes in these files
48+
echo ".github/
49+
.git/
50+
.gitattributes
51+
/build/scripts/sync.sh
52+
/build/python/
53+
/bootstrap.Dockerfile
54+
/cvp.yml
55+
/container.yaml
56+
/content_sets.*
57+
/cvp.yml
58+
/cvp-owners.yml
59+
/sources
60+
sources.spec
61+
/get-source*.sh
62+
/tests/basic-test.yaml
63+
" > /tmp/rsync-excludes
64+
echo "Rsync ${SOURCEDIR} to ${TARGETDIR}"
65+
rsync -azrlt --checksum --exclude-from /tmp/rsync-excludes --delete "${SOURCEDIR}"/ "${TARGETDIR}"/
66+
rm -f /tmp/rsync-excludes
67+
68+
# ensure shell scripts are executable
69+
find "${TARGETDIR}"/ -name "*.sh" -exec chmod +x {} \;
70+
71+
sed_in_place() {
72+
SHORT_UNAME=$(uname -s)
73+
if [ "$(uname)" == "Darwin" ]; then
74+
sed -i '' "$@"
75+
elif [ "${SHORT_UNAME:0:5}" == "Linux" ]; then
76+
sed -i "$@"
77+
fi
78+
}
79+
80+
sed_in_place -r \
81+
`# Update DevSpaces version for Dockerfile` \
82+
-e "s/version=.*/version=\"$DS_VERSION\" \\\/" \
83+
"${TARGETDIR}"/build/dockerfiles/brew.Dockerfile

devspaces-jb-ide/container.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
platforms:
3+
# all these keys are optional - see https://osbs.readthedocs.io/en/latest/users.html#image-configuration for more info
4+
5+
only:
6+
- x86_64
7+
# - s390x
8+
# - ppc64le
9+
10+
compose:
11+
inherit: false
12+
pulp_repos: true
13+
signing_intent: release
14+
15+
# instead of docker_api, use imagebuilder for multistage builds
16+
image_build_method: imagebuilder
17+
18+
remote_sources:
19+
- name: devspaces-images-jb-ide
20+
remote_source:
21+
repo: https://github.com/redhat-developer/devspaces-images.git
22+
ref: b8d76a3091d9fbf553184bd0a3d8b797a76e38dd
23+
pkg_managers: [npm]
24+
packages:
25+
npm:
26+
- path: devspaces-jb-ide/status-app/

devspaces-jb-ide/get-sources.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash -xe
2+
# script to trigger rhpkg (no assets to fetch)
3+
#
4+
5+
scratchFlag=""
6+
targetFlag=""
7+
doRhpkgContainerBuild=1
8+
forceBuild=0
9+
10+
while [[ "$#" -gt 0 ]]; do
11+
case $1 in
12+
'-d'|'--delete-assets') exit 0; shift 0;;
13+
'-a'|'--publish-assets') exit 0; shift 0;;
14+
'-p'|'--pull-assets') exit 0; shift 0;;
15+
'-n'|'--nobuild') doRhpkgContainerBuild=0; shift 0;;
16+
'-f'|'--force-build') forceBuild=1; shift 0;;
17+
'-s'|'--scratch') scratchFlag="--scratch"; shift 0;;
18+
'--target') targetFlag="--target $2"; shift 1;;
19+
'-v') CSV_VERSION="$2"; shift 1;;
20+
'-ght') exit 0; shift 1;;
21+
esac
22+
shift 1
23+
done
24+
25+
# if building a scratch from a private branch, use --target devspaces-*-rhel-8-containers-candidate
26+
MIDSTM_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
27+
if [[ ${MIDSTM_BRANCH} = "private-"* ]] || [[ ${MIDSTM_BRANCH} != "devspaces-"*"-rhel-"* ]]; then
28+
if [[ ! $targetFlag ]]; then targetFlag="--target devspaces-3-rhel-8-containers-candidate"; fi
29+
if [[ ! $scratchFlag ]]; then scratchFlag="--scratch"; fi
30+
fi
31+
32+
if [[ ${forceBuild} -eq 1 ]] || [[ ${doRhpkgContainerBuild} -eq 1 ]]; then
33+
echo "[INFO] #0 Trigger container-build in current branch: rhpkg container-build ${scratchFlag} ${targetFlag}"
34+
git status || true
35+
tmpfile=$(mktemp) && rhpkg container-build ${scratchFlag} ${targetFlag} --nowait | tee 2>&1 "${tmpfile}"
36+
taskID=$(cat "${tmpfile}" | grep "Created task:" | sed -e "s#Created task:##") && brew watch-logs $taskID | tee 2>&1 "${tmpfile}"
37+
ERRORS="$(grep -E "Build failed|image build failed" "${tmpfile}")" && rm -f "${tmpfile}"
38+
if [[ "$ERRORS" != "" ]]; then echo "Brew build has failed:
39+
40+
$ERRORS
41+
42+
"; exit 1; fi
43+
else
44+
echo "[INFO] No build triggered, use -f or --force-build to build in Brew."
45+
fi

devspaces-operator-bundle/container.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ operator_manifests:
4343
devspaces-configbump-rhel8-container: devspaces/configbump-rhel8
4444
devspaces-dashboard-rhel8-container: devspaces/dashboard-rhel8
4545
devspaces-idea-rhel8-container: devspaces/idea-rhel8
46+
devspaces-jb-ide-rhel8-container: devspaces/jb-ide-rhel8
4647
devspaces-imagepuller-rhel8-container: devspaces/imagepuller-rhel8
4748
devspaces-machineexec-rhel8-container: devspaces/machineexec-rhel8
4849
devspaces-pluginregistry-rhel8-container: devspaces/pluginregistry-rhel8

devspaces-pluginregistry/job-config.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,36 @@
302302
"disabled": false
303303
}
304304
},
305+
"jb-ide": {
306+
"3.15": {
307+
"upstream_branch": [
308+
"7.88.x",
309+
"main"
310+
],
311+
"disabled": true
312+
},
313+
"3.16": {
314+
"upstream_branch": [
315+
"7.90.x",
316+
"main"
317+
],
318+
"disabled": false
319+
},
320+
"3.17": {
321+
"upstream_branch": [
322+
"7.92.x",
323+
"main"
324+
],
325+
"disabled": false
326+
},
327+
"3.x": {
328+
"upstream_branch": [
329+
"main",
330+
"main"
331+
],
332+
"disabled": false
333+
}
334+
},
305335
"traefik": {
306336
"3.15": {
307337
"upstream_branch": [

0 commit comments

Comments
 (0)