mirror of
https://github.com/enso-org/enso.git
synced 2025-01-03 05:42:44 +03:00
Cloud fixes (#4114)
This PR aims to fix current issues with cloud IDE. 1. Backend image: * bumping the system version to avoid glibc version mismatch on parser; * explicitly installing required GraalVM components; 2. Frontend upload: * update to follow the new file naming; * uploading the whole shaders subtree.
This commit is contained in:
parent
29582b7ee1
commit
b8a4a70f10
@ -46,10 +46,12 @@
|
||||
dist/:
|
||||
gui/:
|
||||
assets/:
|
||||
ide.wasm:
|
||||
shaders/: # Optimized shaders that contain main function code only.
|
||||
pkg.js: # The `pks.js` artifact of wasm-pack WITH bundled snippets.
|
||||
pkg.js.map: # The sourcemap mapping to `pkg.js` generated by wasm-pack.
|
||||
pkg-opt.wasm: # The optimized WASM artifact.
|
||||
index.js:
|
||||
style.css:
|
||||
wasm_imports.js:
|
||||
|
||||
# Final WASM artifacts in `dist` directory.
|
||||
wasm/:
|
||||
|
@ -30,3 +30,31 @@ pub async fn build_runtime_image(
|
||||
let id = Docker.build(opts).await?;
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::repo::deduce_repository_path;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Convenience test that builds the Runtime image.
|
||||
///
|
||||
/// The engine must be already built.
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_name() -> Result {
|
||||
setup_logging()?;
|
||||
let tag = "test_runtime_image";
|
||||
info!("Current directory: {}", ide_ci::env::current_dir()?.display());
|
||||
let root = deduce_repository_path()?;
|
||||
let root = root.absolutize()?;
|
||||
info!("Repository root: {}", root.display());
|
||||
let engine_package = generated::EnginePackage::new_root(
|
||||
root.join("built-distribution/enso-engine-2023.1.1-dev-linux-amd64/enso-2023.1.1-dev"),
|
||||
);
|
||||
let dockerfile = generated::RepoRootToolsCiDocker::new_root(root.join("tools/ci/docker"));
|
||||
let id = build_runtime_image(dockerfile, engine_package, tag.to_string()).await?;
|
||||
info!("Built image: {}", id);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ use aws_sdk_s3::types::ByteStream;
|
||||
use bytes::Buf;
|
||||
use enso_build_base::extensions::path::SplitFilename;
|
||||
use mime::Mime;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
|
||||
// ==============
|
||||
@ -84,10 +85,46 @@ impl BucketContext {
|
||||
pub async fn put_file(&self, path: impl AsRef<Path>) -> Result<PutObjectOutput> {
|
||||
let path = path.as_ref();
|
||||
let stream = ByteStream::from_path(path).await?;
|
||||
let path = path.file_name().with_context(|| format!("Path {:?} has no file name", path))?;
|
||||
let path = path.try_file_name()?;
|
||||
self.put(path.as_str(), stream).await
|
||||
}
|
||||
|
||||
/// Put the file at `path` to the S3 bucket. The key will be suffixed with the relative path
|
||||
/// between `root` and `path`.
|
||||
#[instrument(fields(path = %path.as_ref().display(), root = %root.as_ref().display()))]
|
||||
pub async fn put_subtree_file(
|
||||
&self,
|
||||
root: impl AsRef<Path>,
|
||||
path: impl AsRef<Path>,
|
||||
) -> Result<PutObjectOutput> {
|
||||
let root = root.as_ref().absolutize()?;
|
||||
let path = path.as_ref().absolutize()?;
|
||||
let key_suffix = path.strip_prefix(&root).with_context(|| {
|
||||
format!("{} is not a subpath of {}.", root.display(), path.display())
|
||||
})?;
|
||||
let stream = ByteStream::from_path(&path).await?;
|
||||
self.put(key_suffix.as_str(), stream).await
|
||||
}
|
||||
|
||||
/// Put an item to the S3 bucket.
|
||||
///
|
||||
/// If the path is a file, it will be uploaded as is. If it is a directory, it will be uploaded
|
||||
/// as a subtree.
|
||||
pub async fn put_item(&self, path: impl AsRef<Path>) -> Result {
|
||||
if ide_ci::fs::tokio::metadata(path.as_ref()).await?.is_dir() {
|
||||
let parent = path.try_parent()?;
|
||||
for entry in WalkDir::new(&path) {
|
||||
let entry = entry?;
|
||||
if entry.file_type().is_file() {
|
||||
self.put_subtree_file(&parent, &entry.path()).await?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.put_file(path).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_yaml<T: DeserializeOwned>(&self, path: &str) -> Result<T> {
|
||||
let text = self.get(path).await?.collect().await?;
|
||||
serde_yaml::from_reader(text.reader()).anyhow_err()
|
||||
|
@ -281,13 +281,14 @@ pub async fn upload_gui_to_cloud(
|
||||
let bucket = crate::aws::s3::gui::context(version).await?;
|
||||
|
||||
// Some file we upload as-is, some gzipped. This seems somewhat arbitrary now.
|
||||
let files_to_upload = [assets.ide_wasm.as_path(), assets.style_css.as_path()];
|
||||
let files_to_upload_gzipped = [assets.index_js.as_path(), assets.wasm_imports_js.as_path()];
|
||||
|
||||
let files_to_upload =
|
||||
[assets.pkg_opt_wasm.as_path(), assets.style_css.as_path(), assets.shaders.as_path()];
|
||||
let files_to_upload_gzipped = [assets.index_js.as_path(), assets.pkg_js.as_path()];
|
||||
|
||||
for file in files_to_upload.iter() {
|
||||
bucket.put_file(file).await?;
|
||||
bucket.put_item(file).await?;
|
||||
}
|
||||
|
||||
put_files_gzipping(&bucket, &files_to_upload_gzipped).await?;
|
||||
|
||||
Ok(())
|
||||
@ -360,7 +361,7 @@ mod tests {
|
||||
let assets = crate::paths::generated::RepoRootDistGuiAssets::new_root(
|
||||
r"H:\NBO\enso4\dist\gui\assets",
|
||||
);
|
||||
let version = "2022.1.1-dev.provisional.test.2".parse2()?;
|
||||
let version = "2023.1.1-dev.cloud.test".parse2()?;
|
||||
upload_gui_to_cloud(&assets, &version).await?;
|
||||
notify_cloud_about_gui(&version).await?;
|
||||
Ok(())
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/graalvm/graalvm-ce:ol7-java11-22.3.0
|
||||
FROM ghcr.io/graalvm/graalvm-ce:ol9-java11-22.3.0
|
||||
|
||||
USER root
|
||||
|
||||
@ -30,6 +30,7 @@ ENV ENSO_RUNTIME_DIRECTORY=/opt/enso/work
|
||||
ENV ENSO_LOG_DIRECTORY=/opt/enso/logs
|
||||
ENV ENSO_HOME=/volumes/workspace/home
|
||||
|
||||
RUN gu install js python r
|
||||
RUN chown -hR ensodev:ensodev /opt/enso
|
||||
RUN chmod -R u=rX,g=rX /opt/enso
|
||||
RUN chmod a+x /opt/enso/bin/*
|
||||
|
Loading…
Reference in New Issue
Block a user