Skip to content

Commit f05e1d4

Browse files
author
Wulf Thimm
committed
forcing the werft job to fail if the branch name is too long to support preview-environments
1 parent 6f8bbba commit f05e1d4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ export async function deployToPreviewEnvironment(werft: Werft, jobConfig: JobCon
153153
}
154154

155155
werft.phase(phases.PREDEPLOY, "Checking for existing installations...");
156+
157+
const maxBranchNameLength = 26;
158+
if (deploymentConfig.destname.length > maxBranchNameLength) {
159+
werft.fail(phases.PREDEPLOY, `The branch name ${deploymentConfig.destname} is more than ${maxBranchNameLength} character. Please choose a shorter name!`)
160+
}
161+
156162
// the context namespace is not set at this point
157163
const hasGitpodHelmInstall = exec(`helm status ${helmInstallName} -n ${deploymentConfig.namespace}`, { slice: "check for Helm install", dontCheckRc: true }).code === 0;
158164
const hasGitpodInstallerInstall = exec(`kubectl get configmap gitpod-app -n ${deploymentConfig.namespace}`, { slice: "check for Installer install", dontCheckRc: true }).code === 0;

0 commit comments

Comments
 (0)