Skip to content

Commit 88c030c

Browse files
authored
CLI quick fixes (#2540)
* copy JSON schema 1.4.0 as 1.4.2 * schema fixes + optionally include json schema validation errors as hints during app manifest load * fix static token loading * validation fix for mixed profile / env mode * more help * make fix * fix component selection flag to be dir based for help messages * switch dir selection logic to currentdir for build and clean, and drop redundant component subcommands * fix rollback diff crash
1 parent a0fae53 commit 88c030c

File tree

14 files changed

+1535
-467
lines changed

14 files changed

+1535
-467
lines changed

Cargo.lock

Lines changed: 121 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ inquire = "0.7.5"
186186
iso8601 = "0.6.2"
187187
iso8601-timestamp = "0.3.3"
188188
itertools = "0.14.0"
189+
jsonschema = "0.38.1"
189190
jsonwebtoken = "9.2.0"
190191
k8s-openapi = { version = "0.24.0", features = ["earliest"] }
191192
kill_tree = "0.2.4"

cli/golem-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ indoc = { workspace = true }
7070
inquire = { workspace = true }
7171
iso8601 = { workspace = true }
7272
itertools = { workspace = true }
73+
jsonschema = { workspace = true }
7374
lenient_bool = { workspace = true }
7475
minijinja = { workspace = true }
7576
moonbit-component-generator = { workspace = true }

cli/golem-cli/src/command.rs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,15 @@ pub struct GolemCliGlobalFlags {
106106
pub format: Option<Format>,
107107

108108
/// Select Golem environment by name
109-
#[arg(long, short = 'E', global = true, conflicts_with_all = ["local", "cloud"], display_order = 102
110-
)]
109+
#[arg(long, short = 'E', global = true, display_order = 102)]
111110
pub environment: Option<EnvironmentReference>,
112111

113-
/// Select" local" environment from the manifest, or "local" profile
114-
#[arg(long, short = 'L', global = true, conflicts_with_all = ["environment", "cloud"], display_order = 103
115-
)]
112+
/// Select "local" environment from the manifest, or "local" profile
113+
#[arg(long, short = 'L', global = true, conflicts_with_all = ["cloud"], display_order = 103)]
116114
pub local: bool,
117115

118116
/// Select "cloud" environment from the manifest, or "cloud" profile
119-
#[arg(long, short = 'C', global = true, conflicts_with_all = ["environment", "local"], display_order = 104
120-
)]
117+
#[arg(long, short = 'C', global = true, conflicts_with_all = ["local"], display_order = 104)]
121118
pub cloud: bool,
122119

123120
/// Custom path to the root application manifest (golem.yaml)
@@ -915,8 +912,7 @@ pub mod environment {
915912

916913
pub mod component {
917914
use crate::command::shared_args::{
918-
BuildArgs, ComponentOptionalComponentName, ComponentOptionalComponentNames,
919-
ComponentTemplateName,
915+
ComponentOptionalComponentName, ComponentOptionalComponentNames, ComponentTemplateName,
920916
};
921917
use crate::model::worker::AgentUpdateMode;
922918
use clap::Subcommand;
@@ -936,18 +932,6 @@ pub mod component {
936932
/// Optional filter for language or template name
937933
filter: Option<String>,
938934
},
939-
/// Build component(s) based on the current directory or by selection
940-
Build {
941-
#[command(flatten)]
942-
component_name: ComponentOptionalComponentNames,
943-
#[command(flatten)]
944-
build: BuildArgs,
945-
},
946-
/// Clean component(s) based on the current directory or by selection
947-
Clean {
948-
#[command(flatten)]
949-
component_name: ComponentOptionalComponentNames,
950-
},
951935
/// List deployed component versions' metadata
952936
List,
953937
/// Get the latest or selected revision of deployed component metadata

cli/golem-cli/src/command_handler/app/deploy_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ impl<'a, Name, Entity> RollbackEntityDetails<Name, &'a Entity> {
827827
) -> Self {
828828
match entity_diff {
829829
diff::BTreeMapDiffValue::Create => Self {
830-
new: Some(get_current(rollback_diff, &name)),
830+
new: Some(get_new(rollback_diff, &name)),
831831
current: None,
832832
name,
833833
},

cli/golem-cli/src/command_handler/app/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ impl AppCommandHandler {
266266
self.build(
267267
component_name.component_name,
268268
Some(build_args),
269-
&ApplicationComponentSelectMode::All,
269+
&ApplicationComponentSelectMode::CurrentDir,
270270
)
271271
.await
272272
}
273273

274274
pub async fn cmd_clean(&self, component_name: AppOptionalComponentNames) -> anyhow::Result<()> {
275275
self.clean(
276276
component_name.component_name,
277-
&ApplicationComponentSelectMode::All,
277+
&ApplicationComponentSelectMode::CurrentDir,
278278
)
279279
.await
280280
}

cli/golem-cli/src/command_handler/component/mod.rs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::app::context::{to_anyhow, ApplicationContext};
1616

1717
use crate::command::component::ComponentSubcommand;
1818
use crate::command::shared_args::{
19-
BuildArgs, ComponentOptionalComponentNames, ComponentTemplateName, DeployArgs,
19+
ComponentOptionalComponentNames, ComponentTemplateName, DeployArgs,
2020
};
2121
use crate::command_handler::component::ifs::IfsFileManager;
2222
use crate::command_handler::component::staging::ComponentStager;
@@ -89,11 +89,6 @@ impl ComponentCommandHandler {
8989
self.cmd_templates(filter);
9090
Ok(())
9191
}
92-
ComponentSubcommand::Build {
93-
component_name,
94-
build: build_args,
95-
} => self.cmd_build(component_name, build_args).await,
96-
ComponentSubcommand::Clean { component_name } => self.cmd_clean(component_name).await,
9792
ComponentSubcommand::List => self.cmd_list().await,
9893
ComponentSubcommand::Get {
9994
component_name,
@@ -209,34 +204,6 @@ impl ComponentCommandHandler {
209204
Ok(())
210205
}
211206

212-
async fn cmd_build(
213-
&self,
214-
component_name: ComponentOptionalComponentNames,
215-
build_args: BuildArgs,
216-
) -> anyhow::Result<()> {
217-
self.ctx
218-
.app_handler()
219-
.build(
220-
component_name.component_name,
221-
Some(build_args),
222-
&ApplicationComponentSelectMode::CurrentDir,
223-
)
224-
.await
225-
}
226-
227-
async fn cmd_clean(
228-
&self,
229-
component_name: ComponentOptionalComponentNames,
230-
) -> anyhow::Result<()> {
231-
self.ctx
232-
.app_handler()
233-
.clean(
234-
component_name.component_name,
235-
&ApplicationComponentSelectMode::CurrentDir,
236-
)
237-
.await
238-
}
239-
240207
fn cmd_templates(&self, filter: Option<String>) {
241208
match filter {
242209
Some(filter) => {

0 commit comments

Comments
 (0)