Skip to content

Commit 6f6f5da

Browse files
committed
[werft] add with-dedicated-emulation switch
1 parent 081248f commit 6f6f5da

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

.werft/jobs/build/deploy-to-preview-environment.ts

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export async function deployToPreviewEnvironment(werft: Werft, jobConfig: JobCon
103103
withEELicense: deploymentConfig.installEELicense,
104104
workspaceFeatureFlags: workspaceFeatureFlags,
105105
withSlowDatabase: jobConfig.withSlowDatabase,
106+
withDedicatedEmulation: jobConfig.withDedicatedEmulation,
106107
});
107108
try {
108109
werft.log(installerSlices.INSTALL, "deploying using installer");

.werft/jobs/build/installer/installer.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type InstallerOptions = {
1111
withEELicense: boolean;
1212
workspaceFeatureFlags: string[];
1313
withSlowDatabase: boolean;
14+
withDedicatedEmulation: boolean;
1415
};
1516

1617
export class Installer {
@@ -31,6 +32,7 @@ export class Installer {
3132
GITPOD_WORKSPACE_FEATURE_FLAGS: this.options.workspaceFeatureFlags.join(" "),
3233
GITPOD_WITH_SLOW_DATABASE: this.options.withSlowDatabase,
3334
GITPOD_WITH_EE_LICENSE: this.options.withEELicense,
35+
GITPOD_WITH_DEDICATED_EMU: this.options.withDedicatedEmulation,
3436
};
3537
const variables = Object.entries(environment)
3638
.map(([key, value]) => `${key}="${value}"`)

.werft/jobs/build/job-config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface JobConfig {
3434
withObservability: boolean;
3535
withLocalPreview: boolean;
3636
withSlowDatabase: boolean;
37+
withDedicatedEmulation: boolean;
3738
workspaceFeatureFlags: string[];
3839
previewEnvironment: PreviewEnvironmentConfig;
3940
repository: Repository;
@@ -107,6 +108,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
107108
const recreatePreview = "recreate-preview" in buildConfig
108109
const recreateVm = mainBuild || "recreate-vm" in buildConfig;
109110
const withSlowDatabase = "with-slow-database" in buildConfig && !mainBuild;
111+
const withDedicatedEmulation = "with-dedicated-emulation" in buildConfig && !mainBuild;
110112
const storageClass = buildConfig["storage-class"] || "";
111113

112114
const analytics = parseAnalytics(werft, sliceId, buildConfig["analytics"])
@@ -183,6 +185,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
183185
recreateVm,
184186
withSlowDatabase,
185187
withGitHubActions,
188+
withDedicatedEmulation,
186189
};
187190

188191
werft.logOutput(sliceId, JSON.stringify(jobConfig, null, 2));

dev/preview/workflow/preview/deploy-gitpod.sh

+24-18
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ GITPOD_ANALYTICS="${GITPOD_ANALYTICS:-}"
2929
GITPOD_WITH_EE_LICENSE="${GITPOD_WITH_EE_LICENSE:-true}"
3030
GITPOD_WORKSPACE_FEATURE_FLAGS="${GITPOD_WORKSPACE_FEATURE_FLAGS:-}"
3131
GITPOD_WITH_SLOW_DATABASE="${GITPOD_WITH_SLOW_DATABASE:-false}"
32+
GITPOD_WITH_DEDICATED_EMU="${GITPOD_WITH_DEDICATED_EMU:-false}"
3233

3334
if [[ "${VERSION:-}" == "" ]]; then
3435
if [[ ! -f /tmp/local-dev-version ]]; then
@@ -333,24 +334,29 @@ yq w -i "${INSTALLER_CONFIG_PATH}" observability.tracing.endpoint "${TRACING_END
333334
#
334335
# configureAuthProviders
335336
#
336-
for row in $(kubectl --kubeconfig "$DEV_KUBE_PATH" --context "${DEV_KUBE_CONTEXT}" get secret preview-envs-authproviders-harvester --namespace=keys -o jsonpath="{.data.authProviders}" \
337-
| base64 -d -w 0 \
338-
| yq r - authProviders -j \
339-
| jq -r 'to_entries | .[] | @base64'); do
340-
key=$(echo "${row}" | base64 -d | jq -r '.key')
341-
providerId=$(echo "$row" | base64 -d | jq -r '.value.id | ascii_downcase')
342-
data=$(echo "$row" | base64 -d | yq r - value --prettyPrint)
343-
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].kind "secret"
344-
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].name "$providerId"
345-
346-
kubectl create secret generic "$providerId" \
347-
--namespace "${PREVIEW_NAMESPACE}" \
348-
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
349-
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
350-
--from-literal=provider="$data" \
351-
--dry-run=client -o yaml | \
352-
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" replace --force -f -
353-
done
337+
338+
if [[ "${GITPOD_WITH_DEDICATED_EMU}" != "true" ]]
339+
then
340+
for row in $(kubectl --kubeconfig "$DEV_KUBE_PATH" --context "${DEV_KUBE_CONTEXT}" get secret preview-envs-authproviders-harvester --namespace=keys -o jsonpath="{.data.authProviders}" \
341+
| base64 -d -w 0 \
342+
| yq r - authProviders -j \
343+
| jq -r 'to_entries | .[] | @base64'); do
344+
key=$(echo "${row}" | base64 -d | jq -r '.key')
345+
providerId=$(echo "$row" | base64 -d | jq -r '.value.id | ascii_downcase')
346+
data=$(echo "$row" | base64 -d | yq r - value --prettyPrint)
347+
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].kind "secret"
348+
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].name "$providerId"
349+
350+
kubectl create secret generic "$providerId" \
351+
--namespace "${PREVIEW_NAMESPACE}" \
352+
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
353+
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
354+
--from-literal=provider="$data" \
355+
--dry-run=client -o yaml | \
356+
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" replace --force -f -
357+
done
358+
fi
359+
354360

355361
#
356362
# configureStripeAPIKeys

0 commit comments

Comments
 (0)