Skip to content

Commit d8f16a6

Browse files
jankeromnesroboquat
authored andcommitted
Revert "[preview] Fix broken shortname assignment in preview envs"
This reverts commit 90b737a.
1 parent 1b4fe27 commit d8f16a6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class Installer {
119119
private configureMetadata(slice: string): void {
120120
exec(`cat <<EOF > shortname.yaml
121121
metadata:
122-
shortname: "dev"
122+
shortname: ""
123123
EOF`);
124124
exec(`yq m -ix ${this.options.installerConfigPath} shortname.yaml`, { slice: slice });
125125
}

.werft/jobs/build/installer/post-process.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ while [ "$documentIndex" -le "$DOCS" ]; do
103103
yq m --arrays=overwrite -i k8s.yaml -d "$documentIndex" /tmp/"$NAME"pool.yaml
104104
fi
105105

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

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

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

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

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

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

0 commit comments

Comments
 (0)