Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Romaric Philogene
2020-11-15 16:40:04 +01:00
28 changed files with 1206 additions and 3060 deletions

View File

@@ -255,7 +255,7 @@ impl BuildPlatform for LocalDocker {
return Err(self.engine_error(
EngineErrorCause::User(
"It looks like your Dockerfile is wrong. Did you consider building \
your container locally using `qovery run` or `docker build`?",
your container locally using `qovery run` or `docker build --no-cache`?",
),
format!(
"error while building container image {}. Error: {:?}",

View File

@@ -186,6 +186,13 @@ impl<'a> EKS<'a> {
.map(|x| format!("{}", x.clone().to_string()))
.collect();
let managed_dns_resolvers_terraform_format = terraform_list_format(managed_dns_resolvers);
let test_cluster = match self.context.metadata() {
Some(meta) => match meta.test {
Some(true) => true,
_ => false,
},
_ => false,
};
let mut context = TeraContext::new();
// Qovery
@@ -199,6 +206,7 @@ impl<'a> EKS<'a> {
"agent_version_controller_token",
&self.options.agent_version_controller_token,
);
context.insert("test_cluster", &test_cluster);
// DNS configuration
context.insert("managed_dns", &managed_dns_list);
@@ -226,12 +234,9 @@ impl<'a> EKS<'a> {
context.insert("dns_email_report", &self.options.tls_email_report); // Pierre suggested renaming to tls_email_report
// TLS
let lets_encrypt_url = match self.context.metadata() {
Some(meta) => match meta.test {
Some(true) => "https://acme-staging-v02.api.letsencrypt.org/directory",
_ => "https://acme-v02.api.letsencrypt.org/directory",
},
_ => "https://acme-v02.api.letsencrypt.org/directory",
let lets_encrypt_url = match &test_cluster {
true => "https://acme-staging-v02.api.letsencrypt.org/directory",
false => "https://acme-v02.api.letsencrypt.org/directory",
};
context.insert("acme_server_url", lets_encrypt_url);

View File

@@ -67,7 +67,7 @@ pub fn terraform_exec_with_init_validate_plan_apply(
terraform_exec_with_init_validate_plan(root_dir, first_time_init_terraform);
// terraform apply
if dry_run {
if !dry_run {
terraform_exec(root_dir, vec!["apply", "-auto-approve", "tf_plan"])?;
}

View File

@@ -497,6 +497,37 @@ impl<'a> Transaction<'a> {
let applications = apps_result.ok().unwrap();
applications_by_environment.insert(target_environment, applications);
// build as well the failover environment, retention could remove the application image
match environment_action {
EnvironmentAction::EnvironmentWithFailover(_, fe) => {
let apps_result = match self._build_applications(fe, option) {
Ok(applications) => {
match self._push_applications(applications, option) {
Ok(results) => {
let applications = results
.into_iter()
.map(|(app, _)| app)
.collect::<Vec<_>>();
Ok(applications)
}
Err(err) => Err(err),
}
}
Err(err) => Err(err),
};
if apps_result.is_err() {
// should never be triggered because core always should ask for working failover environment
let commit_error = apps_result.err().unwrap();
error!(
"An error occurred on failover application {:?}",
commit_error
);
}
}
_ => {}
};
}
Step::DeployEnvironment(kubernetes, environment_action) => {
// deploy complete environment