Skip to content

Commit

Permalink
fix: deploy requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
4e6 committed Nov 8, 2024
1 parent 3141945 commit fec9a76
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 2 additions & 0 deletions build/build/src/ci_gen/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ pub struct DeployYdocPolyglot;
impl JobArchetype for DeployYdocPolyglot {
fn job(&self, target: Target) -> Job {
ecr_deploy_steps_builder("release deploy-ydoc-polyglot")
.cleaning(RELEASE_CLEANING_POLICY)
.build_job("Upload polyglot Ydoc to ECR", target)
}
}
Expand All @@ -472,6 +473,7 @@ pub struct DeployYdocNodejs;
impl JobArchetype for DeployYdocNodejs {
fn job(&self, target: Target) -> Job {
ecr_deploy_steps_builder("release deploy-ydoc-nodejs")
.cleaning(RELEASE_CLEANING_POLICY)
.build_job("Upload Node.js Ydoc to ECR", target)
}
}
Expand Down
3 changes: 3 additions & 0 deletions build/build/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ pub struct BuildConfigurationFlags {
pub build_engine_package: bool,
/// Build the NI Engine Runner.
pub build_native_runner: bool,
/// Build the Ydoc Native Image
pub build_native_ydoc: bool,
/// Build the experimental Espresso+NI Engine Runner.
pub build_espresso_runner: bool,
pub build_launcher_package: bool,
Expand Down Expand Up @@ -306,6 +308,7 @@ impl Default for BuildConfigurationFlags {
build_engine_package: false,
build_launcher_package: false,
build_native_runner: false,
build_native_ydoc: false,
build_espresso_runner: false,
build_project_manager_package: false,
build_launcher_bundle: false,
Expand Down
3 changes: 3 additions & 0 deletions build/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ impl RunContext {
if self.config.build_native_runner {
tasks.push("engine-runner/buildNativeImage");
}
if self.config.build_native_ydoc {
tasks.push("ydoc-server/buildNativeImage");
}
if self.config.build_project_manager_package() {
tasks.push("buildProjectManagerDistribution");
}
Expand Down
15 changes: 2 additions & 13 deletions build/build/src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::prelude::*;

use crate::changelog::Changelog;
use crate::context::BuildContext;
use crate::engine;
use crate::env::ENSO_ADMIN_TOKEN;
use crate::paths::generated;
use crate::paths::TargetTriple;
Expand All @@ -17,7 +16,6 @@ use crate::version::Versions;
use ide_ci::github;
use ide_ci::io::web::handle_error_response;
use ide_ci::programs::Docker;
use ide_ci::programs::Pnpm;
use ide_ci::programs::SevenZip;
use octocrab::models::repos::Release;
use octocrab::params::repos::Reference;
Expand Down Expand Up @@ -295,15 +293,9 @@ pub async fn deploy_runtime_to_ecr(context: &BuildContext, repository: String) -
///
/// Builds the polyglot Ydoc image and pushes it to our ECR.
pub async fn deploy_ydoc_polyglot_to_ecr(context: &BuildContext, repository: String) -> Result {
let sbt = engine::sbt::Context {
repo_root: context.repo_root.path.clone(),
system_properties: default(),
};
sbt.call_arg("ydoc-server/buildNativeImage").await?;
let client = crate::aws::ecr::client_from_env().await;
let repository_uri = crate::aws::ecr::get_repository_uri(&client, &repository).await?;
let tag_name = repository_uri.replace("/runtime", "/ydoc-polyglot");
let tag = format!("{}:{}", tag_name, context.triple.versions.version);
let tag = format!("{}/{}:{}", repository_uri, "ydoc-polyglot", context.triple.versions.version);
// We don't care about the image ID, we will refer to it by the tag.
let _image_id = generate_ydoc_polyglot_image(context, &tag).await?;
let credentials = crate::aws::ecr::get_credentials(&client).await?;
Expand All @@ -315,12 +307,9 @@ pub async fn deploy_ydoc_polyglot_to_ecr(context: &BuildContext, repository: Str
///
/// Builds the Node.js Ydoc image and pushes it to our ECR.
pub async fn deploy_ydoc_nodejs_to_ecr(context: &BuildContext, repository: String) -> Result {
Pnpm.cmd()?.install().run_ok().await?;
Pnpm.cmd()?.run("-r").arg("compile").run_ok().await?;
let client = crate::aws::ecr::client_from_env().await;
let repository_uri = crate::aws::ecr::get_repository_uri(&client, &repository).await?;
let tag_name = repository_uri.replace("/runtime", "/ydoc-nodejs");
let tag = format!("{}:{}", tag_name, context.triple.versions.version);
let tag = format!("{}/{}:{}", repository_uri, "ydoc-nodejs", context.triple.versions.version);
// We don't care about the image ID, we will refer to it by the tag.
let _image_id = generate_ydoc_nodejs_image(context, &tag).await?;
let credentials = crate::aws::ecr::get_credentials(&client).await?;
Expand Down
15 changes: 15 additions & 0 deletions build/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ use ide_ci::programs::git;
use ide_ci::programs::git::clean;
use ide_ci::programs::rustc;
use ide_ci::programs::Cargo;
use ide_ci::programs::Pnpm;
use octocrab::models::ReleaseId;
use std::time::Duration;
use tokio::process::Child;
Expand Down Expand Up @@ -786,10 +787,24 @@ pub async fn main_internal(config: Option<Config>) -> Result {
.await?;
}
Action::DeployYdocPolyglot(args) => {
let config = enso_build::engine::BuildConfigurationFlags {
build_native_ydoc: true,
..default()
};
let backend_context = ctx.prepare_backend_context(config).await?;
backend_context.build().await?;

enso_build::release::deploy_ydoc_polyglot_to_ecr(&ctx, args.ecr_repository).await?;
// TODO: dispatch cloud workflow
}
Action::DeployYdocNodejs(args) => {
enso_build::web::install(&ctx.repo_root).await?;
Pnpm.cmd()?
.with_current_dir(&ctx.repo_root)
.run("-r")
.arg("compile")
.run_ok()
.await?;
enso_build::release::deploy_ydoc_nodejs_to_ecr(&ctx, args.ecr_repository).await?;
// TODO: dispatch cloud workflow
}
Expand Down

0 comments on commit fec9a76

Please sign in to comment.