This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
/
generate_devworkspace_templates.sh
executable file
·55 lines (47 loc) · 2.27 KB
/
generate_devworkspace_templates.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
#!/bin/bash
#
# Copyright (c) 2021 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
#
set -e
VERSION="${1%/}"
CHE_THEIA_DEVWORKSPACE_HANDLER_VERSION=0.0.1-1639071223
CHE_CODE_DEVWORKSPACE_HANDLER_VERSION=1.64.0-dev-210b722
# shellcheck disable=SC1091
source ./clone_and_zip.sh
mkdir -p /build/resources/v2/
for dir in /build/devfiles/*/
do
devfile_url=$(grep "v2:" "${dir}"meta.yaml) || :
if [ -n "$devfile_url" ]; then
devfile_url=${devfile_url##*v2: }
devfile_url=${devfile_url%/}
devfile_repo=${devfile_url%/tree*}
name=$(basename "${devfile_repo}")
npm_config_yes=true npx @eclipse-che/che-theia-devworkspace-handler@${CHE_THEIA_DEVWORKSPACE_HANDLER_VERSION} --devfile-url:"${devfile_url}" \
--editor:eclipse/che-theia/latest \
--output-file:"${dir}"/devworkspace-che-theia-latest.yaml \
--project."${name}={{ INTERNAL_URL }}/resources/v2/${name}.zip"
npm_config_yes=true npx @eclipse-che/che-code-devworkspace-handler@${CHE_CODE_DEVWORKSPACE_HANDLER_VERSION} --devfile-url:"${devfile_url}" \
--editor-entry:che-incubator/che-code/insiders \
--output-file:"${dir}"/devworkspace-che-code-insiders.yaml \
--project."${name}={{ INTERNAL_URL }}/resources/v2/${name}.zip"
# When release is happend, we need to replace tags of images in che-theia editor
if [ -n "$VERSION" ]; then
cheTheia="quay.io/eclipse/che-theia"
cheTheiaEndpointRuntimeBinary="${cheTheia}-endpoint-runtime-binary"
cheMachineExec="quay.io/eclipse/che-machine-exec"
sed -i "${dir}/devworkspace-che-theia-latest.yaml" \
-e "s#${cheTheia}@sha256:\([a-z0-9\_]\([\-\.\_a-z0-9]\)*\)#${cheTheia}:${VERSION}#"
sed -i "${dir}/devworkspace-che-theia-latest.yaml" \
-e "s#${cheTheiaEndpointRuntimeBinary}@sha256:\([a-z0-9\_]\([\-\.\_a-z0-9]\)*\)#${cheTheiaEndpointRuntimeBinary}:${VERSION}#"
sed -i "${dir}/devworkspace-che-theia-latest.yaml" \
-e "s#${cheMachineExec}@sha256:\([a-z0-9\_]\([\-\.\_a-z0-9]\)*\)#${cheMachineExec}:${VERSION}#"
fi
clone_and_zip "${devfile_repo}" "${devfile_url##*/}" "/build/resources/v2/$name.zip"
fi
done