-
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
[server] Don't skip prebuilds if .gitpod.yml has a 'before' task but no 'init' task #10352
Conversation
/werft run 👍 started the job as gitpod-build-jx-fix-before.1 |
I tested this and it works for me with a GitLab repo ☑️ However I do not see the prebuilds being triggered for a project using the test-before GitHub repo in this preview env, so I think something is still not right in that scenario (not using GitHub app, just OAuth afaict) I have invited @jankeromnes as collaborator on https://github.com/jldec/test-before and sent you invite to the project team. |
Many thanks @jldec for testing this PR! And also for inviting me to your test assets:
Looking into the database, I see that:
Will now try to reproduce by forking your repos, adding them as projects, and pushing to them. 👀 EDIT: Results:
|
A few suspicious error messages from Note: This looks like a real bug, but unrelated to this Pull Request. Will dive into it anyway since I'm here. 🔍 When I add the GitHub project and it tries to install a webhook: {
component: "server",
severity: "INFO",
time: "2022-06-02T07:35:24.056Z",
message: "Update prebuild installation for project.",
payload: {
cloneUrl: "https://github.com/jankeromnes/test-before.git",
teamId: "0380f06c-322c-4345-988c-0ab64688f173",
installerId: "4b2615de-396c-4c49-9f94-a42b57a157e0",
},
},
{
component: "server",
severity: "INFO",
time: "2022-06-02T07:35:25.433Z",
message: "Unknown GitHub Enterprise event received",
payload: { event: "ping" },
}, When I push a commit to GitHub: {
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
serviceContext: { service: "server", version: "jx-fix-before.1" },
stack_trace:
"Error: Unsupported GitHub Enterprise host: undefined\n at GitHubEnterpriseApp.<anonymous> (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:90:27)\n at Generator.next (<anonymous>)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:22:71\n at new Promise (<anonymous>)\n at __awaiter (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:18:12)\n at GitHubEnterpriseApp.findUser (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:84:16)\n at GitHubEnterpriseApp.<anonymous> (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:54:39)\n at Generator.next (<anonymous>)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:22:71\n at new Promise (<anonymous>)\n at __awaiter (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:18:12)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:46:46\n at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)\n at next (/app/node_modules/express/lib/router/route.js:137:13)\n at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)\n at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)",
component: "server",
severity: "ERROR",
time: "2022-06-02T07:37:01.517Z",
message: "Cannot find user.",
error: "Error: Unsupported GitHub Enterprise host: undefined\n at GitHubEnterpriseApp.<anonymous> (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:90:27)\n at Generator.next (<anonymous>)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:22:71\n at new Promise (<anonymous>)\n at __awaiter (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:18:12)\n at GitHubEnterpriseApp.findUser (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:84:16)\n at GitHubEnterpriseApp.<anonymous> (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:54:39)\n at Generator.next (<anonymous>)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:22:71\n at new Promise (<anonymous>)\n at __awaiter (/app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:18:12)\n at /app/node_modules/@gitpod/server/dist/ee/src/prebuilds/github-enterprise-app.js:46:46\n at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)\n at next (/app/node_modules/express/lib/router/route.js:137:13)\n at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)\n at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)",
payload: {},
}, |
Looks like {
"host": "jx-fix-before.preview.gitpod-dev.com",
"user-agent": "GitHub-Hookshot/b257cdf",
"content-length": "7424",
"accept": "*/*",
"content-type": "application/json",
"x-forwarded-for": "10.0.2.2",
"x-forwarded-host": "jx-fix-before.preview.gitpod-dev.com",
"x-forwarded-proto": "https",
"x-github-delivery": "062e6fb4-e254-11ec-9eab-e106b31fee52",
"x-github-event": "push",
"x-github-hook-id": "361307289",
"x-github-hook-installation-target-id": "499037053",
"x-github-hook-installation-target-type": "repository",
"x-hub-signature": "sha1=91f7211e2b5258dce6754c7a702836e812b8bed2",
"x-hub-signature-256": "sha256=6589db1af6a201ff3db0b0ceabe95df722703be5490ed9bd2851ed01178a15f1",
"x-real-ip": "10.0.2.2",
"accept-encoding": "gzip"
} |
2595bae
to
556b206
Compare
…r, fall back to the hostname from the repository URL Fixes "Unsupported GitHub Enterprise host: undefined"
556b206
to
72846e8
Compare
Update: I've added a drive-by fix which makes us use the hostname from the repository URL when GitHub sends webhooks without a host header. ✅ This should fix triggering prebuilds on GitHub pushes here (when using webhooks instead of the app), and also generally fix prebuild webhooks for various other GitHub Enterprise versions (I had noticed the same error message in prod a few times, which means a few GHE servers were affected by this bug too). |
/werft run 👍 started the job as gitpod-build-jx-fix-before.5 |
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.
Works for me now on both GitLab and GitHub
Thank you @jankeromnes
Description
Don't skip prebuilds if .gitpod.yml has a
before
task but noinit
task.Related Issue(s)
Fixes #10336
Drive-by fix:
Unsupported GitHub Enterprise host: undefined
error preventing prebuild trigger with webhooks fromgithub.com
and various GitHub Enterprise versions)How to test
Release Notes
Documentation