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

Gitea support #8131

wants to merge 23 commits into from

Conversation

anbraten
Copy link

@anbraten anbraten commented Feb 10, 2022

Description

This PR implements basic Gitea support.

Related Issue(s)

Closes #80

How to test

Good question how to test this from start to end 🙈

Release Notes

Support Gitea

Documentation

TODO

TODO

  • add gitea next to other forges
    • allow to configure new gitea forge
  • support login via gitea
  • support gitea url context parsing
  • support prebuilds

const accountAvatarUrl = project.owner?.avatar_url as string;
const account = project.owner?.login as string;

(account === usersGitLabAccount ? ownersRepos : result).push({
Copy link

Choose a reason for hiding this comment

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

GitLab?

Copy link
Author

Choose a reason for hiding this comment

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

I just copied the gitlab code and added some placeholders for the ee code yet. I am still quite new to the codebase of Gitpod, but hopefully the ee part is not to critical to run the server for now.

@anbraten
Copy link
Author

@ghuntley as promised on the Gitea discord this is my first draft for the Gitea integration. I can already build the code, but starting a whole deployment of Gitpod on my local pc / a cluster of my own wasn't working for me yet. Could you give me some advise on this or are there any existing integration tests I could use to test it?

@anbraten
Copy link
Author

anbraten commented Feb 17, 2022

/werft run

👎 not authorized

@stale
Copy link

stale bot commented Mar 2, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Mar 2, 2022
@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Mar 4, 2022
async getProviderRepositoriesForUser(params: { user: User, provider: AuthProviderInfo }): Promise<ProviderRepository[]> {
const token = await this.tokenProvider.getTokenForHost(params.user, params.provider.host);
const oauthToken = token.value;
const api = Gitea.create(`https://${params.provider.host}`, oauthToken);

Choose a reason for hiding this comment

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

Two tiny nitpicks, 1. It is possible for gitea to exist on a subpath (eg. https://example.com/gitea/ etc..), and 2. some users may wish not to use https (not a great idea, but one that people make for a variety of reasons).

You may wish instead of host, to use something like baseURL where users can fill the url scheme and full url (incl. a sub-path if they so require).

Copy link
Author

Choose a reason for hiding this comment

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

Good points. I will have a look and do some tests later. Currently my main problem is still getting a Gitpod instance with those changes up and running. 🙈

Choose a reason for hiding this comment

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

Is the issue a matter of compute resources available to you, or being able to apply your changes to a running deploy? If the former, the Gitea project likely can assist in providing compute resources, if the later I'm sure if you post the issue you are running into then someone can help.

Copy link
Author

@anbraten anbraten Mar 5, 2022

Choose a reason for hiding this comment

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

I currently using a cluster on vultr with with some credit I had lying around, so should be fine for the beginning, but I will come back to your offer if needed. Main problem is building images of the needed components and deploying those atm. It requires some manual intervention which loads to a pretty slow dev cycle as I have to rebuild the server, deploy it and look for changes ... The gitpod team seems to use telepresence for that, but I am not quite sure how to integrate that with my own cluster.

@anbraten
Copy link
Author

anbraten commented Mar 7, 2022

Whoop! Whoop! Authentication is working now and I got my first Gitea workspace running 🎉

@ghuntley ghuntley added the meta: never-stale This issue can never become stale label Mar 10, 2022
@socket-security
Copy link

socket-security bot commented Mar 17, 2022

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@ghuntley
Copy link
Contributor

ghuntley commented Mar 17, 2022

/werft run

👍 started the job as gitpod-build-gitea-fork.1

@ghuntley
Copy link
Contributor

ghuntley commented Mar 18, 2022

/werft run

👍 started the job as gitpod-build-gitea-fork.2

@ghuntley
Copy link
Contributor

ghuntley commented Mar 18, 2022

👋 Dropped on by to have a look at the work so far.

Good question how to test this from start to end 🙈

I ran kick-off builds from you as needed (let's coordinate via Discord?) and that will provision a deployment

2022-03-18_10-06-40

2022-03-18_10-06-14

observations

Screen Shot 2022-03-18 at 9 59 53 am

outstanding items

  • create https://www.gitpod.io/docs/gitea-integration/

    • document the create app steps
    • document the activate step (reminder: popup blocker might stop it) 2022-03-18_09-54-20
  • resolve that the redirect url in "New Git Integration" defaults to "gitlab" in https://gitea.staging.gitpod-dev.com/auth/***gitlab***.example.com/callback

  • resolve broken link "Go to developer settings and setup the OAuth application" in "New Git Integration"

  • resolve starting workspace from gitea.

  • confirm able to push from workspace to gitea.

gitea

@anbraten
Copy link
Author

Screenshot from 2022-03-18 11-02-16

@ghuntley Are none Gitpod internal-team accounts disabled on staging environments?


Instead of using https://try.gitea.io maybe https://gitea.com could be used? CC @lunny @techknowlogick

@lunny
Copy link

lunny commented Mar 18, 2022

Screenshot from 2022-03-18 11-02-16

@ghuntley Are none Gitpod internal-team accounts disabled on staging environments?

Instead of using https://try.gitea.io maybe https://gitea.com could be used? CC @lunny @techknowlogick

Yes, https://gitea.com is the formal site. https://try.gitea.io just for test and the repositories will be deleted when disk is full.

@IDerr
Copy link

IDerr commented May 17, 2022

Hello everyone :D
@anbraten is it usable currently with the code in this MR or does it need some more work ?

I would love to try it

Thanks a lot for your amazing work !

@anbraten
Copy link
Author

@IDerr I haven't worked on it for a while. My last problem was executing the tests for the components/server/src/gitea/gitea-context-parser.spec.ts. I was a bit lost on how I could start them. Those tests would help a lot with the context module. That context is needed as it returns the branch, commit etc Gitpod should check out for a provided url which seems to have some tiny issues. Apart from that the gitea implementation just needs some more testing and should be pretty done already.

@IDerr
Copy link

IDerr commented May 17, 2022

ok, i see, I'll try to see to modify some code, and see if I can make it work on my side.

Thanks a lot

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@bufbuild/[email protected] None 0 1.45 MB bufbot, bufdev, cmahony, ...7 more
npm/@gitbeaker/[email protected] None +4 1.84 MB jdalrymple
npm/@probot/[email protected] environment, filesystem 0 21.2 kB probotbot
npm/@stripe/[email protected] Transitive: environment +8 4.34 MB pololi-stripe
npm/@tailwindcss/[email protected] Transitive: environment, filesystem, shell, unsafe +61 17 MB thecrypticace
npm/@tanstack/[email protected] Transitive: environment +2 2.43 MB tannerlinsley
npm/@tanstack/[email protected] environment +13 16 MB tannerlinsley
npm/@tanstack/[email protected] Transitive: environment +9 7.23 MB tannerlinsley
npm/@tanstack/[email protected] environment +7 7.05 MB tannerlinsley
npm/@testing-library/[email protected] Transitive: environment +27 5.42 MB testing-library-bot
npm/@types/[email protected] None 0 6.9 kB types
npm/@types/[email protected] None 0 7.46 kB types
npm/@types/[email protected] None 0 4.71 kB types
npm/@types/[email protected] None 0 3.5 kB types
npm/@types/[email protected] None 0 76.8 kB types
npm/@types/[email protected] None +1 3.87 MB types
npm/@types/[email protected] None +1 3.87 MB types
npm/@types/[email protected] None 0 3.07 kB types
npm/@types/[email protected] None 0 3.1 kB types
npm/@types/[email protected] None 0 6.31 kB types
npm/@types/[email protected] None +2 7.73 MB types
npm/@types/[email protected] None 0 9.12 kB types
npm/@types/[email protected] None 0 95.6 kB types
npm/@types/[email protected] None +1 3.89 MB types
npm/@types/[email protected] None +1 3.87 MB types
npm/@types/[email protected] None 0 3.86 MB types
npm/@types/[email protected] None +3 3.92 MB types
npm/@types/[email protected] None +1 3.91 MB types
npm/@types/[email protected] None 0 0 B
npm/@types/[email protected] Transitive: environment +16 13.4 MB types
npm/@types/[email protected] None +4 1.45 MB types
npm/@types/[email protected] None +4 1.43 MB types
npm/@types/[email protected] None +6 1.47 MB types
npm/@types/[email protected] None +5 1.46 MB types
npm/@types/[email protected] None +3 1.43 MB types
npm/@types/[email protected] None 0 4.43 kB types
npm/@types/[email protected] None +3 3.93 MB types
npm/@types/[email protected] None +3 3.89 MB types
npm/@types/[email protected] None 0 6.67 kB types
npm/@types/[email protected] None 0 71.2 kB types
npm/[email protected] None 0 191 kB aikoven
npm/[email protected] Transitive: environment, network +11 804 kB segment-admin
npm/[email protected] environment Transitive: filesystem +5 541 kB ai
npm/[email protected] None +3 573 kB muniftanjim
npm/[email protected] network Transitive: unsafe +1 86.5 kB dougwilson
npm/[email protected] network Transitive: environment, filesystem +14 4.99 MB keithamus
npm/[email protected] None +6 881 kB keithamus
npm/[email protected] None 0 23.6 kB jedwatson
npm/[email protected] environment, filesystem Transitive: shell +3 5.27 MB gustavohenke
npm/[email protected] None +1 569 kB laliconfigcat
npm/[email protected] network Transitive: environment +1 88.5 kB laliconfigcat
npm/[email protected] network 0 75.1 kB lquixada
npm/[email protected] None 0 664 kB iamkun
npm/[email protected] None +2 80.8 kB oprogramador
npm/[email protected] None +4 185 kB ljharb
npm/[email protected] None 0 31.2 kB tehshrike
npm/[email protected] None 0 0 B
npm/[email protected] filesystem Transitive: environment, eval +2 1.52 MB agreatfool
npm/[email protected] None 0 53.8 kB jaffathecake
npm/[email protected] None 0 1.52 MB jameskmonger
npm/[email protected] environment, eval Transitive: filesystem, network, shell +20 21.5 MB stipsan
npm/[email protected] None 0 26.2 kB carhartl
npm/[email protected] None 0 0 B
npm/[email protected] None +1 87.5 kB aikoven
npm/[email protected] Transitive: environment, filesystem, network +6 16.3 MB aikoven
npm/[email protected] None 0 195 kB yurishkuro
npm/[email protected] environment, filesystem, unsafe 0 8.38 MB prettier-bot
npm/[email protected] environment, filesystem, shell Transitive: eval, network +109 26.2 MB probotbot
npm/[email protected] None +4 61.6 kB sindresorhus
npm/[email protected] None 0 124 kB animir
npm/[email protected] Transitive: environment +16 12.7 MB mrusschen
npm/[email protected] Transitive: environment +24 2.77 MB kashey
npm/[email protected] None +1 97.9 kB mike-marcacci
npm/[email protected] None 0 295 kB rbuckton
npm/[email protected] None 0 20.9 kB simov
npm/[email protected] network, shell +1 6.94 MB stripe-bindings
npm/[email protected] network Transitive: environment, filesystem +8 789 kB titanism
npm/[email protected] environment, filesystem Transitive: shell, unsafe +59 16.9 MB adamwathan
npm/[email protected] environment, filesystem, unsafe +14 5.27 MB blakeembrey
npm/[email protected] Transitive: environment, filesystem, network, shell +9 39.8 MB shaberman
npm/[email protected] Transitive: network +5 12.4 MB twilio-dx
npm/[email protected] Transitive: eval +9 574 kB ljharb
npm/[email protected] None 0 751 kB profnandaa
npm/[email protected] None 0 204 kB vscode-bot
npm/[email protected] network 0 122 kB lpinca

🚮 Removed packages: npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.22.5, npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@babel/[email protected], npm/@discoveryjs/[email protected], npm/@eslint-community/[email protected], npm/@floating-ui/[email protected], npm/@floating-ui/[email protected], npm/@floating-ui/[email protected], npm/@gitbeaker/[email protected], npm/@gitbeaker/[email protected], npm/@grpc/[email protected], npm/@hapi/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@octokit/[email protected], npm/@popperjs/[email protected], npm/@probot/[email protected], npm/@probot/[email protected], npm/@protobuf-ts/[email protected], npm/@sqltools/[email protected], npm/@stripe/[email protected], npm/@tailwindcss/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@testing-library/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gitea support
7 participants