Skip to content

Commit 8971492

Browse files
authored
feat: publish env to project from cloud editing instance (#9369)
* feat: publish env to project from cloud editing instance * Fix PushEnv restarting project * Push env on cloud only
1 parent a73cd90 commit 8971492

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

web-admin/src/routes/[organization]/[project]/-/edit/+layout.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,10 @@
8686
let starting = false;
8787
8888
$: isLoading =
89-
$projectQuery.isLoading ||
90-
$user.isLoading ||
89+
$projectQuery.isPending ||
90+
$user.isPending ||
9191
starting ||
92-
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_PENDING ||
93-
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_UPDATING;
92+
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_PENDING;
9493
9594
$: isErrored =
9695
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_ERRORED;
@@ -101,7 +100,8 @@
101100
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_STOPPING);
102101
103102
$: isReady =
104-
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_RUNNING &&
103+
(deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_RUNNING ||
104+
deploymentStatus === V1DeploymentStatus.DEPLOYMENT_STATUS_UPDATING) &&
105105
runtimeHost !== null &&
106106
instanceId !== null &&
107107
jwt !== null &&

web-common/src/features/add-data/manager/steps/connector.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
getRuntimeServiceGetResourceQueryKey,
66
runtimeServiceDeleteFile,
77
runtimeServiceGetFile,
8+
runtimeServicePushEnv,
89
runtimeServicePutFile,
910
runtimeServiceUnpackEmpty,
1011
type V1ConnectorDriver,
@@ -50,6 +51,7 @@ import {
5051
getProjectParserVersion,
5152
waitForProjectParserVersion,
5253
} from "@rilldata/web-common/features/entity-management/project-parser.ts";
54+
import { getRuntimeEditEnvironment } from "@rilldata/web-common/features/entity-management/edit-environment.ts";
5355

5456
export async function createConnector({
5557
runtimeClient,
@@ -150,12 +152,18 @@ export async function createConnector({
150152
}),
151153
)?.resource?.meta?.stateVersion;
152154

153-
await runtimeServicePutFile(runtimeClient, {
154-
path: ".env",
155-
blob: newEnvBlob,
156-
create: true,
157-
createOnly: false,
158-
});
155+
if (existingEnvBlob !== newEnvBlob) {
156+
await runtimeServicePutFile(runtimeClient, {
157+
path: ".env",
158+
blob: newEnvBlob,
159+
create: true,
160+
createOnly: false,
161+
});
162+
if (getRuntimeEditEnvironment() === "cloud") {
163+
// Only push env on cloud for now. We will revisit this for rill-dev.
164+
await runtimeServicePushEnv(runtimeClient, {});
165+
}
166+
}
159167

160168
await runtimeServicePutFile(runtimeClient, {
161169
path: newConnectorFilePath,

web-common/src/features/add-data/manager/steps/import.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
runtimeServiceGenerateCanvasFile,
1313
runtimeServiceGenerateMetricsViewFile,
1414
runtimeServiceGetInstance,
15+
runtimeServicePushEnv,
1516
runtimeServicePutFile,
1617
} from "@rilldata/web-common/runtime-client";
1718
import {
@@ -37,6 +38,7 @@ import { unsetResourceEnvVars } from "@rilldata/web-common/features/connectors/c
3738
import { maybeGetConnectorDriver } from "@rilldata/web-common/features/add-data/manager/steps/utils.ts";
3839
import { behaviourEvent } from "@rilldata/web-common/metrics/initMetrics.ts";
3940
import { BehaviourEventAction } from "@rilldata/web-common/metrics/service/BehaviourEventTypes.ts";
41+
import { getRuntimeEditEnvironment } from "@rilldata/web-common/features/entity-management/edit-environment.ts";
4042

4143
export async function runImportSteps(
4244
runtimeClient: RuntimeClient,
@@ -248,6 +250,10 @@ async function runCreateModelStep(
248250
create: true,
249251
createOnly: false,
250252
});
253+
if (getRuntimeEditEnvironment() === "cloud") {
254+
// Only push env on cloud for now. We will revisit this for rill-dev.
255+
await runtimeServicePushEnv(runtimeClient, {});
256+
}
251257
}
252258

253259
let putFile = true;

0 commit comments

Comments
 (0)