diff --git a/devspaces-jb-ide/build/dockerfiles/brew.Dockerfile b/devspaces-jb-ide/build/dockerfiles/brew.Dockerfile new file mode 100755 index 0000000000..524df1eb6a --- /dev/null +++ b/devspaces-jb-ide/build/dockerfiles/brew.Dockerfile @@ -0,0 +1,63 @@ +# Copyright (c) 2024 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +# The Dockerfile works only in Brew, as it is customized for Cachito fetching +# project sources and npm dependencies, and performing an offline build with them + +# https://registry.access.redhat.com/ubi8/nodejs-20 +FROM registry.access.redhat.com/ubi8/nodejs-20:1-50.1720405266 +USER 0 + +WORKDIR $REMOTE_SOURCES_DIR/devspaces-images-jb-ide/app/devspaces-jb-ide/ + +# cachito:yarn step 1: copy cachito sources where we can use them; source env vars; set working dir +COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR + +# hadolint ignore=SC2086 +RUN source $REMOTE_SOURCES_DIR/devspaces-images-jb-ide/cachito.env + +RUN cp -r build/dockerfiles/*.sh / +RUN cp -r status-app /status-app/ + +# Create a folders structure for mounting a shared volume and copy the editor binaries to. +RUN mkdir -p /idea-server/status-app + +# Adjust permissions on some items so they're writable by group root. +# hadolint ignore=SC2086 +RUN for f in "${HOME}" "/etc/passwd" "/etc/group" "/status-app" "/idea-server"; do\ + chgrp -R 0 ${f} && \ + chmod -R g+rwX ${f}; \ + done + +# Build the status app. +WORKDIR /status-app/ +RUN npm install + +# Switch to unprivileged user. +USER 1001 + +ENTRYPOINT /entrypoint.sh + +ENV SUMMARY="Red Hat OpenShift Dev Spaces with JetBrains IDE container" \ + DESCRIPTION="Red Hat OpenShift Dev Spaces with JetBrains IDE container" \ + PRODNAME="devspaces" \ + COMPNAME="jb-ide-rhel8" +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="$DESCRIPTION" \ + io.openshift.tags="$PRODNAME,$COMPNAME" \ + com.redhat.component="$PRODNAME-$COMPNAME-container" \ + name="$PRODNAME/$COMPNAME" \ + version="3.17" \ + license="EPLv2" \ + maintainer="Artem Zatsarynnyi " \ + io.openshift.expose-services="" \ + usage="" diff --git a/devspaces-jb-ide/build/scripts/sync.sh b/devspaces-jb-ide/build/scripts/sync.sh new file mode 100644 index 0000000000..2b5b9f06f4 --- /dev/null +++ b/devspaces-jb-ide/build/scripts/sync.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# Copyright (c) 2024 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e + +# defaults +CSV_VERSION=3.y.0 # csv 3.y.0 +DS_VERSION=${CSV_VERSION%.*} # tag 3.y + +UPSTM_NAME="che-idea-dev-server" +MIDSTM_NAME="jb-remote-dev-server" + +usage () { + echo " +Usage: $0 -v [DS CSV_VERSION] [-s /path/to/${UPSTM_NAME}] [-t /path/to/generated] +Example: $0 -v 3.y.0 -s ${HOME}/projects/${UPSTM_NAME} -t /tmp/devspaces-${MIDSTM_NAME}" + exit +} + +if [[ $# -lt 6 ]]; then usage; fi + +while [[ "$#" -gt 0 ]]; do + case $1 in + '-v') CSV_VERSION="$2"; DS_VERSION="${CSV_VERSION%.*}"; shift 1;; + # paths to use for input and output + '-s') SOURCEDIR="$2"; SOURCEDIR="${SOURCEDIR%/}"; shift 1;; + '-t') TARGETDIR="$2"; TARGETDIR="${TARGETDIR%/}"; shift 1;; + '--help'|'-h') usage;; + esac + shift 1 +done + +if [[ ! -d "${SOURCEDIR}" ]]; then usage; fi +if [[ ! -d "${TARGETDIR}" ]]; then usage; fi +if [[ "${CSV_VERSION}" == "3.y.0" ]]; then usage; fi + +# workaround for CRW-4328 and broken rhpkg release -- add a .spec file (that will be ignored) +# ignore changes in these files +echo ".github/ +.git/ +.gitattributes +/build/scripts/sync.sh +/build/python/ +/bootstrap.Dockerfile +/cvp.yml +/container.yaml +/content_sets.* +/cvp.yml +/cvp-owners.yml +/sources +sources.spec +/get-source*.sh +/tests/basic-test.yaml +" > /tmp/rsync-excludes +echo "Rsync ${SOURCEDIR} to ${TARGETDIR}" +rsync -azrlt --checksum --exclude-from /tmp/rsync-excludes --delete "${SOURCEDIR}"/ "${TARGETDIR}"/ +rm -f /tmp/rsync-excludes + +# ensure shell scripts are executable +find "${TARGETDIR}"/ -name "*.sh" -exec chmod +x {} \; + +sed_in_place() { + SHORT_UNAME=$(uname -s) + if [ "$(uname)" == "Darwin" ]; then + sed -i '' "$@" + elif [ "${SHORT_UNAME:0:5}" == "Linux" ]; then + sed -i "$@" + fi +} + +sed_in_place -r \ + `# Update DevSpaces version for Dockerfile` \ + -e "s/version=.*/version=\"$DS_VERSION\" \\\/" \ + "${TARGETDIR}"/build/dockerfiles/brew.Dockerfile diff --git a/devspaces-jb-ide/container.yaml b/devspaces-jb-ide/container.yaml new file mode 100644 index 0000000000..76e03ec279 --- /dev/null +++ b/devspaces-jb-ide/container.yaml @@ -0,0 +1,26 @@ +--- +platforms: + # all these keys are optional - see https://osbs.readthedocs.io/en/latest/users.html#image-configuration for more info + + only: + - x86_64 + # - s390x + # - ppc64le + +compose: + inherit: false + pulp_repos: true + signing_intent: release + +# instead of docker_api, use imagebuilder for multistage builds +image_build_method: imagebuilder + +remote_sources: +- name: devspaces-images-jb-ide + remote_source: + repo: https://github.com/redhat-developer/devspaces-images.git + ref: b8d76a3091d9fbf553184bd0a3d8b797a76e38dd + pkg_managers: [npm] + packages: + npm: + - path: devspaces-jb-ide/status-app/ diff --git a/devspaces-jb-ide/get-sources.sh b/devspaces-jb-ide/get-sources.sh new file mode 100755 index 0000000000..7e57d08449 --- /dev/null +++ b/devspaces-jb-ide/get-sources.sh @@ -0,0 +1,45 @@ +#!/bin/bash -xe +# script to trigger rhpkg (no assets to fetch) +# + +scratchFlag="" +targetFlag="" +doRhpkgContainerBuild=1 +forceBuild=0 + +while [[ "$#" -gt 0 ]]; do + case $1 in + '-d'|'--delete-assets') exit 0; shift 0;; + '-a'|'--publish-assets') exit 0; shift 0;; + '-p'|'--pull-assets') exit 0; shift 0;; + '-n'|'--nobuild') doRhpkgContainerBuild=0; shift 0;; + '-f'|'--force-build') forceBuild=1; shift 0;; + '-s'|'--scratch') scratchFlag="--scratch"; shift 0;; + '--target') targetFlag="--target $2"; shift 1;; + '-v') CSV_VERSION="$2"; shift 1;; + '-ght') exit 0; shift 1;; + esac + shift 1 +done + +# if building a scratch from a private branch, use --target devspaces-*-rhel-8-containers-candidate +MIDSTM_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "") +if [[ ${MIDSTM_BRANCH} = "private-"* ]] || [[ ${MIDSTM_BRANCH} != "devspaces-"*"-rhel-"* ]]; then + if [[ ! $targetFlag ]]; then targetFlag="--target devspaces-3-rhel-8-containers-candidate"; fi + if [[ ! $scratchFlag ]]; then scratchFlag="--scratch"; fi +fi + +if [[ ${forceBuild} -eq 1 ]] || [[ ${doRhpkgContainerBuild} -eq 1 ]]; then + echo "[INFO] #0 Trigger container-build in current branch: rhpkg container-build ${scratchFlag} ${targetFlag}" + git status || true + tmpfile=$(mktemp) && rhpkg container-build ${scratchFlag} ${targetFlag} --nowait | tee 2>&1 "${tmpfile}" + taskID=$(cat "${tmpfile}" | grep "Created task:" | sed -e "s#Created task:##") && brew watch-logs $taskID | tee 2>&1 "${tmpfile}" + ERRORS="$(grep -E "Build failed|image build failed" "${tmpfile}")" && rm -f "${tmpfile}" + if [[ "$ERRORS" != "" ]]; then echo "Brew build has failed: + +$ERRORS + + "; exit 1; fi +else + echo "[INFO] No build triggered, use -f or --force-build to build in Brew." +fi diff --git a/devspaces-operator-bundle/container.yaml b/devspaces-operator-bundle/container.yaml index 747f3d31f5..ddf3b24071 100644 --- a/devspaces-operator-bundle/container.yaml +++ b/devspaces-operator-bundle/container.yaml @@ -43,6 +43,7 @@ operator_manifests: devspaces-configbump-rhel8-container: devspaces/configbump-rhel8 devspaces-dashboard-rhel8-container: devspaces/dashboard-rhel8 devspaces-idea-rhel8-container: devspaces/idea-rhel8 + devspaces-jb-ide-rhel8-container: devspaces/jb-ide-rhel8 devspaces-imagepuller-rhel8-container: devspaces/imagepuller-rhel8 devspaces-machineexec-rhel8-container: devspaces/machineexec-rhel8 devspaces-pluginregistry-rhel8-container: devspaces/pluginregistry-rhel8 diff --git a/devspaces-pluginregistry/job-config.json b/devspaces-pluginregistry/job-config.json index bf3d3c6c4e..50a37c1aaf 100644 --- a/devspaces-pluginregistry/job-config.json +++ b/devspaces-pluginregistry/job-config.json @@ -302,6 +302,36 @@ "disabled": false } }, + "jb-ide": { + "3.15": { + "upstream_branch": [ + "7.88.x", + "main" + ], + "disabled": true + }, + "3.16": { + "upstream_branch": [ + "7.90.x", + "main" + ], + "disabled": false + }, + "3.17": { + "upstream_branch": [ + "7.92.x", + "main" + ], + "disabled": false + }, + "3.x": { + "upstream_branch": [ + "main", + "main" + ], + "disabled": false + } + }, "traefik": { "3.15": { "upstream_branch": [