From d037abc793f0090c63fc5f8a402bc77c762f9524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Wed, 29 Sep 2021 14:40:34 +0200 Subject: [PATCH] Add buildpack language support --- src/build_platform/local_docker.rs | 4 ++++ src/build_platform/mod.rs | 1 + src/models.rs | 2 ++ test_utilities/src/common.rs | 9 +++++++++ 4 files changed, 16 insertions(+) diff --git a/src/build_platform/local_docker.rs b/src/build_platform/local_docker.rs index fbf1e6c2..c13b4a22 100644 --- a/src/build_platform/local_docker.rs +++ b/src/build_platform/local_docker.rs @@ -195,6 +195,10 @@ impl LocalDocker { buildpacks_args.push("-B"); buildpacks_args.push(builder_name); + if let Some(buildpack_language) = &build.git_repository.buildpack_language { + buildpacks_args.push("-b"); + buildpacks_args.push(buildpack_language.as_str()); + } // Just a fallback for now to help our bot loving users deploy their apps // Long term solution requires lots of changes in UI and Core as well diff --git a/src/build_platform/mod.rs b/src/build_platform/mod.rs index dd2e8c23..0d23275e 100644 --- a/src/build_platform/mod.rs +++ b/src/build_platform/mod.rs @@ -51,6 +51,7 @@ pub struct GitRepository { pub commit_id: String, pub dockerfile_path: Option, pub root_path: String, + pub buildpack_language: Option, } #[derive(Clone, Eq, PartialEq, Hash, Debug)] diff --git a/src/models.rs b/src/models.rs index 7013dbe7..a9b56c16 100644 --- a/src/models.rs +++ b/src/models.rs @@ -144,6 +144,7 @@ pub struct Application { pub branch: String, pub commit_id: String, pub dockerfile_path: Option, + pub buildpack_language: Option, #[serde(default = "default_root_path_value")] pub root_path: String, pub private_port: Option, @@ -327,6 +328,7 @@ impl Application { commit_id: self.commit_id.clone(), dockerfile_path: self.dockerfile_path.clone(), root_path: self.root_path.clone(), + buildpack_language: self.buildpack_language.clone(), }, image: self.to_image(), options: BuildOptions { diff --git a/test_utilities/src/common.rs b/test_utilities/src/common.rs index 1c18ebae..fcec1e21 100644 --- a/test_utilities/src/common.rs +++ b/test_utilities/src/common.rs @@ -77,6 +77,7 @@ pub fn environment_3_apps_3_routers_3_databases( git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: "/".to_string(), action: Action::Create, git_credentials: Some(GitCredentials { @@ -113,6 +114,7 @@ pub fn environment_3_apps_3_routers_3_databases( git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -149,6 +151,7 @@ pub fn environment_3_apps_3_routers_3_databases( git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "158ea8ebc9897c50a7c56b910db33ce837ac1e61".to_string(), dockerfile_path: Some(format!("Dockerfile-{}", version_mongo)), + buildpack_language: None, action: Action::Create, root_path: String::from("/"), git_credentials: Some(GitCredentials { @@ -293,6 +296,7 @@ pub fn working_minimal_environment(context: &Context, organization_id: &str, tes git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "fc575a2f3be0b9100492c8a463bf18134a8698a5".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -378,6 +382,7 @@ pub fn environnement_2_app_2_routers_1_psql( git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -414,6 +419,7 @@ pub fn environnement_2_app_2_routers_1_psql( git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -511,6 +517,7 @@ pub fn echo_app_environment(context: &Context, organization_id: &str, test_domai git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "2205adea1db295547b99f7b17229afd7e879b6ff".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -564,6 +571,7 @@ pub fn environment_only_http_server(context: &Context, organization_id: &str) -> git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "a873edd459c97beb51453db056c40bca85f36ef9".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials { @@ -604,6 +612,7 @@ pub fn environment_only_http_server_router(context: &Context, organization_id: & git_url: "https://github.com/Qovery/engine-testing.git".to_string(), commit_id: "a873edd459c97beb51453db056c40bca85f36ef9".to_string(), dockerfile_path: Some("Dockerfile".to_string()), + buildpack_language: None, root_path: String::from("/"), action: Action::Create, git_credentials: Some(GitCredentials {