Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4
feat: Select versions of demos & stacks#340
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
26e387ae7243f21a0e041e6f73ca967fce08a3d948d2b16bba9bd54d01915ed0e4192558962a8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,20 +8,19 @@ use tracing::{debug, instrument, Level}; | ||
| use stackable_cockpit::{ | ||
| constants::{HELM_REPO_NAME_DEV, HELM_REPO_NAME_STABLE, HELM_REPO_NAME_TEST}, | ||
| helm, | ||
| platform::demo::List, | ||
| utils::path::{ | ||
| IntoPathOrUrl, IntoPathsOrUrls, ParsePathsOrUrls, PathOrUrl, PathOrUrlParseError, | ||
| }, | ||
| xfer::{cache::Settings, Client}, | ||
| xfer::cache::Settings, | ||
| }; | ||
| use crate::{ | ||
| args::{CommonFileArgs, CommonRepoArgs}, | ||
| cmds::{cache, completions, debug, demo, operator, release, stack, stacklet}, | ||
| constants::{ | ||
| ENV_KEY_DEMO_FILES, ENV_KEY_RELEASE_FILES, ENV_KEY_STACK_FILES, REMOTE_DEMO_FILE, | ||
| REMOTE_RELEASE_FILE, REMOTE_STACK_FILE, USER_DIR_APPLICATION_NAME, | ||
| USER_DIR_ORGANIZATION_NAME, USER_DIR_QUALIFIER, | ||
| DEMOS_REPOSITORY_DEMOS_SUBPATH, DEMOS_REPOSITORY_STACKS_SUBPATH, DEMOS_REPOSITORY_URL_BASE, | ||
| ENV_KEY_DEMO_FILES, ENV_KEY_RELEASE_FILES, ENV_KEY_STACK_FILES, REMOTE_RELEASE_FILE, | ||
| USER_DIR_APPLICATION_NAME, USER_DIR_ORGANIZATION_NAME, USER_DIR_QUALIFIER, | ||
| }, | ||
| output::{ErrorContext, Output, ResultContext}, | ||
| }; | ||
| @@ -74,10 +73,6 @@ Cached files are saved at '$XDG_CACHE_HOME/stackablectl', which is usually | ||
| )] | ||
| pub no_cache: bool, | ||
| /// Do not request any remote files via the network | ||
| #[arg(long, global = true)] | ||
| pub offline: bool, | ||
| #[command(flatten)] | ||
| pub files: CommonFileArgs, | ||
| @@ -90,27 +85,34 @@ Cached files are saved at '$XDG_CACHE_HOME/stackablectl', which is usually | ||
| impl Cli { | ||
| /// Returns a list of demo files, consisting of entries which are either a path or URL. The list of files combines | ||
| /// the default demo file URL, [`REMOTE_DEMO_FILE`], files provided by the ENV variable [`ENV_KEY_DEMO_FILES`], and | ||
| /// lastly, files provided by the CLI argument `--demo-file`. | ||
| pub fn get_demo_files(&self) -> Result<Vec<PathOrUrl>, PathOrUrlParseError> { | ||
| let mut files = get_files(REMOTE_DEMO_FILE, ENV_KEY_DEMO_FILES)?; | ||
| /// the default demo file URL constructed from [`DEMOS_REPOSITORY_URL_BASE`] and the provided branch, files provided | ||
| /// by the ENV variable [`ENV_KEY_DEMO_FILES`], and lastly, files provided by the CLI argument `--demo-file`. | ||
| pub fn get_demo_files(&self, branch: &str) -> Result<Vec<PathOrUrl>, PathOrUrlParseError> { | ||
| let branch_url = format!( | ||
| "{base}/{branch}/{demos}", | ||
| base = DEMOS_REPOSITORY_URL_BASE, | ||
| demos = DEMOS_REPOSITORY_DEMOS_SUBPATH | ||
| ); | ||
| let mut files = get_files(&branch_url, ENV_KEY_DEMO_FILES)?; | ||
| let arg_files = self.files.demo_files.clone().into_paths_or_urls()?; | ||
| files.extend(arg_files); | ||
| Ok(files) | ||
| } | ||
| pub async fn get_demo_list(&self, transfer_client: &Client) -> List { | ||
| let files = self.get_demo_files().unwrap(); | ||
| List::build(&files, transfer_client).await.unwrap() | ||
| } | ||
| /// Returns a list of stack files, consisting of entries which are either a path or URL. The list of files combines | ||
| /// the default stack file URL, [`REMOTE_STACK_FILE`], files provided by the ENV variable [`ENV_KEY_STACK_FILES`], | ||
| /// and lastly, files provided by the CLI argument `--stack-file`. | ||
| pub fn get_stack_files(&self) -> Result<Vec<PathOrUrl>, PathOrUrlParseError> { | ||
| let mut files = get_files(REMOTE_STACK_FILE, ENV_KEY_STACK_FILES)?; | ||
| /// the default stack file URL constructed from [`DEMOS_REPOSITORY_URL_BASE`] and the provided branch, files provided | ||
| /// by the ENV variable [`ENV_KEY_STACK_FILES`], and lastly, files provided by the CLI argument `--stack-file`. | ||
| pub fn get_stack_files(&self, branch: &str) -> Result<Vec<PathOrUrl>, PathOrUrlParseError> { | ||
Techassi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| let branch_url = format!( | ||
| "{base}/{branch}/{stacks}", | ||
| base = DEMOS_REPOSITORY_URL_BASE, | ||
| stacks = DEMOS_REPOSITORY_STACKS_SUBPATH | ||
| ); | ||
| let mut files = get_files(&branch_url, ENV_KEY_STACK_FILES)?; | ||
| let arg_files = self.files.stack_files.clone().into_paths_or_urls()?; | ||
| files.extend(arg_files); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.