1.3.2. ランタイム時の devfile の追加
手順
devfile を追加するには、以下を実行します。
devfile レジストリーソースをチェックアウトします。
$ git clone https://github.com/redhat-developer/codeready-workspaces; \ cd codeready-workspaces/dependencies/che-devfile-registry一部のローカルフォルダーに
devfile.yamlおよびmeta.yamlを作成します。これは、ゼロまたは既存の devfile からコピーして実行できます。$ STACK="new-stack"; \ mkdir -p devfiles/${STACK}; cp devfiles/03_web-nodejs-simple/* devfiles/${STACK}/-
既存の devfile からコピーする場合は、必要に応じて devfile に変更を加えます。新しい devfile に固有の
displayNameとdescriptionがあることを確認します。 devfile レジストリーコンテナーをホストする Pod の名前を取得します。これを実行するには、
component=devfile-registryラベルをフィルターします。$ DEVFILE_REG_POD=$(oc get -o custom-columns=NAME:.metadata.name \ --no-headers pod -l component=devfile-registry)レジストリーの
index.jsonファイルを再生成し、新しい devfile を追加します。$ cd codeready-workspaces/dependencies/che-devfile-registry; \ "$(pwd)/build/scripts/check_mandatory_fields.sh" devfiles; \ "$(pwd)/build/scripts/index.sh" > index.json新しい
index.json、、およびdevfile.yamlmeta.yamlファイルを新しいローカル devfile フォルダーからコンテナーにコピーします。$ cd codeready-workspaces/dependencies/che-devfile-registry; \ LOCAL_FILES="$(pwd)/${STACK}/meta.yaml $(pwd)/${STACK}/devfile.yaml $(pwd)/index.json"; \ oc exec ${DEVFILE_REG_POD} -i -t -- mkdir -p /var/www/html/devfiles/${STACK}; \ for f in $LOCAL_FILES; do e=${f/$(pwd)\//}; echo "Upload ${f} -> /var/www/html/devfiles/${e}" oc cp "${f}" ${DEVFILE_REG_POD}:/var/www/html/devfiles/${e}; done- devfile レジストリーの既存の CodeReady Workspaces インスタンスから、新しい devfile を使用できるようになりました。これを検出するには、CodeReady Workspaces ダッシュボードに移動し、Workspaces リンクをクリックします。そこから Add Workspace をクリックし、利用可能な devfile の更新一覧を表示します。