Create Workspace from Repository via devfile
Hi,
I checked in the actual devfile into the repo of my projekt.
The devfile has the new 7 format.
But when I want to create a new workspace via the url of the repo as described here in a format like https://<your-che-host>/f?url=https://github.com/mygroup/myrepo
I get the Error:
This factory is using old workspace definition format which is not compatible anymore. Please follow the documentation to update the definition of the workspace and benefits from the latest capabilities.
Here is the devfile:
metadata:
name: ProConChe2
apiVersion: 1.0.0
components:
- args: []
env: []
selector: {}
endpoints: []
command: []
entrypoints: []
preferences: {}
volumes: []
id: redhat/java/latest
type: chePlugin
- args: []
env:
- name: MAVEN_CONFIG
value: /home/user/.m2
- name: MAVEN_OPTS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user
-Dhttp.proxySet=true -Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
- name: JAVA_OPTS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
-Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
- name: JAVA_TOOL_OPTIONS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
-Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
selector: {}
endpoints:
- name: 8080/tcp
port: 8080
attributes: {}
command: []
entrypoints: []
preferences: {}
memoryLimit: 512Mi
alias: maven
mountSources: true
image: 'quay.io/eclipse/che-java11-maven:nightly'
volumes:
- containerPath: /home/user/.m2
name: m2
type: dockerimage
- args: []
env: []
selector: {}
endpoints:
- name: 8080/tcp
port: 8080
attributes: {}
command: []
entrypoints: []
preferences: {}
alias: tomcat
mountSources: true
image: tomcat
volumes:
- containerPath: /usr/local/tomcat/webapps
name: webapps
type: dockerimage
commands:
- name: build
actions:
- component: maven
command: 'cd ${CHE_PROJECTS_ROOT}/ProConChe && mvn clean install '
type: exec
attributes: {}
- name: run tomcat
actions:
- component: tomcat
command: >-
echo "Start Tomcat" && echo $CATALINA_HOME &&
$CATALINA_HOME/bin/catalina.sh stop && cp
$CHE_PROJECTS_ROOT/ProConChe/target/procon.war
$CATALINA_HOME/webapps/ROOT.war && $CATALINA_HOME/bin/catalina.sh
start
type: exec
attributes: {}
projects:
- source:
location: 'http://vm-eclipse-che-01.team-pb.de:10080/wb/ProConChe.git'
type: git
name: ProConChe
attributes: {}
I'm using eclipse che 7.2.0-SNAPSHOT (pulled today)
Hi @wgbeckmann
There are a few issues with your devfile as shown. When I try to create a workspace using a direct link to the devfile (<che-url>/f?url=<fpaste of above>) I get the following in a popup notification:
Error occurred during creation a workspace from devfile located at `https://paste.fedoraproject.org/paste/L9M-Zic2dVr05G9bDehAIQ/raw`.
Cause: Devfile schema validation failed.
Error:
(/components/0/args):The object must not have a property whose name is "args".
(/components/0/env):The object must not have a property whose name is "env".
(/components/0/selector):The object must not have a property whose name is "selector".
(/components/0/endpoints):The object must not have a property whose name is "endpoints".
(/components/0/command):The object must not have a property whose name is "command".
(/components/0/entrypoints):The object must not have a property whose name is "entrypoints".
(/components/0/volumes):The object must not have a property whose name is "volumes".
(/components/1/selector):The object must not have a property whose name is "selector".
(/components/1/entrypoints):The object must not have a property whose name is "entrypoints".
(/components/1/preferences):The object must not have a property whose name is "preferences".
(/components/2/selector):The object must not have a property whose name is "selector".
(/components/2/entrypoints):The object must not have a property whose name is "entrypoints".
(/components/2/preferences):The object must not have a property whose name is "preferences".
(/components/2):The object must have a property whose name is "memoryLimit".
This should also appear when you refer to a git repository, if it doesn't that is a bug (and I agree the way we can report this error should be better). I've done a quick clean up on the devfile you shared below, could you try running that?
Updated devfile
metadata:
name: ProConChe2
apiVersion: 1.0.0
components:
- id: redhat/java/latest
type: chePlugin
- env:
- name: MAVEN_CONFIG
value: /home/user/.m2
- name: MAVEN_OPTS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user
-Dhttp.proxySet=true -Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
- name: JAVA_OPTS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
-Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
- name: JAVA_TOOL_OPTIONS
value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Dhttp.proxySet=true
-Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=8080
-Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts='che-host|localhost|127.0.0.1|*.team-pb.de|vm-eclipse-che-01|139.2.161.45|'
endpoints:
- name: 8080/tcp
port: 8080
memoryLimit: 512Mi
alias: maven
mountSources: true
image: 'quay.io/eclipse/che-java11-maven:nightly'
volumes:
- containerPath: /home/user/.m2
name: m2
type: dockerimage
-
endpoints:
- name: 8080/tcp
port: 8080
alias: tomcat
mountSources: true
image: tomcat
volumes:
- containerPath: /usr/local/tomcat/webapps
name: webapps
type: dockerimage
memoryLimit: 512Mi
commands:
- name: build
actions:
- component: maven
command: 'cd ${CHE_PROJECTS_ROOT}/ProConChe && mvn clean install '
type: exec
- name: run tomcat
actions:
- component: tomcat
command: >-
echo "Start Tomcat" && echo $CATALINA_HOME &&
$CATALINA_HOME/bin/catalina.sh stop && cp
$CHE_PROJECTS_ROOT/ProConChe/target/procon.war
$CATALINA_HOME/webapps/ROOT.war && $CATALINA_HOME/bin/catalina.sh
start
type: exec
projects:
- source:
location: 'http://vm-eclipse-che-01.team-pb.de:10080/wb/ProConChe.git'
type: git
name: ProConChe
Note, I had to guess at an appropriate memoryLimit for the tomcat container (I chose 512Mi arbitrarily), so you may need to adjust this.
Ok, thanks. I try it. But the dev File was copied from a running workspace, it would be great if the checks in the factory and in the normal startup were the same.
But more interesting for me ist, where can I see the detailed errors. I could only see a nice screen witch a crane and the error message.
Sorry, I just sew you wrote, that you got a popup. I didn't get one. My URL pointet to the repo not to the devfile. Is there a difference?
I tried to point the URL to the devfile and then I also got the popup.
So in my repo is in the root level the devfile with the name devfile.yaml. Is that the correct way?
I tried it with the modified devfile and pointing the url to it and it worked.
Thanks!
So in my repo is in the root level the devfile with the name devfile.yaml. Is that the correct way?
yes. Like this https://github.com/eclipse/che/blob/master/devfile.yaml
@wgbeckmann : Thanks for raising your question and reaching out. It sounds you have been able to go over your issue, can I close this issue?
Yes, sorry and thank you!
@wgbeckmann I'd like to follow up on these potential additional issues:
But the dev File was copied from a running workspace, it would be great if the checks in the factory and in the normal startup were the same.
When you say copied from a running workspace, you mean from the Dashboard > Workspaces > Devfile tab, right?
Also, you're reporting that you're only getting the errors notification when passing in a devfile directly, not when it's in the root of the repository, correct?
Yes, it is copied from a running workspace and yes the devfile was placed in the root of the repostory and it only workt when I'm pointing to it directly.
The first point might be a issue, the secont point might be an issue by our git-server. We use Gogs and the URL for the Repo ist the same as for the UI. Perhaps Gogs is not reacting like github.