Skip to content

Commit d2ce6ff

Browse files
committed
feat: WIP rewriting the restart from devfile logique
1 parent 9484314 commit d2ce6ff

5 files changed

Lines changed: 48 additions & 3 deletions

File tree

libs/devfile/readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ This part should be done in JS and based on the library made by the che team. BU
2626
- [ ] [Patch](https://docs.rs/kube/latest/kube/api/enum.Patch.html)
2727
- [ ] [Stop WS](https://github.com/che-incubator/che-code/blob/6e0a908d58cacb380c216dde3af544d75e3913d5/code/extensions/che-api/src/impl/k8s-workspace-service-impl.ts#L62)
2828

29-
3029
### Useful V2
3130

3231
- [Git Resolver](https://github.com/devfile/devworkspace-generator/tree/main/src/resolve)
33-
-
32+
- [DevWorkspace and template generator](https://github.com/devfile/devworkspace-generator/blob/main/src/generate.ts#L66)
33+
- [Component finder](https://github.com/devfile/devworkspace-generator/blob/main/src/devfile/dev-container-component-finder.ts#L20)
34+
- [DevComponent inserter](https://github.com/devfile/devworkspace-generator/blob/main/src/devfile/dev-container-component-inserter.ts)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use crd::dev_work_space::{DevWorkspace, DevWorkspaceTemplate};
2+
use serde::{Deserialize, Serialize};
3+
4+
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
5+
pub struct DevfileContext {
6+
/// Suffix to append on generated name
7+
pub suffix: Option<String>,
8+
/// devWorkspace
9+
pub dev_workspace: Option<DevWorkspace>,
10+
/// devWorkspaceTemplate
11+
pub dev_workspace_template: Option<DevWorkspaceTemplate>,
12+
/// devfile
13+
pub devfile: Option<String>,
14+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
use super::projects::Project;
4+
5+
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
6+
pub struct GenerateDevfileContext {
7+
pub devfile_path: Option<String>,
8+
pub devfile_url: Option<String>,
9+
pub devfile_content: Option<String>,
10+
pub editor_path: Option<String>,
11+
pub editor_url: Option<String>,
12+
pub editor_content: Option<String>,
13+
pub projects: Vec<Project>,
14+
}
15+
16+
impl GenerateDevfileContext {
17+
pub async fn generate(&self) -> Result<(), ()> {
18+
// ...
19+
Ok(())
20+
}
21+
}

libs/devfile/src/generator/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
1+
pub mod context;
2+
pub mod generate_context;
3+
pub mod projects;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
4+
pub struct Project {
5+
pub name: String,
6+
pub location: String,
7+
}

0 commit comments

Comments
 (0)