Skip to content

[preview] Fix broken shortname assignment in preview envs #13953

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
Oct 18, 2022
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
2 changes: 1 addition & 1 deletion .werft/jobs/build/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Installer {
private configureMetadata(slice: string): void {
exec(`cat <<EOF > shortname.yaml
metadata:
shortname: ""
shortname: "dev"
EOF`);
exec(`yq m -ix ${this.options.installerConfigPath} shortname.yaml`, { slice: slice });
}
Expand Down
13 changes: 1 addition & 12 deletions .werft/jobs/build/installer/post-process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ while [ "$documentIndex" -le "$DOCS" ]; do
yq m --arrays=overwrite -i k8s.yaml -d "$documentIndex" /tmp/"$NAME"pool.yaml
fi

SHORT_NAME="dev"
# overrides for server-config
if [[ "server-config" == "$NAME" ]] && [[ "$KIND" == "ConfigMap" ]]; then
WORK="overrides for $NAME $KIND"
Expand All @@ -113,12 +114,6 @@ while [ "$documentIndex" -le "$DOCS" ]; do
DEV_BRANCH_EXPR="s/\"devBranch\": \"\"/\"devBranch\": \"$DEV_BRANCH\"/"
sed -i "$DEV_BRANCH_EXPR" /tmp/"$NAME"overrides.yaml

# InstallationShortname
# is expected to look like ws-dev.<branch-name-with-dashes>.staging.gitpod-dev.com
SHORT_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml installation.shortname)
NAMESPACE=$(kubens -c)
INSTALL_SHORT_NAME_EXPR="s/\"installationShortname\": \"$NAMESPACE\"/\"installationShortname\": \"$SHORT_NAME\"/"
sed -i "$INSTALL_SHORT_NAME_EXPR" /tmp/"$NAME"overrides.yaml
# Stage
STAGE=$(yq r ./.werft/jobs/build/helm/values.dev.yaml installation.stage)
STAGE_EXPR="s/\"stage\": \"production\"/\"stage\": \"$STAGE\"/"
Expand Down Expand Up @@ -154,10 +149,6 @@ while [ "$documentIndex" -le "$DOCS" ]; do
touch /tmp/"$NAME"overrides.yaml
yq r k8s.yaml -d "$documentIndex" data | yq prefix - data > /tmp/"$NAME"overrides.yaml

# simliar to server, except the ConfigMap hierarchy, key, and value are different
SHORT_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml installation.shortname)
INSTALL_SHORT_NAME_EXPR="s/\"installation\": \"\"/\"installation\": \"$SHORT_NAME\"/"
sed -i "$INSTALL_SHORT_NAME_EXPR" /tmp/"$NAME"overrides.yaml
yq m -x -i k8s.yaml -d "$documentIndex" /tmp/"$NAME"overrides.yaml
fi

Expand All @@ -175,7 +166,6 @@ while [ "$documentIndex" -le "$DOCS" ]; do
touch /tmp/"$NAME"overrides.yaml
yq r k8s.yaml -d "$documentIndex" data | yq prefix - data > /tmp/"$NAME"overrides.yaml

SHORT_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml installation.shortname)
STAGING_HOST_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml hostname)
CURRENT_WS_HOST_NAME="ws.$DEV_BRANCH.$STAGING_HOST_NAME"
NEW_WS_HOST_NAME="ws-$SHORT_NAME.$DEV_BRANCH.$STAGING_HOST_NAME"
Expand Down Expand Up @@ -222,7 +212,6 @@ while [ "$documentIndex" -le "$DOCS" ]; do
yq r k8s.yaml -d "$documentIndex" data | yq prefix - data > /tmp/"$NAME"overrides.yaml

# simliar to server, except the ConfigMap hierarchy, key, and value are different
SHORT_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml installation.shortname)
STAGING_HOST_NAME=$(yq r ./.werft/jobs/build/helm/values.dev.yaml hostname)
CURRENT_WS_HOST_NAME="ws.$DEV_BRANCH.$STAGING_HOST_NAME"
NEW_WS_HOST_NAME="ws-$SHORT_NAME.$DEV_BRANCH.$STAGING_HOST_NAME"
Expand Down