Use base64 encoded string for application env vars

- Use base64 encoded string for env variables of applications
  - Remove External services, as they are not used by the core
    at all
This commit is contained in:
Romain GERARD
2021-09-22 13:22:55 +02:00
committed by Erèbe - Romain Gerard
parent c7abcf4c63
commit fe6f6454f4
22 changed files with 170 additions and 986 deletions

2
Cargo.lock generated
View File

@@ -2051,6 +2051,7 @@ dependencies = [
"git2",
"itertools",
"lazy_static",
"maplit",
"rand 0.8.4",
"reqwest 0.11.4",
"retry",
@@ -3169,6 +3170,7 @@ dependencies = [
"dirs",
"gethostname",
"hashicorp_vault",
"maplit",
"qovery-engine",
"rand 0.7.3",
"reqwest 0.10.10",

View File

@@ -70,6 +70,7 @@ tempdir = "0.3"
tempfile = "3.2.0"
uuid = { version = "0.8", features = ["v4"] }
function_name = "0.2.0"
maplit = "1.0.2"
[features]
default = []

View File

@@ -10,7 +10,7 @@ metadata:
appId: {{ id }}
app: {{ sanitized_name }}
type: Opaque
stringData:
data:
{%- for ev in environment_variables %}
{{ ev.key }}: |-
{{ ev.value }}

View File

@@ -10,7 +10,7 @@ metadata:
appId: {{ id }}
app: {{ sanitized_name }}
type: Opaque
stringData:
data:
{%- for ev in environment_variables %}
{{ ev.key }}: |-
{{ ev.value }}

View File

@@ -10,7 +10,7 @@ metadata:
appId: {{ id }}
app: {{ sanitized_name }}
type: Opaque
stringData:
data:
{%- for ev in environment_variables %}
{{ ev.key }}: |-
{{ ev.value }}

View File

@@ -1,255 +0,0 @@
use tera::Context as TeraContext;
use crate::build_platform::Image;
use crate::cloud_provider::models::{EnvironmentVariable, EnvironmentVariableDataTemplate};
use crate::cloud_provider::service::{
default_tera_context, delete_stateless_service, deploy_stateless_service_error, deploy_user_stateless_service,
send_progress_on_long_task, Action, Application as AApplication, Create, Delete, Helm, Pause, Service, ServiceType,
StatelessService,
};
use crate::cloud_provider::DeploymentTarget;
use crate::cmd::helm::Timeout;
use crate::error::{EngineError, EngineErrorScope};
use crate::models::{Context, Listen, Listener, Listeners};
pub struct ExternalService {
context: Context,
id: String,
action: Action,
name: String,
total_cpus: String,
total_ram_in_mib: u32,
image: Image,
environment_variables: Vec<EnvironmentVariable>,
listeners: Listeners,
}
impl ExternalService {
pub fn new(
context: Context,
id: &str,
action: Action,
name: &str,
total_cpus: String,
total_ram_in_mib: u32,
image: Image,
environment_variables: Vec<EnvironmentVariable>,
listeners: Listeners,
) -> Self {
ExternalService {
context,
id: id.to_string(),
action,
name: name.to_string(),
total_cpus,
total_ram_in_mib,
image,
environment_variables,
listeners,
}
}
}
impl crate::cloud_provider::service::ExternalService for ExternalService {}
impl crate::cloud_provider::service::Application for ExternalService {
fn image(&self) -> &Image {
&self.image
}
fn set_image(&mut self, image: Image) {
self.image = image;
}
}
impl Helm for ExternalService {
fn helm_release_name(&self) -> String {
crate::string::cut(format!("external-service-{}-{}", self.name(), self.id()), 50)
}
fn helm_chart_dir(&self) -> String {
format!("{}/common/services/q-job", self.context.lib_root_dir())
}
fn helm_chart_values_dir(&self) -> String {
String::new()
}
fn helm_chart_external_name_service_dir(&self) -> String {
String::new()
}
}
impl StatelessService for ExternalService {}
impl Service for ExternalService {
fn context(&self) -> &Context {
&self.context
}
fn service_type(&self) -> ServiceType {
ServiceType::ExternalService
}
fn id(&self) -> &str {
self.id.as_str()
}
fn name(&self) -> &str {
self.name.as_str()
}
fn sanitized_name(&self) -> String {
format!("ext-service-{}", self.name())
}
fn version(&self) -> &str {
self.image.commit_id.as_str()
}
fn action(&self) -> &Action {
&self.action
}
fn private_port(&self) -> Option<u16> {
None
}
fn start_timeout(&self) -> Timeout<u32> {
Timeout::Default
}
fn total_cpus(&self) -> String {
self.total_cpus.to_string()
}
fn cpu_burst(&self) -> String {
unimplemented!()
}
fn total_ram_in_mib(&self) -> u32 {
self.total_ram_in_mib
}
fn total_instances(&self) -> u16 {
1
}
fn tera_context(&self, target: &DeploymentTarget) -> Result<TeraContext, EngineError> {
let (kubernetes, environment) = match target {
DeploymentTarget::ManagedServices(k, env) => (*k, *env),
DeploymentTarget::SelfHosted(k, env) => (*k, *env),
};
let mut context = default_tera_context(self, kubernetes, environment);
let commit_id = self.image().commit_id.as_str();
context.insert("helm_app_version", &commit_id[..7]);
match &self.image().registry_url {
Some(registry_url) => context.insert("image_name_with_tag", registry_url.as_str()),
None => {
let image_name_with_tag = self.image().name_with_tag();
warn!(
"there is no registry url, use image name with tag with the default container registry: {}",
image_name_with_tag.as_str()
);
context.insert("image_name_with_tag", image_name_with_tag.as_str());
}
}
let environment_variables = self
.environment_variables
.iter()
.map(|ev| EnvironmentVariableDataTemplate {
key: ev.key.clone(),
value: ev.value.clone(),
})
.collect::<Vec<_>>();
context.insert("environment_variables", &environment_variables);
Ok(context)
}
fn selector(&self) -> String {
format!("app={}", self.sanitized_name())
}
fn engine_error_scope(&self) -> EngineErrorScope {
EngineErrorScope::ExternalService(self.id().to_string(), self.name().to_string())
}
}
impl Create for ExternalService {
fn on_create(&self, target: &DeploymentTarget) -> Result<(), EngineError> {
info!("AWS.external_service.on_create() called for {}", self.name());
send_progress_on_long_task(self, crate::cloud_provider::service::Action::Create, || {
deploy_user_stateless_service(target, self)
})
}
fn on_create_check(&self) -> Result<(), EngineError> {
Ok(())
}
fn on_create_error(&self, target: &DeploymentTarget) -> Result<(), EngineError> {
warn!("AWS.external_service.on_create_error() called for {}", self.name());
send_progress_on_long_task(self, crate::cloud_provider::service::Action::Create, || {
deploy_stateless_service_error(target, self)
})
}
}
impl Pause for ExternalService {
fn on_pause(&self, _target: &DeploymentTarget) -> Result<(), EngineError> {
info!(
"AWS.external_service.on_pause() called for {}, doing nothing",
self.name()
);
Ok(())
}
fn on_pause_check(&self) -> Result<(), EngineError> {
Ok(())
}
fn on_pause_error(&self, _target: &DeploymentTarget) -> Result<(), EngineError> {
warn!("AWS.external_service.on_pause_error() called for {}", self.name());
Ok(())
}
}
impl Delete for ExternalService {
fn on_delete(&self, target: &DeploymentTarget) -> Result<(), EngineError> {
info!("AWS.external_service.on_delete() called for {}", self.name());
send_progress_on_long_task(self, crate::cloud_provider::service::Action::Delete, || {
delete_stateless_service(target, self, false)
})
}
fn on_delete_check(&self) -> Result<(), EngineError> {
Ok(())
}
fn on_delete_error(&self, target: &DeploymentTarget) -> Result<(), EngineError> {
warn!("AWS.external_service.on_delete_error() called for {}", self.name());
send_progress_on_long_task(self, crate::cloud_provider::service::Action::Delete, || {
delete_stateless_service(target, self, true)
})
}
}
impl Listen for ExternalService {
fn listeners(&self) -> &Listeners {
&self.listeners
}
fn add_listener(&mut self, listener: Listener) {
self.listeners.push(listener);
}
}

View File

@@ -12,7 +12,6 @@ use crate::runtime::block_on;
pub mod application;
pub mod databases;
pub mod external_service;
pub mod kubernetes;
pub mod router;

View File

@@ -1,61 +0,0 @@
// use std::any::Any;
//
// use crate::cloud_provider::{CloudProvider, Kind, TerraformStateCredentials};
// use crate::error::EngineError;
// use crate::models::{Context, Listener};
//
// pub struct GCP {
// context: Context,
// id: String,
// name: String,
// p12_file_content: String,
// }
//
// impl GCP {
// pub fn new(context: Context, id: &str, name: &str, p12_file_content: &str) -> Self {
// GCP {
// context,
// id: id.to_string(),
// name: name.to_string(),
// p12_file_content: p12_file_content.to_string(),
// }
// }
// }
//
// impl<'x> CloudProvider for GCP {
// fn context(&self) -> &Context {
// &self.context
// }
//
// fn kind(&self) -> Kind {
// Kind::GCP
// }
//
// fn id(&self) -> &str {
// self.id.as_str()
// }
//
// fn organization_id(&self) -> &str {
// unimplemented!()
// }
//
// fn name(&self) -> &str {
// self.name.as_str()
// }
//
// fn is_valid(&self) -> Result<(), EngineError> {
// Ok(())
// }
//
// fn add_listener(&mut self, _listener: Listener) {
// // TODO
// }
//
// fn terraform_state_credentials(&self) -> &TerraformStateCredentials {
// unimplemented!()
// }
//
// fn as_any(&self) -> &dyn Any {
// self
// }
// }

View File

@@ -10,7 +10,6 @@ use crate::models::{Context, Listen};
pub mod aws;
pub mod digitalocean;
pub mod environment;
pub mod gcp;
pub mod helm;
pub mod kubernetes;
pub mod metrics;

View File

@@ -32,7 +32,6 @@ pub trait Service {
fn workspace_directory(&self) -> String {
let dir_root = match self.service_type() {
ServiceType::Application => "applications",
ServiceType::ExternalService => "external-services",
ServiceType::Database(_) => "databases",
ServiceType::Router => "routers",
};
@@ -101,7 +100,6 @@ pub trait Service {
match self.service_type() {
ServiceType::Application => ProgressScope::Application { id },
ServiceType::ExternalService => ProgressScope::ExternalService { id },
ServiceType::Database(_) => ProgressScope::Database { id },
ServiceType::Router => ProgressScope::Router { id },
}
@@ -135,8 +133,6 @@ pub trait Application: StatelessService {
fn set_image(&mut self, image: Image);
}
pub trait ExternalService: StatelessService {}
pub trait Router: StatelessService + Listen + Helm {
fn domains(&self) -> Vec<&str>;
fn has_custom_domains(&self) -> bool;
@@ -249,7 +245,6 @@ pub enum DatabaseType<'a> {
#[derive(Eq, PartialEq)]
pub enum ServiceType<'a> {
Application,
ExternalService,
Database(DatabaseType<'a>),
Router,
}
@@ -258,7 +253,6 @@ impl<'a> ServiceType<'a> {
pub fn name(&self) -> &str {
match self {
ServiceType::Application => "Application",
ServiceType::ExternalService => "ExternalService",
ServiceType::Database(db_type) => match db_type {
DatabaseType::PostgreSQL(_) => "PostgreSQL database",
DatabaseType::MongoDB(_) => "MongoDB database",

View File

@@ -43,7 +43,6 @@ pub enum EngineErrorScope {
Database(Id, Type, Name),
Application(Id, Name),
Router(Id, Name),
ExternalService(Id, Name),
}
#[derive(Debug)]

View File

@@ -15,7 +15,7 @@ use crate::cloud_provider::service::{DatabaseOptions, StatefulService, Stateless
use crate::cloud_provider::CloudProvider;
use crate::cloud_provider::Kind as CPKind;
use crate::git::Credentials;
use itertools::Itertools;
use std::collections::BTreeMap;
use std::sync::Arc;
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
@@ -39,7 +39,6 @@ pub struct Environment {
pub applications: Vec<Application>,
pub routers: Vec<Router>,
pub databases: Vec<Database>,
pub external_services: Vec<ExternalService>,
pub clone_from_environment_id: Option<String>,
}
@@ -54,17 +53,6 @@ impl Environment {
built_applications: &Vec<Box<dyn crate::cloud_provider::service::Application>>,
cloud_provider: &dyn CloudProvider,
) -> crate::cloud_provider::environment::Environment {
let external_services = self
.external_services
.iter()
.map(|x| match built_applications.iter().find(|y| x.id.as_str() == y.id()) {
Some(app) => x.to_stateless_service(context, app.image().clone(), cloud_provider),
_ => x.to_stateless_service(context, x.to_image(), cloud_provider),
})
.filter(|x| x.is_some())
.map(|x| x.unwrap())
.collect::<Vec<_>>();
let applications = self
.applications
.iter()
@@ -85,8 +73,7 @@ impl Environment {
.collect::<Vec<_>>();
// orders is important, first external services, then applications and then routers.
let mut stateless_services = external_services;
stateless_services.extend(applications);
let mut stateless_services = applications;
// routers are deployed lastly to avoid to be blacklisted if we request TLS certificates
// while an app does not start for some reason.
stateless_services.extend(routers);
@@ -166,7 +153,9 @@ pub struct Application {
pub total_instances: u16,
pub start_timeout_in_seconds: u32,
pub storage: Vec<Storage>,
pub environment_variables: Vec<EnvironmentVariable>,
// Key is a String, Value is a base64 encoded String
// Use BTreeMap to get Hash trait which is not available on HashMap
pub environment_vars: BTreeMap<String, String>,
}
impl Application {
@@ -176,13 +165,7 @@ impl Application {
image: &Image,
cloud_provider: &dyn CloudProvider,
) -> Option<Box<(dyn crate::cloud_provider::service::Application)>> {
let environment_variables = self
.environment_variables
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| ev.to_environment_variable())
.collect::<Vec<_>>();
let environment_variables = to_environment_variable(&self.environment_vars);
let listeners = cloud_provider.listeners().clone();
match cloud_provider.kind() {
@@ -247,13 +230,7 @@ impl Application {
image: Image,
cloud_provider: &dyn CloudProvider,
) -> Option<Box<dyn StatelessService>> {
let environment_variables = self
.environment_variables
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| ev.to_environment_variable())
.collect::<Vec<_>>();
let environment_variables = to_environment_variable(&self.environment_vars);
let listeners = cloud_provider.listeners().clone();
match cloud_provider.kind() {
@@ -322,7 +299,7 @@ impl Application {
// affect the build result even if user didn't change his code.
self.root_path.hash(&mut hasher);
self.dockerfile_path.hash(&mut hasher);
self.environment_variables.hash(&mut hasher);
self.environment_vars.hash(&mut hasher);
let mut tag = format!("{}-{}", hasher.finish(), self.commit_id);
tag.truncate(127);
@@ -354,12 +331,11 @@ impl Application {
image: self.to_image(),
options: BuildOptions {
environment_variables: self
.environment_variables
.environment_vars
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| crate::build_platform::EnvironmentVariable {
key: ev.key.clone(),
value: ev.value.clone(),
.map(|(k, v)| crate::build_platform::EnvironmentVariable {
key: k.clone(),
value: String::from_utf8_lossy(&base64::decode(v.as_bytes()).unwrap_or(vec![])).into_owned(),
})
.collect::<Vec<_>>(),
},
@@ -373,13 +349,16 @@ pub struct EnvironmentVariable {
pub value: String,
}
impl EnvironmentVariable {
pub fn to_environment_variable(&self) -> crate::cloud_provider::models::EnvironmentVariable {
crate::cloud_provider::models::EnvironmentVariable {
key: self.key.clone(),
value: self.value.clone(),
}
}
pub fn to_environment_variable(
env_vars: &BTreeMap<String, String>,
) -> Vec<crate::cloud_provider::models::EnvironmentVariable> {
env_vars
.iter()
.map(|(k, v)| crate::cloud_provider::models::EnvironmentVariable {
key: k.clone(),
value: v.clone(),
})
.collect()
}
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
@@ -829,136 +808,6 @@ pub enum DatabaseKind {
Redis,
}
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
pub struct ExternalService {
pub action: Action,
pub id: String,
pub name: String,
pub total_cpus: String,
pub total_ram_in_mib: u32,
pub git_url: String,
pub git_credentials: Option<GitCredentials>,
pub branch: String,
pub commit_id: String,
pub on_create_dockerfile_path: String,
pub on_pause_dockerfile_path: String,
pub on_delete_dockerfile_path: String,
pub environment_variables: Vec<EnvironmentVariable>,
}
impl ExternalService {
pub fn to_application<'a>(
&self,
context: &Context,
image: &Image,
cloud_provider: &dyn CloudProvider,
) -> Option<Box<(dyn crate::cloud_provider::service::Application)>> {
let environment_variables = self
.environment_variables
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| ev.to_environment_variable())
.collect::<Vec<_>>();
let listeners = cloud_provider.listeners().clone();
match cloud_provider.kind() {
CPKind::Aws => Some(Box::new(
crate::cloud_provider::aws::external_service::ExternalService::new(
context.clone(),
self.id.as_str(),
self.action.to_service_action(),
self.name.as_str(),
self.total_cpus.clone(),
self.total_ram_in_mib,
image.clone(),
environment_variables,
listeners,
),
)),
_ => None,
}
}
pub fn to_stateless_service<'a>(
&self,
context: &Context,
image: Image,
cloud_provider: &dyn CloudProvider,
) -> Option<Box<(dyn crate::cloud_provider::service::StatelessService)>> {
let environment_variables = self
.environment_variables
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| ev.to_environment_variable())
.collect::<Vec<_>>();
let listeners = cloud_provider.listeners().clone();
match cloud_provider.kind() {
CPKind::Aws => Some(Box::new(
crate::cloud_provider::aws::external_service::ExternalService::new(
context.clone(),
self.id.as_str(),
self.action.to_service_action(),
self.name.as_str(),
self.total_cpus.clone(),
self.total_ram_in_mib,
image,
environment_variables,
listeners,
),
)),
_ => None,
}
}
pub fn to_image(&self) -> Image {
Image {
application_id: self.id.clone(),
name: self.name.clone(),
tag: self.commit_id.clone(),
commit_id: self.commit_id.clone(),
registry_name: None,
registry_secret: None,
registry_url: None,
registry_docker_json_config: None,
}
}
pub fn to_build(&self) -> Build {
Build {
git_repository: GitRepository {
url: self.git_url.clone(),
credentials: self.git_credentials.as_ref().map(|credentials| Credentials {
login: credentials.login.clone(),
password: credentials.access_token.clone(),
}),
commit_id: self.commit_id.clone(),
dockerfile_path: Some(match self.action {
Action::Create => self.on_create_dockerfile_path.clone(),
Action::Pause => self.on_pause_dockerfile_path.clone(),
Action::Delete => self.on_delete_dockerfile_path.clone(),
Action::Nothing => self.on_create_dockerfile_path.clone(),
}),
root_path: default_root_path_value(),
},
image: self.to_image(),
options: BuildOptions {
environment_variables: self
.environment_variables
.iter()
.sorted_by_key(|x| &x.key)
.map(|ev| crate::build_platform::EnvironmentVariable {
key: ev.key.clone(),
value: ev.value.clone(),
})
.collect::<Vec<_>>(),
},
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum EnvironmentError {}
@@ -996,7 +845,6 @@ pub enum ProgressScope {
Infrastructure { execution_id: String },
Database { id: String },
Application { id: String },
ExternalService { id: String },
Router { id: String },
Environment { id: String },
}

View File

@@ -138,28 +138,6 @@ impl<'a> Transaction<'a> {
environment: &Environment,
option: &DeploymentOption,
) -> Result<Vec<Box<dyn Application>>, EngineError> {
let external_services_to_build = environment
.external_services
.iter()
// build only applications that are set with Action: Create
.filter(|es| es.action == Action::Create);
let external_service_and_result_tuples = external_services_to_build
.map(|es| {
let image = es.to_image();
let build_result = if option.force_build || !self.engine.container_registry().does_image_exists(&image)
{
// only if the build is forced OR if the image does not exist in the registry
self.engine.build_platform().build(es.to_build(), option.force_build)
} else {
// use the cache
Ok(BuildResult::new(es.to_build()))
};
(es, build_result)
})
.collect::<Vec<_>>();
// do the same for applications
let apps_to_build = environment
.applications
@@ -184,31 +162,6 @@ impl<'a> Transaction<'a> {
.collect::<Vec<_>>();
let mut applications: Vec<Box<dyn Application>> = Vec::with_capacity(application_and_result_tuples.len());
for (external_service, result) in external_service_and_result_tuples {
// catch build error, can't do it in Fn
let build_result = match result {
Err(err) => {
error!(
"build error for external_service {}: {:?}",
external_service.id.as_str(),
err
);
return Err(err);
}
Ok(build_result) => build_result,
};
match external_service.to_application(
self.engine.context(),
&build_result.build.image,
self.engine.cloud_provider(),
) {
Some(app) => applications.push(app),
None => {}
}
}
for (application, result) in application_and_result_tuples {
// catch build error, can't do it in Fn
let build_result = match result {
@@ -327,11 +280,7 @@ impl<'a> Transaction<'a> {
environment_action: &EnvironmentAction,
) -> Result<(), RollbackError> {
let qe_environment = |environment: &Environment| {
let mut _applications = Vec::with_capacity(
// ExternalService impl Application (which is a StatelessService)
environment.applications.len() + environment.external_services.len(),
);
let mut _applications = Vec::with_capacity(environment.applications.len());
for application in environment.applications.iter() {
let build = application.to_build();
@@ -342,16 +291,6 @@ impl<'a> Transaction<'a> {
}
}
for external_service in environment.external_services.iter() {
let build = external_service.to_build();
if let Some(x) =
external_service.to_application(self.engine.context(), &build.image, self.engine.cloud_provider())
{
_applications.push(x)
}
}
let qe_environment =
environment.to_qe_environment(self.engine.context(), &_applications, self.engine.cloud_provider());

View File

@@ -2740,9 +2740,9 @@ dependencies = [
[[package]]
name = "scaleway_api_rs"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ef902879597f20dc6319fe7203d05c98066a48301ec9d383f23b483c881f95"
checksum = "d20620dd2a8b440dcd2b6777c75c845217115ce69f0c1a9575cb9f7af1e7b49d"
dependencies = [
"reqwest 0.11.3",
"serde",
@@ -3167,6 +3167,7 @@ dependencies = [
"dirs",
"gethostname",
"hashicorp_vault",
"maplit",
"qovery-engine",
"rand 0.7.3",
"reqwest 0.10.8",

View File

@@ -24,6 +24,7 @@ tracing-subscriber = "0.2"
retry = "1.0.0"
time = "0.2.23"
hashicorp_vault = "2.0.1"
maplit = "1.0.2"
# Digital Ocean Deps
digitalocean = "0.1.1"

View File

@@ -5,11 +5,13 @@ use chrono::Utc;
use qovery_engine::cloud_provider::utilities::sanitize_name;
use qovery_engine::models::{
Action, Application, Context, Database, DatabaseKind, Environment, EnvironmentVariable, GitCredentials, Kind,
Route, Router, Storage, StorageType,
Action, Application, Context, Database, DatabaseKind, Environment, GitCredentials, Kind, Route, Router, Storage,
StorageType,
};
use crate::utilities::generate_id;
use base64;
use std::collections::BTreeMap;
pub fn execution_id() -> String {
Utc::now()
@@ -90,28 +92,13 @@ pub fn environment_3_apps_3_routers_3_databases(
mount_point: "/mnt/photos".to_string(),
snapshot_retention_in_days: 0,
}],
environment_variables: vec![
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_name.clone(),
},
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: fqdn.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
],
environment_vars: btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_name.clone()),
"PG_HOST".to_string() => base64::encode(fqdn.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
},
branch: "master".to_string(),
private_port: Some(1234),
total_cpus: "100m".to_string(),
@@ -141,28 +128,13 @@ pub fn environment_3_apps_3_routers_3_databases(
mount_point: "/mnt/photos".to_string(),
snapshot_retention_in_days: 0,
}],
environment_variables: vec![
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_name_2.clone(),
},
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: fqdn_2.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username_2.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
],
environment_vars: btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_name.clone()),
"PG_HOST".to_string() => base64::encode(fqdn.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
},
branch: "master".to_string(),
private_port: Some(1234),
total_cpus: "100m".to_string(),
@@ -192,36 +164,15 @@ pub fn environment_3_apps_3_routers_3_databases(
mount_point: "/mnt/photos".to_string(),
snapshot_retention_in_days: 0,
}],
environment_variables: vec![
EnvironmentVariable {
key: "IS_DOCUMENTDB".to_string(),
value: "false".to_string(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string(),
value: database_host_mongo.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string(),
value: database_uri_mongo.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string(),
value: database_port_mongo.clone().to_string(),
},
EnvironmentVariable {
key: "MONGODB_DBNAME".to_string(),
value: database_db_name_mongo.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string(),
value: database_username_mongo.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string(),
value: database_password_mongo.clone(),
},
],
environment_vars: btreemap! {
"IS_DOCUMENTDB".to_string() => base64::encode("false"),
"QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string() => base64::encode(database_host_mongo.clone()),
"QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string() => base64::encode(database_uri_mongo.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string() => base64::encode(database_port_mongo.to_string()),
"MONGODB_DBNAME".to_string() => base64::encode(&database_db_name_mongo.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string() => base64::encode(database_username_mongo.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string() => base64::encode(database_password_mongo.clone()),
},
branch: "master".to_string(),
private_port: Some(1234),
total_cpus: "100m".to_string(),
@@ -322,7 +273,6 @@ pub fn environment_3_apps_3_routers_3_databases(
database_disk_type: database_disk_type.to_string(),
},
],
external_services: vec![],
clone_from_environment_id: None,
}
}
@@ -351,7 +301,7 @@ pub fn working_minimal_environment(context: &Context, organization_id: &str, tes
expired_at: Utc::now(),
}),
storage: vec![],
environment_variables: vec![],
environment_vars: BTreeMap::default(),
branch: "basic-app-deploy".to_string(),
private_port: Some(80),
total_cpus: "100m".to_string(),
@@ -373,7 +323,6 @@ pub fn working_minimal_environment(context: &Context, organization_id: &str, tes
}],
}],
databases: vec![],
external_services: vec![],
clone_from_environment_id: None,
}
}
@@ -444,28 +393,13 @@ pub fn environnement_2_app_2_routers_1_psql(
mount_point: "/mnt/photos".to_string(),
snapshot_retention_in_days: 0,
}],
environment_variables: vec![
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_name.clone(),
},
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: fqdn.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
],
environment_vars: btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_name.clone()),
"PG_HOST".to_string() => base64::encode(fqdn.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
},
branch: "master".to_string(),
private_port: Some(1234),
total_cpus: "100m".to_string(),
@@ -495,28 +429,13 @@ pub fn environnement_2_app_2_routers_1_psql(
mount_point: "/mnt/photos".to_string(),
snapshot_retention_in_days: 0,
}],
environment_variables: vec![
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_name.clone(),
},
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: fqdn.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
],
environment_vars: btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_name.clone()),
"PG_HOST".to_string() => base64::encode(fqdn.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
},
branch: "master".to_string(),
private_port: Some(1234),
total_cpus: "100m".to_string(),
@@ -552,8 +471,6 @@ pub fn environnement_2_app_2_routers_1_psql(
}],
},
],
external_services: vec![],
clone_from_environment_id: None,
}
}
@@ -602,10 +519,9 @@ pub fn echo_app_environment(context: &Context, organization_id: &str, test_domai
expired_at: Utc::now(),
}),
storage: vec![],
environment_variables: vec![EnvironmentVariable {
key: "ECHO_TEXT".to_string(),
value: "42".to_string(),
}],
environment_vars: btreemap! {
"ECHO_TEXT".to_string() => base64::encode("42"),
},
branch: "echo-app".to_string(),
private_port: Some(5678),
total_cpus: "100m".to_string(),
@@ -627,7 +543,6 @@ pub fn echo_app_environment(context: &Context, organization_id: &str, test_domai
}],
}],
databases: vec![],
external_services: vec![],
clone_from_environment_id: None,
}
}
@@ -657,7 +572,7 @@ pub fn environment_only_http_server(context: &Context, organization_id: &str) ->
expired_at: Utc::now(),
}),
storage: vec![],
environment_variables: vec![],
environment_vars: BTreeMap::default(),
branch: "mini-http".to_string(),
private_port: Some(3000),
total_cpus: "100m".to_string(),
@@ -668,7 +583,6 @@ pub fn environment_only_http_server(context: &Context, organization_id: &str) ->
}],
routers: vec![],
databases: vec![],
external_services: vec![],
clone_from_environment_id: None,
}
}
@@ -698,7 +612,7 @@ pub fn environment_only_http_server_router(context: &Context, organization_id: &
expired_at: Utc::now(),
}),
storage: vec![],
environment_variables: vec![],
environment_vars: BTreeMap::default(),
branch: "mini-http".to_string(),
private_port: Some(3000),
total_cpus: "100m".to_string(),
@@ -720,7 +634,6 @@ pub fn environment_only_http_server_router(context: &Context, organization_id: &
}],
}],
databases: vec![],
external_services: vec![],
clone_from_environment_id: None,
}
}

View File

@@ -1,3 +1,6 @@
#[macro_use]
extern crate maplit;
pub mod aws;
pub mod cloudflare;
pub mod common;

View File

@@ -2,9 +2,7 @@ extern crate test_utilities;
use ::function_name::named;
use qovery_engine::cloud_provider::Kind as ProviderKind;
use qovery_engine::models::{
Action, Clone2, Context, Database, DatabaseKind, Environment, EnvironmentAction, EnvironmentVariable, Kind,
};
use qovery_engine::models::{Action, Clone2, Context, Database, DatabaseKind, Environment, EnvironmentAction, Kind};
use qovery_engine::transaction::TransactionResult;
use test_utilities::utilities::{init, FuncTestsSecrets};
use tracing::{span, Level};
@@ -361,28 +359,13 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
app.branch = app_name.clone();
app.commit_id = "5990752647af11ef21c3d46a51abbde3da1ab351".to_string();
app.private_port = Some(1234);
app.environment_variables = vec![
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"PG_HOST".to_string() => base64::encode(database_host.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -487,28 +470,13 @@ fn test_postgresql_configuration(
app.commit_id = "ad65b24a0470e7e8aa0983e036fb9a05928fd973".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"PG_HOST".to_string() => base64::encode(database_host.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -711,44 +679,15 @@ fn test_mongodb_configuration(
app.commit_id = "3fdc7e784c1d98b80446be7ff25e35370306d9a8".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
// EnvironmentVariable {
// key: "ENABLE_DEBUG".to_string(),
// value: "true".to_string(),
// },
// EnvironmentVariable {
// key: "DEBUG_PAUSE".to_string(),
// value: "true".to_string(),
// },
EnvironmentVariable {
key: "IS_DOCUMENTDB".to_string(),
value: is_documentdb.to_string(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string(),
value: database_uri.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "MONGODB_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"IS_DOCUMENTDB".to_string() => base64::encode(is_documentdb.to_string()),
"QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string() => base64::encode(database_host.clone()),
"QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string() => base64::encode(database_uri.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string() => base64::encode(database_port.to_string()),
"MONGODB_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string() => base64::encode(database_username.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -948,36 +887,13 @@ fn test_mysql_configuration(
app.commit_id = "fc8a87b39cdee84bb789893fb823e3e62a1999c0".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
// EnvironmentVariable {
// key: "ENABLE_DEBUG".to_string(),
// value: "true".to_string(),
// },
// EnvironmentVariable {
// key: "DEBUG_PAUSE".to_string(),
// value: "true".to_string(),
// },
EnvironmentVariable {
key: "MYSQL_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "MYSQL_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "MYSQL_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "MYSQL_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "MYSQL_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"MYSQL_HOST".to_string() => base64::encode(database_host.clone()),
"MYSQL_PORT".to_string() => base64::encode(database_port.to_string()),
"MYSQL_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"MYSQL_USERNAME".to_string() => base64::encode(database_username.clone()),
"MYSQL_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -1141,36 +1057,13 @@ fn test_redis_configuration(
app.commit_id = "80ad41fbe9549f8de8dbe2ca4dd5d23e8ffc92de".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
// EnvironmentVariable {
// key: "ENABLE_DEBUG".to_string(),
// value: "true".to_string(),
// },
// EnvironmentVariable {
// key: "DEBUG_PAUSE".to_string(),
// value: "true".to_string(),
// },
EnvironmentVariable {
key: "IS_ELASTICCACHE".to_string(),
value: is_elasticache.to_string(),
},
EnvironmentVariable {
key: "REDIS_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "REDIS_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "REDIS_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "REDIS_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"IS_ELASTICCACHE".to_string() => base64::encode(is_elasticache.to_string()),
"REDIS_HOST".to_string() => base64::encode(database_host.clone()),
"REDIS_PORT".to_string() => base64::encode(database_port.clone().to_string()),
"REDIS_USERNAME".to_string() => base64::encode(database_username.clone()),
"REDIS_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();

View File

@@ -5,8 +5,9 @@ use self::test_utilities::cloudflare::dns_provider_cloudflare;
use self::test_utilities::utilities::{engine_run_test, generate_id, get_pods, is_pod_restarted_env, FuncTestsSecrets};
use ::function_name::named;
use qovery_engine::cloud_provider::Kind;
use qovery_engine::models::{Action, Clone2, Context, EnvironmentAction, EnvironmentVariable, Storage, StorageType};
use qovery_engine::models::{Action, Clone2, Context, EnvironmentAction, Storage, StorageType};
use qovery_engine::transaction::{DeploymentOption, TransactionResult};
use std::collections::BTreeMap;
use test_utilities::utilities::context;
use test_utilities::utilities::init;
use tracing::{span, Level};
@@ -704,7 +705,7 @@ fn deploy_a_not_working_environment_and_after_working_environment() {
app.git_url = "https://github.com/Qovery/engine-testing.git".to_string();
app.branch = "1app_fail_deploy".to_string();
app.commit_id = "5b89305b9ae8a62a1f16c5c773cddf1d12f70db1".to_string();
app.environment_variables = vec![];
app.environment_vars = BTreeMap::default();
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -772,7 +773,7 @@ fn deploy_ok_fail_fail_ok_environment() {
app.git_url = "https://gitlab.com/maathor/my-exit-container".to_string();
app.branch = "master".to_string();
app.commit_id = "55bc95a23fbf91a7699c28c5f61722d4f48201c9".to_string();
app.environment_variables = vec![];
app.environment_vars = BTreeMap::default();
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -969,10 +970,9 @@ fn deploy_2_non_working_environments_with_2_working_failovers_on_aws_eks() {
.applications
.into_iter()
.map(|mut app| {
app.environment_variables = vec![EnvironmentVariable {
key: "ECHO_TEXT".to_string(),
value: "Lilou".to_string(),
}];
app.environment_vars = btreemap! {
"ECHO_TEXT".to_string() => base64::encode("Lilou".to_string())
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();

View File

@@ -1,3 +1,5 @@
#[macro_use]
extern crate maplit;
mod aws;
mod digitalocean;
mod scaleway;

View File

@@ -3,8 +3,7 @@ use tracing::{span, warn, Level};
use qovery_engine::cloud_provider::Kind as ProviderKind;
use qovery_engine::models::{
Action, Application, Clone2, Context, Database, DatabaseKind, Environment, EnvironmentAction, EnvironmentVariable,
Kind,
Action, Application, Clone2, Context, Database, DatabaseKind, Environment, EnvironmentAction, Kind,
};
use qovery_engine::transaction::TransactionResult;
use test_utilities::utilities::{
@@ -383,28 +382,13 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
app.branch = app_name.clone();
app.commit_id = "5990752647af11ef21c3d46a51abbde3da1ab351".to_string();
app.private_port = Some(1234);
app.environment_variables = vec![
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"PG_HOST".to_string() => base64::encode(database_host.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -518,28 +502,13 @@ fn test_postgresql_configuration(
app.commit_id = "ad65b24a0470e7e8aa0983e036fb9a05928fd973".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
EnvironmentVariable {
key: "PG_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "PG_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "PG_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "PG_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "PG_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"PG_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"PG_HOST".to_string() => base64::encode(database_host.clone()),
"PG_PORT".to_string() => base64::encode(database_port.to_string()),
"PG_USERNAME".to_string() => base64::encode(database_username.clone()),
"PG_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -691,32 +660,14 @@ fn test_mongodb_configuration(
app.commit_id = "3fdc7e784c1d98b80446be7ff25e35370306d9a8".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string(),
value: database_uri.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "MONGODB_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string() => base64::encode(database_host.clone()),
"QOVERY_DATABASE_MY_DDB_CONNECTION_URI".to_string() => base64::encode(database_uri.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PORT".to_string() => base64::encode(database_port.to_string()),
"MONGODB_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_USERNAME".to_string() => base64::encode(database_username.clone()),
"QOVERY_DATABASE_TESTING_DATABASE_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<Application>>();
@@ -887,36 +838,13 @@ fn test_mysql_configuration(
app.commit_id = "fc8a87b39cdee84bb789893fb823e3e62a1999c0".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
// EnvironmentVariable {
// key: "ENABLE_DEBUG".to_string(),
// value: "true".to_string(),
// },
// EnvironmentVariable {
// key: "DEBUG_PAUSE".to_string(),
// value: "true".to_string(),
// },
EnvironmentVariable {
key: "MYSQL_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "MYSQL_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "MYSQL_DBNAME".to_string(),
value: database_db_name.clone(),
},
EnvironmentVariable {
key: "MYSQL_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "MYSQL_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"MYSQL_HOST".to_string() => base64::encode(database_host.clone()),
"MYSQL_PORT".to_string() => base64::encode(database_port.to_string()),
"MYSQL_DBNAME".to_string() => base64::encode(database_db_name.clone()),
"MYSQL_USERNAME".to_string() => base64::encode(database_username.clone()),
"MYSQL_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -1052,36 +980,13 @@ fn test_redis_configuration(
app.commit_id = "80ad41fbe9549f8de8dbe2ca4dd5d23e8ffc92de".to_string();
app.private_port = Some(1234);
app.dockerfile_path = Some(format!("Dockerfile-{}", version));
app.environment_variables = vec![
// EnvironmentVariable {
// key: "ENABLE_DEBUG".to_string(),
// value: "true".to_string(),
// },
// EnvironmentVariable {
// key: "DEBUG_PAUSE".to_string(),
// value: "true".to_string(),
// },
EnvironmentVariable {
key: "IS_ELASTICCACHE".to_string(),
value: is_elasticache.to_string(),
},
EnvironmentVariable {
key: "REDIS_HOST".to_string(),
value: database_host.clone(),
},
EnvironmentVariable {
key: "REDIS_PORT".to_string(),
value: database_port.clone().to_string(),
},
EnvironmentVariable {
key: "REDIS_USERNAME".to_string(),
value: database_username.clone(),
},
EnvironmentVariable {
key: "REDIS_PASSWORD".to_string(),
value: database_password.clone(),
},
];
app.environment_vars = btreemap! {
"IS_ELASTICCACHE".to_string() => base64::encode(is_elasticache.to_string()),
"REDIS_HOST".to_string() => base64::encode(database_host.clone()),
"REDIS_PORT".to_string() => base64::encode(database_port.clone().to_string()),
"REDIS_USERNAME".to_string() => base64::encode(database_username.clone()),
"REDIS_PASSWORD".to_string() => base64::encode(database_password.clone()),
};
app
})
.collect::<Vec<qovery_engine::models::Application>>();

View File

@@ -11,6 +11,7 @@ use ::function_name::named;
use qovery_engine::cloud_provider::Kind;
use qovery_engine::models::{Action, Clone2, EnvironmentAction, Storage, StorageType};
use qovery_engine::transaction::TransactionResult;
use std::collections::BTreeMap;
use test_utilities::utilities::context;
use tracing::{span, warn, Level};
@@ -509,7 +510,7 @@ fn scaleway_kapsule_deploy_a_not_working_environment_and_then_working_environmen
app.git_url = "https://github.com/Qovery/engine-testing.git".to_string();
app.branch = "1app_fail_deploy".to_string();
app.commit_id = "5b89305b9ae8a62a1f16c5c773cddf1d12f70db1".to_string();
app.environment_variables = vec![];
app.environment_vars = BTreeMap::default();
app
})
.collect::<Vec<qovery_engine::models::Application>>();
@@ -581,7 +582,7 @@ fn scaleway_kapsule_deploy_ok_fail_fail_ok_environment() {
app.git_url = "https://gitlab.com/maathor/my-exit-container".to_string();
app.branch = "master".to_string();
app.commit_id = "55bc95a23fbf91a7699c28c5f61722d4f48201c9".to_string();
app.environment_variables = vec![];
app.environment_vars = BTreeMap::default();
app
})
.collect::<Vec<qovery_engine::models::Application>>();