Skip to content

[werft] add with-dedicated-emulation switch #15587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2023
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
1 change: 1 addition & 0 deletions .werft/jobs/build/deploy-to-preview-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export async function deployToPreviewEnvironment(werft: Werft, jobConfig: JobCon
withEELicense: deploymentConfig.installEELicense,
workspaceFeatureFlags: workspaceFeatureFlags,
withSlowDatabase: jobConfig.withSlowDatabase,
withDedicatedEmulation: jobConfig.withDedicatedEmulation,
});
try {
werft.log(installerSlices.INSTALL, "deploying using installer");
Expand Down
2 changes: 2 additions & 0 deletions .werft/jobs/build/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type InstallerOptions = {
withEELicense: boolean;
workspaceFeatureFlags: string[];
withSlowDatabase: boolean;
withDedicatedEmulation: boolean;
};

export class Installer {
Expand All @@ -31,6 +32,7 @@ export class Installer {
GITPOD_WORKSPACE_FEATURE_FLAGS: this.options.workspaceFeatureFlags.join(" "),
GITPOD_WITH_SLOW_DATABASE: this.options.withSlowDatabase,
GITPOD_WITH_EE_LICENSE: this.options.withEELicense,
GITPOD_WITH_DEDICATED_EMU: this.options.withDedicatedEmulation,
};
const variables = Object.entries(environment)
.map(([key, value]) => `${key}="${value}"`)
Expand Down
3 changes: 3 additions & 0 deletions .werft/jobs/build/job-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface JobConfig {
withObservability: boolean;
withLocalPreview: boolean;
withSlowDatabase: boolean;
withDedicatedEmulation: boolean;
workspaceFeatureFlags: string[];
previewEnvironment: PreviewEnvironmentConfig;
repository: Repository;
Expand Down Expand Up @@ -107,6 +108,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
const recreatePreview = "recreate-preview" in buildConfig
const recreateVm = mainBuild || "recreate-vm" in buildConfig;
const withSlowDatabase = "with-slow-database" in buildConfig && !mainBuild;
const withDedicatedEmulation = "with-dedicated-emulation" in buildConfig && !mainBuild;
const storageClass = buildConfig["storage-class"] || "";

const analytics = parseAnalytics(werft, sliceId, buildConfig["analytics"])
Expand Down Expand Up @@ -183,6 +185,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
recreateVm,
withSlowDatabase,
withGitHubActions,
withDedicatedEmulation,
};

werft.logOutput(sliceId, JSON.stringify(jobConfig, null, 2));
Expand Down
42 changes: 24 additions & 18 deletions dev/preview/workflow/preview/deploy-gitpod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GITPOD_ANALYTICS="${GITPOD_ANALYTICS:-}"
GITPOD_WITH_EE_LICENSE="${GITPOD_WITH_EE_LICENSE:-true}"
GITPOD_WORKSPACE_FEATURE_FLAGS="${GITPOD_WORKSPACE_FEATURE_FLAGS:-}"
GITPOD_WITH_SLOW_DATABASE="${GITPOD_WITH_SLOW_DATABASE:-false}"
GITPOD_WITH_DEDICATED_EMU="${GITPOD_WITH_DEDICATED_EMU:-false}"

if [[ "${VERSION:-}" == "" ]]; then
if [[ ! -f /tmp/local-dev-version ]]; then
Expand Down Expand Up @@ -333,24 +334,29 @@ yq w -i "${INSTALLER_CONFIG_PATH}" observability.tracing.endpoint "${TRACING_END
#
# configureAuthProviders
#
for row in $(kubectl --kubeconfig "$DEV_KUBE_PATH" --context "${DEV_KUBE_CONTEXT}" get secret preview-envs-authproviders-harvester --namespace=keys -o jsonpath="{.data.authProviders}" \
| base64 -d -w 0 \
| yq r - authProviders -j \
| jq -r 'to_entries | .[] | @base64'); do
key=$(echo "${row}" | base64 -d | jq -r '.key')
providerId=$(echo "$row" | base64 -d | jq -r '.value.id | ascii_downcase')
data=$(echo "$row" | base64 -d | yq r - value --prettyPrint)
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].kind "secret"
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].name "$providerId"

kubectl create secret generic "$providerId" \
--namespace "${PREVIEW_NAMESPACE}" \
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
--from-literal=provider="$data" \
--dry-run=client -o yaml | \
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" replace --force -f -
done

if [[ "${GITPOD_WITH_DEDICATED_EMU}" != "true" ]]
then
for row in $(kubectl --kubeconfig "$DEV_KUBE_PATH" --context "${DEV_KUBE_CONTEXT}" get secret preview-envs-authproviders-harvester --namespace=keys -o jsonpath="{.data.authProviders}" \
| base64 -d -w 0 \
| yq r - authProviders -j \
| jq -r 'to_entries | .[] | @base64'); do
key=$(echo "${row}" | base64 -d | jq -r '.key')
providerId=$(echo "$row" | base64 -d | jq -r '.value.id | ascii_downcase')
data=$(echo "$row" | base64 -d | yq r - value --prettyPrint)
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].kind "secret"
yq w -i "${INSTALLER_CONFIG_PATH}" authProviders["$key"].name "$providerId"

kubectl create secret generic "$providerId" \
--namespace "${PREVIEW_NAMESPACE}" \
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
--from-literal=provider="$data" \
--dry-run=client -o yaml | \
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" replace --force -f -
done
fi


#
# configureStripeAPIKeys
Expand Down