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 114
/
Copy pathgenerate_devworkspace_templates.sh
executable file
·63 lines (53 loc) · 2.19 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
56
57
58
59
60
61
62
63
#!/bin/bash
#
# Copyright (c) 2022 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
npm install -g [email protected]
VERSION="${1%/}"
if [[ -z "$VERSION" || "$VERSION" == *"-next" ]]; then
VERSION="main"
fi
PLUGIN_REGISTRY_URL=https://eclipse-che.github.io/che-plugin-registry/${VERSION}/v3
# Install che-devworkspace-generator
CHE_DEVWORKSPACE_GENERATOR_VERSION=next
npm install @eclipse-che/che-devworkspace-generator@${CHE_DEVWORKSPACE_GENERATOR_VERSION}
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%/}
#generate a temporary devworkspace yaml to fetch git repository name and clone url.
npm_config_yes=true npx @eclipse-che/che-devworkspace-generator \
--devfile-url:"${devfile_url}" \
--plugin-registry-url:"${PLUGIN_REGISTRY_URL}" \
--editor-entry:che-incubator/che-code/latest \
--output-file:"${dir}"temp.yaml
name=$(yq -r '.spec.template.projects[0].name' "${dir}temp.yaml" | sed -n '2 p')
project="${name}={{_INTERNAL_URL_}}/resources/v2/${name}.zip"
npm_config_yes=true npx @eclipse-che/che-devworkspace-generator \
--devfile-url:"${devfile_url}" \
--editor-entry:che-incubator/che-code/insiders \
--plugin-registry-url:"${PLUGIN_REGISTRY_URL}" \
--output-file:"${dir}"/devworkspace-che-code-insiders.yaml \
--project."${project}"
npm_config_yes=true npx @eclipse-che/che-devworkspace-generator \
--devfile-url:"${devfile_url}" \
--editor-entry:che-incubator/che-code/latest \
--plugin-registry-url:"${PLUGIN_REGISTRY_URL}" \
--output-file:"${dir}"/devworkspace-che-code-latest.yaml \
--project."${project}"
npm_config_yes=true npx @eclipse-che/che-devworkspace-generator \
--devfile-url:"${devfile_url}" \
--editor-entry:che-incubator/che-idea/next \
--plugin-registry-url:"${PLUGIN_REGISTRY_URL}" \
--output-file:"${dir}"/devworkspace-che-idea-next.yaml \
--project."${project}"
fi
done