Skip to content

forcing the werft job to fail if the branch name is too long to suppo… #8316

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
Feb 25, 2022
Merged
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
13 changes: 13 additions & 0 deletions .werft/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ Tracing.initialize()
async function run(context: any) {
const config = jobConfig(werft, context)

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


await validateChanges(werft)
await prepare(werft)
await buildAndPublish(werft, config)
Expand Down