Skip to content

Commit 73cbeef

Browse files
Wulf Thimmroboquat
Wulf Thimm
authored andcommitted
forcing the werft job to fail if the branch name is too long to support preview-environments
1 parent 0b6c427 commit 73cbeef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.werft/build.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ Tracing.initialize()
4444
async function run(context: any) {
4545
const config = jobConfig(werft, context)
4646

47+
//TODO: This is only a temporary solution and needs to be removed when we migrate to one prev-environment per cluster
48+
// Because of a workspace label the branch name that can be used to create a preview environment is limited to 20 chars
49+
// echo -n "gitpod.io/registry-facade_ready_ns_staging-" | wc -c
50+
if (!config.noPreview) {
51+
werft.phase("check-branchname","This checks if the branchname is to long to create a preview-environment successfully.")
52+
const maxBranchNameLength = 20;
53+
if (config.previewEnvironment.destname.length > maxBranchNameLength) {
54+
werft.fail("check-branchname", `The branch name ${config.previewEnvironment.destname} is more than ${maxBranchNameLength} character. Please choose a shorter name!`)
55+
}
56+
werft.done("check-branchname")
57+
}
58+
59+
4760
await validateChanges(werft)
4861
await prepare(werft)
4962
await buildAndPublish(werft, config)

0 commit comments

Comments
 (0)