Skip to content

Commit

Permalink
Move cors-proxy of sandboxes during cluster transition (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
caponetto committed Sep 30, 2022
1 parent 5c4f1e2 commit f9741df
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/daily_dev_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
DMN_DEV_SANDBOX__baseImageTag: "daily-dev"
DMN_DEV_SANDBOX__baseImageBuildTags: "daily-dev"
DMN_DEV_SANDBOX__onlineEditorUrl: "https://kiegroup.github.io/kogito-online/dev"
ONLINE_EDITOR__corsProxyUrl: "https://daily-dev-cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
ONLINE_EDITOR__corsProxyUrl: "https://cors.isomorphic-git.org"

KIE_SANDBOX__imageRegistry: "quay.io"
KIE_SANDBOX__imageAccount: "kie-tools"
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageName: "openjdk11-mvn-image"
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageTag: "daily-dev"
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageBuildTags: "daily-dev"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://daily-dev-cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://cors.isomorphic-git.org"

steps:
- name: "Support longpaths (Windows only)"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ jobs:
ONLINE_EDITOR__kieSandboxExtendedServicesDownloadUrlWindows: "https://github.com/kiegroup/kie-tools/releases/download/${{ inputs.tag }}/kie_sandbox_extended_services_windows_${{ inputs.tag }}.exe"
ONLINE_EDITOR__kieSandboxExtendedServicesCompatibleVersion: "${{ inputs.tag }}"
ONLINE_EDITOR__gtmId: "GTM-PQGMKNW"
ONLINE_EDITOR__corsProxyUrl: "https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
ONLINE_EDITOR__corsProxyUrl: "https://cors.isomorphic-git.org"
DMN_DEV_SANDBOX__baseImageRegistry: "quay.io"
DMN_DEV_SANDBOX__baseImageAccount: "kie-tools"
DMN_DEV_SANDBOX__baseImageName: "dmn-dev-sandbox-deployment-base-image"
Expand Down Expand Up @@ -1341,7 +1341,7 @@ jobs:
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageAccount: "kie-tools"
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageName: "openjdk11-mvn-image"
SERVERLESS_LOGIC_SANDBOX__openJdk11MvnImageTag: "${{ inputs.tag }}"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://cors.isomorphic-git.org"

if: ${{ always() && needs.extract_runners.outputs.serverless_logic_sandbox == 'true' && (needs.extended_services.result == 'success' || needs.extended_services.result == 'skipped') && (needs.serverless_logic_sandbox_base_image.result == 'success' || needs.serverless_logic_sandbox_base_image.result == 'skipped') && (needs.openjdk11_mvn_image.result == 'success' || needs.openjdk11_mvn_image.result == 'skipped') }}
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ jobs:
ONLINE_EDITOR__kieSandboxExtendedServicesDownloadUrlWindows: "${{ inputs.download_asset_url }}/STAGING__kie_sandbox_extended_services_windows_${{ inputs.tag }}.exe"
ONLINE_EDITOR__kieSandboxExtendedServicesCompatibleVersion: "${{ inputs.tag }}"
ONLINE_EDITOR__gtmId: ""
ONLINE_EDITOR__corsProxyUrl: "https://staging-cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
ONLINE_EDITOR__corsProxyUrl: "https://cors.isomorphic-git.org"
DMN_DEV_SANDBOX__gtmId: ""
DMN_DEV_SANDBOX__onlineEditorUrl: "https://kiegroup.github.io/kogito-online-staging/${{ inputs.tag }}-prerelease"
SERVERLESS_LOGIC_SANDBOX__buildInfo: "${{ inputs.tag }} (staging) @ ${{ inputs.commit_sha }}"
SERVERLESS_LOGIC_SANDBOX__kieSandboxExtendedServicesDownloadUrlLinux: "${{ inputs.download_asset_url }}/STAGING__kie_sandbox_extended_services_linux_${{ inputs.tag }}.tar.gz"
SERVERLESS_LOGIC_SANDBOX__kieSandboxExtendedServicesDownloadUrlMacOs: "${{ inputs.download_asset_url }}/STAGING__kie_sandbox_extended_services_macos_${{ inputs.tag }}.dmg"
SERVERLESS_LOGIC_SANDBOX__kieSandboxExtendedServicesDownloadUrlWindows: "${{ inputs.download_asset_url }}/STAGING__kie_sandbox_extended_services_windows_${{ inputs.tag }}.exe"
SERVERLESS_LOGIC_SANDBOX__kieSandboxExtendedServicesCompatibleVersion: "${{ inputs.tag }}"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://staging-cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud"
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: "https://cors.isomorphic-git.org"
run: |
pnpm -r build:prod
Expand Down
8 changes: 4 additions & 4 deletions packages/kie-sandbox-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ Runtime environment variables can be passed to the containerized KIE Sandbox.

Currently, the following environment variables are supported:

| Name | Description | Default |
| :---------------------------------: | :-------------------------------------------------------------------: | --------------------------------------------------------------------------------------------------------------------- |
| `KIE_SANDBOX_EXTENDED_SERVICES_URL` | The URL that points to the KIE Sandbox Extended Services | http://localhost:21345 |
| `CORS_PROXY_URL` | The URL that points to the cors-proxy for the interaction with GitHub | https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud |
| Name | Description | Default |
| :---------------------------------: | :-------------------------------------------------------------------: | ------------------------------- |
| `KIE_SANDBOX_EXTENDED_SERVICES_URL` | The URL that points to the KIE Sandbox Extended Services | http://localhost:21345 |
| `CORS_PROXY_URL` | The URL that points to the cors-proxy for the interaction with GitHub | https://cors.isomorphic-git.org |

There are three options to set custom values. Check out the examples below.

Expand Down
3 changes: 1 addition & 2 deletions packages/online-editor/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ module.exports = composeEnv(
description: "",
},
ONLINE_EDITOR__corsProxyUrl: {
default:
"https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud",
default: "https://cors.isomorphic-git.org",
description: "",
},
DMN_DEV_SANDBOX__baseImageTag: {
Expand Down
5 changes: 1 addition & 4 deletions packages/online-editor/src/env/EnvContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ export type EnvVars = Record<EnvVarNames, string>;

export const DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_HOST = "http://localhost";
export const DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_PORT = "21345";
export const DEFAULT_CORS_PROXY_URL =
process.env.WEBPACK_REPLACE__corsProxyUrl ??
"https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud";

export const DEFAULT_ENV_VARS: EnvVars = {
KIE_SANDBOX_EXTENDED_SERVICES_URL: `${DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_HOST}:${DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_PORT}`,
CORS_PROXY_URL: DEFAULT_CORS_PROXY_URL,
CORS_PROXY_URL: process.env.WEBPACK_REPLACE__corsProxyUrl ?? "",
};

export interface EnvContextType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { WorkspaceDescriptorService } from "./services/WorkspaceDescriptorServic
import { WorkspaceFsService } from "./services/WorkspaceFsService";
import { GistOrigin, GitHubOrigin, WorkspaceKind, WorkspaceOrigin } from "./model/WorkspaceOrigin";
import { WorkspaceSvgService } from "./services/WorkspaceSvgService";
import { DEFAULT_CORS_PROXY_URL, useEnv } from "../env/EnvContext";
import { DEFAULT_ENV_VARS, useEnv } from "../env/EnvContext";

const MAX_NEW_FILE_INDEX_ATTEMPTS = 10;
const NEW_FILE_DEFAULT_NAME = "Untitled";
Expand All @@ -62,7 +62,7 @@ export function WorkspacesContextProvider(props: Props) {
);

const gitService = useMemo(() => {
let envUrl = DEFAULT_CORS_PROXY_URL;
let envUrl = DEFAULT_ENV_VARS.CORS_PROXY_URL;
if (envUrl !== env.vars.CORS_PROXY_URL) {
try {
new URL(env.vars.CORS_PROXY_URL);
Expand Down
3 changes: 1 addition & 2 deletions packages/serverless-logic-sandbox/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ module.exports = composeEnv(
description: "",
},
SERVERLESS_LOGIC_SANDBOX__corsProxyUrl: {
default:
"https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud",
default: "https://cors.isomorphic-git.org",
description: "",
},
}),
Expand Down
5 changes: 1 addition & 4 deletions packages/serverless-logic-sandbox/src/env/EnvContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ export type EnvVars = Record<EnvVarNames, string>;

export const DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_HOST = "http://localhost";
export const DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_PORT = "21345";
export const DEFAULT_CORS_PROXY_URL =
process.env.WEBPACK_REPLACE__corsProxyUrl ??
"https://cors-proxy-kie-sandbox.rhba-cluster-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud";

export const DEFAULT_ENV_VARS: EnvVars = {
KIE_SANDBOX_EXTENDED_SERVICES_URL: `${DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_HOST}:${DEFAULT_KIE_SANDBOX_EXTENDED_SERVICES_PORT}`,
CORS_PROXY_URL: DEFAULT_CORS_PROXY_URL,
CORS_PROXY_URL: process.env.WEBPACK_REPLACE__corsProxyUrl ?? "",
};

export interface EnvContextType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { WorkspaceDescriptorService } from "./services/WorkspaceDescriptorServic
import { WorkspaceFsService } from "./services/WorkspaceFsService";
import { GistOrigin, GitHubOrigin, WorkspaceKind, WorkspaceOrigin } from "./model/WorkspaceOrigin";
import { WorkspaceSvgService } from "./services/WorkspaceSvgService";
import { DEFAULT_CORS_PROXY_URL } from "../env/EnvContext";
import { DEFAULT_ENV_VARS } from "../env/EnvContext";
import { isModel, SupportedFileExtensions } from "../extension";
import { useSettings } from "../settings/SettingsContext";
import { decoder, encoder } from "./commonServices/BaseFile";
Expand Down Expand Up @@ -63,7 +63,7 @@ export function WorkspacesContextProvider(props: Props) {
);

const gitService = useMemo(() => {
return new GitService(DEFAULT_CORS_PROXY_URL);
return new GitService(DEFAULT_ENV_VARS.CORS_PROXY_URL);
}, []);

const getAbsolutePath = useCallback(
Expand Down

0 comments on commit f9741df

Please sign in to comment.