-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Disable running prebuilds without a project #15026
Conversation
started the job as gitpod-build-jx-remove-prefix.1 because the annotations in the pull request description changed |
/werft run with-clean-slate-deployment cert-issuer=letsencrypt 👍 started the job as gitpod-build-jx-remove-prefix.2 |
5e54ed3
to
0e4ccf1
Compare
Okay, this is what using the Maybe it could be nicer to actually redirect to some docs page? I wonder if this prefix is still being used. Maybe I should get some data on this. 🔍 EDIT: When looking at how many workspaces are being started with the SELECT substr(creationTime, 1, 10) day, count(id) FROM d_b_workspace where contextUrl like 'prebuild/%' group by day order by day desc; New question: Why? |
0e4ccf1
to
f8d3bde
Compare
b1260d4
to
154891d
Compare
Alright, I think that throwing this more helpful error is a better approach: Try for yourself: https://jx-remove-prefix.preview.gitpod-dev.com/#prebuild/https://github.com/gitpod-io/gitpod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/hold for error type discussion
@@ -128,6 +128,11 @@ export class PrebuildManager { | |||
if (user.blocked) { | |||
throw new Error(`Blocked users cannot start prebuilds (${user.name})`); | |||
} | |||
if (!project) { | |||
throw new Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we throw a User Error (Invalid Argument) here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I think this can be done. Let me try.
actual: context, | ||
}; | ||
return result; | ||
throw new Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simlarly here, is it possible to throw an InvalidArgument error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it's more a case of a no-longer-valid route (gitpod.io/#prebuild/
URL prefix is deprecated), so it's not really an invalid argument. 🤔 Also, I'm not exactly sure a specific error would bubble correctly all the way to the user.
Let's see, I'll give this a quick try, but leave as is if it turns out too complicated for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is the API, and you supplied something which is not valid anymore, I think it would be an Invalid Argument. You could also go with Not Found, but I think that doens't communicate the fact that the client to this API specified something which is no longer valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I guess this could also be a 400 Bad Request
, or a 410 Gone
?
my 2 cents - |
Thanks for the feedback @easyCZ and @shaal! 🚀 Your ideas make sense to me. I'll give them a try, but given how little visibility this code path has nowadays, if implementing them here turns out too complicated, I think I might just ship this PR as is and leave any improvements as potential follow-up items for the future. 💭 |
I think the particular code doesn't matter as much, as long as it does not show up as a 5xx error which would eat into our SLO but wasn't actually something we'd have control over. |
/werft run 👍 started the job as gitpod-build-jx-remove-prefix.9 |
🙄 /werft run with-clean-slate-deployment 👍 started the job as gitpod-build-jx-remove-prefix.10 |
Maybe 4th time's the charm! /werft run 👍 started the job as gitpod-build-jx-remove-prefix.11 |
/werft run cert-issuer=letsencrypt 👍 started the job as gitpod-build-jx-remove-prefix.12 |
/werft run cert-issuer=letsencrypt recreate-preview 👍 started the job as gitpod-build-jx-remove-prefix.13 |
Should be easy to introduce a new custom error type and make the UI display a link. 🙂 |
9fa3ec0
to
ddd7a0d
Compare
ddd7a0d
to
fbc46cd
Compare
Thanks for shipping this, @jankeromnes! Shall we open any follow up issues from the outstanding tasks in the epic (#9898) to consider this DONE? Cc @jldec
|
Follow-up issue: Now that the To fix this, we plan to make the 'Run Prebuild' button do what it says 100% of the time: #15144 |
Description
Throw an error when attempting to start a prebuild on a repository without a corresponding project.
Also (reviving #15024) disable the deprecated
#prebuild/
context URL prefix, because it doesn't know about projects (and thus ignores any project details, settings, or safeguards).The supported ways to start a prebuild are:
Run Prebuild
button in the UIRelated Issue(s)
Fixes #9898 and fixes #4353
How to test
#prebuild/
URL prefix should no longer workRelease Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh