Skip to content
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

Ability to generate cloud credentials in the CLI build tool #12438

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build_tools/build/src/cloud_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ pub async fn prepare_credentials_file(auth_config: AuthConfig) -> Result<NamedTe
Ok(credentials_temp_file)
}

pub async fn build_credentials_file(auth_config: AuthConfig, path: &Path) -> Result<()> {
let credentials = build_credentials(auth_config).await?;
save_credentials(&credentials, path)
}

#[derive(Debug)]
pub struct AuthConfig {
web_client_id: String,
Expand Down
3 changes: 3 additions & 0 deletions build_tools/cli/src/arg/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ pub enum Command {
CiCheck {},
/// Perform the stdlib API checks
StdlibApiCheck {},

/// Generate Cloud credentials
GenerateCloudCredentials {},
}

#[derive(Args, Clone, Debug, PartialEq)]
Expand Down
7 changes: 7 additions & 0 deletions build_tools/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::arg::WatchJob;
use anyhow::Context;
use arg::BuildDescription;
use clap::Parser;
use enso_build::cloud_tests;
use enso_build::config::Config;
use enso_build::context::BuildContext;
use enso_build::engine::context::EnginePackageProvider;
Expand Down Expand Up @@ -449,6 +450,12 @@ impl Processor {
.void_ok()
.boxed()
}
arg::backend::Command::GenerateCloudCredentials {} => async move {
let auth_config = cloud_tests::build_auth_config_from_environment()?;
let path = Path::new("enso.credentials");
cloud_tests::build_credentials_file(auth_config, path).await
}
.boxed(),
}
}

Expand Down
Loading