Skip to content
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

EVG-3358: use gimlet app for restv1 #1166

Merged
merged 5 commits into from
May 18, 2018

Conversation

tychoish
Copy link
Contributor

No description provided.

@tychoish tychoish requested a review from a team May 17, 2018 14:59
Copy link
Contributor

@john-m-liu john-m-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also when I try to run evergreen locally now the waterfall 404s and I see a lot of "multiple response.WriteHeader calls" logged

legacyApp.AddMiddleware(negroni.HandlerFunc(UserMiddleware(as.UserManager)))
legacyApp.AddMiddleware(negroni.NewStatic(http.Dir(filepath.Join(uis.Home, "public"))))

router, err := legacyApp.Router()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the app needs to be resolved before this I think

@@ -77,7 +77,7 @@ func getEndTaskEndpoint(t *testing.T, as *APIServer, hostId, taskId string, deta

handler, err := as.Handler()
if err != nil {
t.Fatalf("creating test API handler: %v", err)
t.Fatalf("cyreating test API handler: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo :)


func (ra *restV1middleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
vars := gimlet.GetVars(r)
ctx, err := model.LoadContext(vars["task_id"], vars["build_id"], vars["version_id"], vars["patch_id"], vars["project_id"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project can also be stored in a cookie rather than the url (see the old getRequestProjectId func)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed in person, this is only true of the UI server, which has a very similar method.

return
}

if ctx.ProjectRef != nil && ctx.ProjectRef.Private && GetUser(r) == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels like it belongs elsewhere, either in an auth method or in the route itself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better to keep this out of the route itself, and also, I totally agree with you, but the problem is that this has to happen really late in the process (on the whole), so it might not get much better than this.

@tychoish tychoish force-pushed the EVG-3358-use-gimlet-for-restv1 branch from e4f176c to 0ce4f5b Compare May 17, 2018 22:29
Copy link
Contributor

@john-m-liu john-m-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm once the smoke test passes


const RestContext restContextKey = 0

type restAPIService interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this interface shouldn't exist, but I also can't think of a cleaner way to do this :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't agree more. Some day we'll fix it.

@tychoish tychoish force-pushed the EVG-3358-use-gimlet-for-restv1 branch from f01ade3 to 11d45c4 Compare May 18, 2018 17:47
@tychoish tychoish merged commit 06520ba into evergreen-ci:master May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants