Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GIT_V_VERSION=${{ steps.semantic.outputs.new_release_version }}
GIT_V_VERSION=${{ needs.release.outputs.version }}

publish_arm:
needs:
Expand Down Expand Up @@ -103,6 +103,8 @@ jobs:
platforms: linux/${{ env.arch }}
tags: ${{ steps.meta.outputs.tags }}
no-cache: true
build-args: |
GIT_V_VERSION=${{ needs.release.outputs.version }}

merge_manifest:
needs: [release, publish_x86, publish_arm]
Expand Down
14 changes: 11 additions & 3 deletions crates/base/src/deno_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use deno_tls::rustls::RootCertStore;
use deno_tls::RootCertStoreProvider;
use futures_util::future::poll_fn;
use log::{error, trace};
use once_cell::sync::OnceCell;
use sb_core::conn_sync::ConnSync;
use sb_core::util::sync::AtomicFlag;
use serde::de::DeserializeOwned;
Expand Down Expand Up @@ -78,6 +79,8 @@ fn get_error_class_name(e: &AnyError) -> &'static str {
sb_core::errors_rt::get_error_class_name(e).unwrap_or("Error")
}

pub static MAYBE_DENO_VERSION: OnceCell<String> = OnceCell::new();

pub struct DenoRuntime {
pub js_runtime: JsRuntime,
pub env_vars: HashMap<String, String>, // TODO: does this need to be pub?
Expand Down Expand Up @@ -303,11 +306,16 @@ impl DenoRuntime {

// Bootstrapping stage
let script = format!(
"globalThis.bootstrapSBEdge({}, {}, {}, '{}')",
// opts, isUserWorker, isEventsWorker, edgeRuntimeVersion, denoVersion
"globalThis.bootstrapSBEdge({}, {}, {}, '{}', '{}')",
deno_core::serde_json::json!({ "target": env!("TARGET") }),
conf.is_user_worker(),
conf.is_events_worker(),
version.unwrap_or("0.1.0")
version.unwrap_or("0.1.0"),
MAYBE_DENO_VERSION
.get()
.map(|it| &**it)
.unwrap_or("UNKNOWN")
);

js_runtime
Expand Down Expand Up @@ -903,7 +911,7 @@ mod test {
.to_vec();
assert_eq!(
deno_version_array.first().unwrap().as_str().unwrap(),
"supabase-edge-runtime-0.1.0"
"supabase-edge-runtime-0.1.0 (compatible with Deno vUNKNOWN)"
);
assert_eq!(
deno_version_array.get(1).unwrap().as_str().unwrap(),
Expand Down
3 changes: 3 additions & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod logger;

use anyhow::{anyhow, bail, Error};
use base::commands::start_server;
use base::deno_runtime::MAYBE_DENO_VERSION;
use base::rt_worker::worker_pool::{SupervisorPolicy, WorkerPoolPolicy};
use base::server::WorkerEntrypoints;
use clap::builder::{FalseyValueParser, TypedValueParser};
Expand Down Expand Up @@ -102,6 +103,8 @@ fn cli() -> Command {
//}

fn main() -> Result<(), anyhow::Error> {
MAYBE_DENO_VERSION.get_or_init(|| env!("DENO_VERSION").to_string());

let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
Expand Down
7 changes: 4 additions & 3 deletions crates/sb_core/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const deleteDenoApis = (apis) => {
});
};

globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, version) => {
globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, edgeRuntimeVersion, denoVersion) => {
// We should delete this after initialization,
// Deleting it during bootstrapping can backfire
delete globalThis.__bootstrap;
Expand All @@ -255,7 +255,8 @@ globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, version) => {
...opts,
});

ObjectDefineProperty(globalThis, 'SUPABASE_VERSION', readOnly(String(version)));
ObjectDefineProperty(globalThis, 'SUPABASE_VERSION', readOnly(String(edgeRuntimeVersion)));
ObjectDefineProperty(globalThis, 'DENO_VERSION', readOnly(denoVersion))

// set these overrides after runtimeStart
ObjectDefineProperties(denoOverrides, {
Expand All @@ -265,7 +266,7 @@ globalThis.bootstrapSBEdge = (opts, isUserWorker, isEventsWorker, version) => {
args: readOnly([]), // args are set to be empty
mainModule: getterOnly(() => ops.op_main_module()),
version: getterOnly(() => ({
deno: `supabase-edge-runtime-${globalThis.SUPABASE_VERSION}`,
deno: `supabase-edge-runtime-${globalThis.SUPABASE_VERSION} (compatible with Deno v${globalThis.DENO_VERSION})`,
v8: '11.6.189.12',
typescript: '5.1.6',
})),
Expand Down