-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically restart from local devfile when devfile failed to be resolved at startup #22491
Comments
One difficulty in this is that it appears that the dashboard is still modifying the underlying devfile in converting it to a DevWorkspace, so it's not clear how to patch the DevWorkspace from the project-clone container without pulling in a lot of Che-specific logic. I believe dashboard could avoid this by injecting e.g. environment variables into the editor contribution DevWorkspaceTemplate instead (environment variables from contributions are merged into the main container). I've created issues
For related tasks for this issue. |
PR devfile/devworkspace-operator#1193 should address the DWO-side of this issue. In testing these changes with Che, I found a few sticking points, however. To test, my setup was
I found that #22614 isn't terribly important to getting this to work, as the injected environment variables, etc., are still injected into the end result because they're added to the contribution container as well (so the resulting "flattened" DevWorkspace is generally identical to the successfully-generated one). To make it work, I had to work around the following issues manually (in addition to adding the new attribute):
|
@amisevsk can we close this one or is still something to check? Also this was the last subtask of Support reading devfiles from private repos other than GitHub/GitLab/Bitbucket/Azure · Issue #21951 · eclipse/che. Have you had the chance to test with a Git service that is not GitHub, Gitlab, Bitbucket and Azure Devops? cc @dmytro-ndp |
Regarding non-GitHub/Gitlab/Bitbucket/etc. repositories, the DWO-side changes should work for anything so long as the workspace is started with git credentials suitable for cloning from that repository. As for how to test it directly, I don't have any such repositories available, though. At this point, we have a foundation we can potentially build off of (the
|
In the description of this issue I proposed to trigger try the restart from local devfile when the env variable If the process fails I am expecting the workspace startup to fail and the dashboard showing the error and a message as it does it for normal flow no? For workspace naming: dashboard currently infers the name from the last string of the GIT+SSH URL (it doesn't name it "empty"). For testing @dmytro-ndp can help you with a gogs repository or you can get one at https://sr.ht/ in minutes |
The issue with triggering the functionality based on an env var is that it's much harder to set and unset that environment variable in a workspace (which container do you put it on/which container do you eventually remove it from? DWO does not allow configuring project-clone environment variables currently). An attribute is much easier, as the option applies to the whole workspace rather than an individual container. Currently, what DWO will do (on nightly builds) is edit the DevWorkspace to a) remove the attribute and b) overwrite the contents with the contents of the devfile, which results in the workspace restarting normally as though the dashboard had been able to resolve the devfile in the first place (except for some Che-specific env var handling as described above). However, if the project cannot be cloned or no devfile can be found, the workspace will not fail to start. In this case, it's unclear how we should handle this on the DWO side:
The issue is that it's hard to distinguish the case [failed to do specific bootstrap process] from other failure cases (e.g. [cannot clone repo], [devfile does not exist for repo]). |
Regarding testing via sr.ht, I may be missing something but I don't see how to get a repo with a devfile there without paying for the service (which is something I don't necessarily want to do for the purpose of verifying this issue). However, the project clone container was able to clone the repository without problem, at which point devfile resolution should proceed as normal (i.e. no issues). In this case -- cloning a sr.ht repo without a devfile in it -- devfile resolution (and therefore bootstrapping) failed. However, failing the workspace startup here would be the incorrect option in my opinion, as I still want to be able to be able to use the built-in flows for creating a devfile for this workspace (write a workspace in Code, restart from local devfile, etc.). Also, in cloning this repository, my workspace was named |
This is a problem no matter if the DW had the attribute
Sure, this is something I tried to specify in the description. The re-start should happen only if a devfile is found. And the missing devfile case should be considered ok (no need to restart) as we support repos with no devfile too. |
For sourcehut: you should try the git+ssh, not the https URL. You can still register without https://meta.sr.ht/profile. I have created this repo with a devfile. But anyway, if you have issues there is Dmytro gogs instance. |
Worth noting that the same mechanism for ssh+git URLs works for https URLs here (i.e. if we start using the DWO functionality, it would work for the sourcehut http URLs as well). This bootstrap process works for any URL you can pass to Adding the attribute to the workspace after start (and then restarting manually) results in the workspace completing the bootstrap process and running using the provided devfile: bootstrap-flow-2023-11-24_15.22.10.mp4(For whatever reason, the UI wasn't able to grab the logs of the bootstrapping run of project-clone before the container finished running and updated the DevWorkspace) |
Fixed with #22697 |
Is your enhancement related to a problem? Please describe
There are situation where che-server is not able to resolve a devfile from a git repository using the git service API. A typical example is when it's not GitHub, GitLab, Bitbucket or Azure DevOps repository or when SSH URL is used.
Describe the solution you'd like
Project clone, after cloning the git repository, updates the DevWorkspace object if both conditions are met:
DEVFILE_RESOLUTION=failed
is setMore information
This is part of this epic: #21951
The text was updated successfully, but these errors were encountered: