3.3.4. factory パラメーターを使用した devfile 値の上書き
リモート devfile の以下のセクションで値を上書きできます。
-
apiVersion
-
metadata
-
projects
-
属性
追加の factory パラメーターを使用して値を上書きできます。
前提条件
- Red Hat CodeReady Workspaces の実行中のインスタンス。https://access.redhat.com/documentation/ja-jp/red_hat_codeready_workspaces/2.13/html-single/installation_guide/index#installing-che.adoc を参照してください。
-
一般にアクセス可能なスタンドアロンの
devfile.yaml
ファイル。devfile の作成および使用の詳細は、「devfile 2.0.0 のオーサリング」 を参照してください。
手順
-
URL
\https://codeready-<openshift_deployment_name>.<domain_name>/f?url=https://<hostURL>/devfile.yaml&override.<parameter.path>=<value>
に移動してワークスペースを開きます。
例3.3 generateName
プロパティーを上書きする例
以下の初期 devfile について考えてみましょう。
apiVersion: 1.0.0 metadata: generateName: golang- projects: ...
generateName
値を追加または上書きするには、以下の factory URL を使用します。
https://workspaces.openshift.com/f?url=<repository-url>&override.metadata.generateName=myprefix
作成されるワークスペースには、以下の devfile モデルがあります。
apiVersion: 1.0.0 metadata: generateName: myprefix projects: ...
例3.4 プロジェクトソースブランチプロパティーの上書き例
以下の初期 devfile について考えてみましょう。
apiVersion: 1.0.0 metadata: generateName: java-mysql- projects: - name: web-java-spring-petclinic source: type: git location: "https://github.com/spring-projects/spring-petclinic.git" ...
ソースの branch
の値を追加または上書きするには、以下の factory URL を使用します。
https://workspaces.openshift.com/f?url=<repository-url>&override.projects.web-java-spring-petclinic.source.branch=1.0.x
作成されるワークスペースには、以下の devfile モデルがあります。
apiVersion: 1.0.0 metadata: generateName: java-mysql- projects: - name: web-java-spring-petclinic source: type: git location: "https://github.com/spring-projects/spring-petclinic.git" branch: 1.0.x ...
例3.5 属性値の上書きまたは作成例
以下の初期 devfile について考えてみましょう。
apiVersion: 1.0.0 metadata: generateName: golang- attributes: persistVolumes: false projects: ...
persistVolumes
属性値を追加または上書きするには、以下の factory URL を使用します。
https://workspaces.openshift.com/f?url=<repository-url>&override.attributes.persistVolumes=true
作成されるワークスペースには、以下の devfile モデルがあります。
--- apiVersion: 1.0.0 metadata: generateName: golang- attributes: persistVolumes: true projects: ...
属性を上書きする場合、attributes
キーワードをベースとするものはすべて属性名として解釈されます。ドットで区切られた名前を使用できます。
https://workspaces.openshift.com/f?url=<repository-url>&override.attributes.dot.name.format.attribute=true
作成されるワークスペースには、以下の devfile モデルがあります。
apiVersion: 1.0.0 metadata: generateName: golang- attributes: dot.name.format.attribute: true projects: ...
検証手順
- CodeReady Workspaces ダッシュボードで、新たに作成されたワークスペースの Devfile タブに移動し、コンテンツを検査します。