Skip to content

[server] Don't skip prebuilds if .gitpod.yml has a 'before' task but no 'init' task #10352

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 2 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions components/server/ee/src/prebuilds/github-enterprise-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export class GitHubEnterpriseApp {
): Promise<User> {
const span = TraceContext.startSpan("GitHubEnterpriseApp.findUser", ctx);
try {
const host = req.header("X-Github-Enterprise-Host");
let host = req.header("X-Github-Enterprise-Host");
if (!host) {
// If the GitHub installation doesn't identify itself, we fall back to the hostname from the repository URL.
const repoUrl = new URL(payload.repository.url);
host = repoUrl.hostname;
}
const hostContext = this.hostContextProvider.get(host || "");
if (!host || !hostContext) {
if (!hostContext) {
throw new Error("Unsupported GitHub Enterprise host: " + host);
}
const { authProviderId } = hostContext.authProvider;
Expand Down
2 changes: 1 addition & 1 deletion components/server/ee/src/prebuilds/prebuild-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class PrebuildManager {
return false;
}

const hasPrebuildTask = !!config.tasks && config.tasks.find((t) => !!t.init || !!t.prebuild);
const hasPrebuildTask = !!config.tasks && config.tasks.find((t) => !!t.before || !!t.init || !!t.prebuild);
if (!hasPrebuildTask) {
return false;
}
Expand Down