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

Gitea support #8131

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Next Next commit
first attempt for Gitea
  • Loading branch information
anbraten committed Feb 9, 2022
commit fb49a9ee829ac9cb21b306eb0e5db074a382b197
3 changes: 3 additions & 0 deletions components/dashboard/src/images/gitea.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions components/dashboard/src/provider-utils.tsx
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
import bitbucket from './images/bitbucket.svg';
import github from './images/github.svg';
import gitlab from './images/gitlab.svg';
import gitea from './images/gitea.svg';
import { gitpodHostUrl } from "./service/service";

function iconForAuthProvider(type: string) {
@@ -17,6 +18,8 @@ function iconForAuthProvider(type: string) {
return <img className="fill-current filter-grayscale w-5 h-5 ml-3 mr-3 my-auto" src={gitlab} />;
case "Bitbucket":
return <img className="fill-current filter-grayscale w-5 h-5 ml-3 mr-3 my-auto" src={bitbucket} />;
case "Gitea":
return <img className="fill-current filter-grayscale w-5 h-5 ml-3 mr-3 my-auto" src={gitea} />;
default:
return <></>;
}
3 changes: 3 additions & 0 deletions components/server/ee/src/auth/host-container-mapping.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import { HostContainerMapping } from "../../../src/auth/host-container-mapping";
import { gitlabContainerModuleEE } from "../gitlab/container-module";
import { bitbucketContainerModuleEE } from "../bitbucket/container-module";
import { gitHubContainerModuleEE } from "../github/container-module";
import { giteaContainerModuleEE } from "../gitea/container-module";

@injectable()
export class HostContainerMappingEE extends HostContainerMapping {
@@ -23,6 +24,8 @@ export class HostContainerMappingEE extends HostContainerMapping {
return (modules || []).concat([bitbucketContainerModuleEE]);
case "GitHub":
return (modules || []).concat([gitHubContainerModuleEE]);
case "Gitea":
return (modules || []).concat([giteaContainerModuleEE]);
default:
return modules;
}
4 changes: 4 additions & 0 deletions components/server/ee/src/container-module.ts
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@ import { GitLabAppSupport } from "./gitlab/gitlab-app-support";
import { Config } from "../../src/config";
import { SnapshotService } from "./workspace/snapshot-service";
import { BitbucketAppSupport } from "./bitbucket/bitbucket-app-support";
import { GiteaAppSupport } from "./gitea/gitea-app-support";
import { GiteaApp } from "./prebuilds/gitea-app";

export const productionEEContainerModule = new ContainerModule((bind, unbind, isBound, rebind) => {
rebind(Server).to(ServerEE).inSingletonScope();
@@ -68,6 +70,8 @@ export const productionEEContainerModule = new ContainerModule((bind, unbind, is
bind(GitLabAppSupport).toSelf().inSingletonScope();
bind(BitbucketApp).toSelf().inSingletonScope();
bind(BitbucketAppSupport).toSelf().inSingletonScope();
bind(GiteaApp).toSelf().inSingletonScope();
bind(GiteaAppSupport).toSelf().inSingletonScope();

bind(LicenseEvaluator).toSelf().inSingletonScope();
bind(LicenseKeySource).to(DBLicenseKeySource).inSingletonScope();
2 changes: 2 additions & 0 deletions components/server/ee/src/server.ts
Original file line number Diff line number Diff line change
@@ -12,12 +12,14 @@ import { log } from '@gitpod/gitpod-protocol/lib/util/logging';
import { GitLabApp } from './prebuilds/gitlab-app';
import { BitbucketApp } from './prebuilds/bitbucket-app';
import { GithubApp } from './prebuilds/github-app';
import { GiteaApp } from './prebuilds/gitea-app';
import { SnapshotService } from './workspace/snapshot-service';

export class ServerEE<C extends GitpodClient, S extends GitpodServer> extends Server<C, S> {
@inject(GithubApp) protected readonly githubApp: GithubApp;
@inject(GitLabApp) protected readonly gitLabApp: GitLabApp;
@inject(BitbucketApp) protected readonly bitbucketApp: BitbucketApp;
@inject(GiteaApp) protected readonly giteaApp: GiteaApp;
@inject(SnapshotService) protected readonly snapshotService: SnapshotService;

public async init(app: express.Application) {
3 changes: 2 additions & 1 deletion components/server/src/auth/auth-provider-service.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import { Config } from "../config";
import { v4 as uuidv4 } from 'uuid';
import { oauthUrls as githubUrls } from "../github/github-urls";
import { oauthUrls as gitlabUrls } from "../gitlab/gitlab-urls";
import { oauthUrls as giteaUrls } from "../gitea/gitea-urls";
import { log } from '@gitpod/gitpod-protocol/lib/util/logging';

@injectable()
@@ -100,7 +101,7 @@ export class AuthProviderService {
}
protected initializeNewProvider(newEntry: AuthProviderEntry.NewEntry): AuthProviderEntry {
const { host, type, clientId, clientSecret } = newEntry;
const urls = type === "GitHub" ? githubUrls(host) : (type === "GitLab" ? gitlabUrls(host) : undefined);
const urls = type === "GitHub" ? githubUrls(host) : (type === "GitLab" ? gitlabUrls(host) : (type === "Gitea" ? giteaUrls(host) : undefined));
if (!urls) {
throw new Error("Unexpected service type.");
}
3 changes: 3 additions & 0 deletions components/server/src/auth/host-container-mapping.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import { githubContainerModule } from "../github/github-container-module";
import { gitlabContainerModule } from "../gitlab/gitlab-container-module";
import { genericAuthContainerModule } from "./oauth-container-module";
import { bitbucketContainerModule } from "../bitbucket/bitbucket-container-module";
import { giteaContainerModule } from "../gitea/gitea-container-module";

@injectable()
export class HostContainerMapping {
@@ -23,6 +24,8 @@ export class HostContainerMapping {
return [genericAuthContainerModule];
case "Bitbucket":
return [bitbucketContainerModule];
case "Gitea":
return [giteaContainerModule];
default:
return undefined;
}
Loading
Oops, something went wrong.