forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove-local-clones
- Loading branch information
Showing
302 changed files
with
37,058 additions
and
569 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,12 @@ $ curl --request GET --url https://yourusername:[email protected]/api | |
[{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}] | ||
``` | ||
|
||
As of v1.8.0 of Gitea, if using basic authentication with the API and your user has two factor authentication enabled, you'll need to send an additional header that contains the one time password (6 digit rotating token). An example of the header is `X-Gitea-OTP: 123456` where `123456` is where you'd place the code from your authenticator. Here is how the request would look like in curl: | ||
|
||
``` | ||
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:[email protected]/api/v1/users/yourusername/tokens | ||
``` | ||
|
||
## Sudo | ||
|
||
The API allows admin users to sudo API requests as another user. Simply add either a `sudo=` parameter or `Sudo:` request header with the username of the user to sudo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
date: "2019-04-15T17:29:00+08:00" | ||
title: "Advanced: Migrations Interfaces" | ||
slug: "migrations-interfaces" | ||
weight: 30 | ||
toc: true | ||
draft: false | ||
menu: | ||
sidebar: | ||
parent: "advanced" | ||
name: "Migrations Interfaces" | ||
weight: 55 | ||
identifier: "migrations-interfaces" | ||
--- | ||
|
||
# Migration Features | ||
|
||
The new migration features were introduced in Gitea 1.9.0. It defines two interfaces to support migrating | ||
repositories data from other git host platforms to gitea or, in the future migrating gitea data to other | ||
git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented. | ||
|
||
First of all, Gitea defines some standard objects in packages `modules/migrations/base`. They are | ||
`Repository`, `Milestone`, `Release`, `Label`, `Issue`, `Comment`, `PullRequest`. | ||
|
||
## Downloader Interfaces | ||
|
||
To migrate from a new git host platform, there are two steps to be updated. | ||
|
||
- You should implement a `Downloader` which will get all kinds of repository informations. | ||
- You should implement a `DownloaderFactory` which is used to detect if the URL matches and | ||
create a Downloader. | ||
- You'll need to register the `DownloaderFactory` via `RegisterDownloaderFactory` on init. | ||
|
||
```Go | ||
type Downloader interface { | ||
GetRepoInfo() (*Repository, error) | ||
GetMilestones() ([]*Milestone, error) | ||
GetReleases() ([]*Release, error) | ||
GetLabels() ([]*Label, error) | ||
GetIssues(start, limit int) ([]*Issue, error) | ||
GetComments(issueNumber int64) ([]*Comment, error) | ||
GetPullRequests(start, limit int) ([]*PullRequest, error) | ||
} | ||
``` | ||
|
||
```Go | ||
type DownloaderFactory interface { | ||
Match(opts MigrateOptions) (bool, error) | ||
New(opts MigrateOptions) (Downloader, error) | ||
} | ||
``` | ||
|
||
## Uploader Interface | ||
|
||
Currently, only a `GiteaLocalUploader` is implemented, so we only save downloaded | ||
data via this `Uploader` on the local Gitea instance. Other uploaders are not supported | ||
and will be implemented in future. | ||
|
||
```Go | ||
// Uploader uploads all the informations | ||
type Uploader interface { | ||
CreateRepo(repo *Repository, includeWiki bool) error | ||
CreateMilestone(milestone *Milestone) error | ||
CreateRelease(release *Release) error | ||
CreateLabel(label *Label) error | ||
CreateIssue(issue *Issue) error | ||
CreateComment(issueNumber int64, comment *Comment) error | ||
CreatePullRequest(pr *PullRequest) error | ||
Rollback() error | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.