gitea

package
v0.15.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Opts) (remote.Remote, error)

New returns a Remote implementation that integrates with Gitea, an open source Git service written in Go. See https://gitea.io/

Types

type Gitea

type Gitea struct {
	URL          string
	ClientID     string
	ClientSecret string
	SkipVerify   bool
}

func (*Gitea) Activate

func (c *Gitea) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error

Activate activates the repository by registering post-commit hooks with the Gitea repository.

func (*Gitea) Auth

func (c *Gitea) Auth(ctx context.Context, token, secret string) (string, error)

Auth uses the Gitea oauth2 access token and refresh token to authenticate a session and return the Gitea account login.

func (*Gitea) Branches

func (c *Gitea) Branches(ctx context.Context, u *model.User, r *model.Repo) ([]string, error)

Branches returns the names of all branches for the named repository.

func (*Gitea) Deactivate

func (c *Gitea) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error

Deactivate deactives the repository be removing repository push hooks from the Gitea repository.

func (*Gitea) Dir

func (c *Gitea) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]*remote.FileMeta, error)

func (*Gitea) File

func (c *Gitea) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)

File fetches the file from the Gitea repository and returns its contents.

func (*Gitea) Hook

func (c *Gitea) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Build, error)

Hook parses the incoming Gitea hook and returns the Repository and Build details. If the hook is unsupported nil values are returned.

func (*Gitea) Login

func (c *Gitea) Login(ctx context.Context, w http.ResponseWriter, req *http.Request) (*model.User, error)

Login authenticates an account with Gitea using basic authentication. The Gitea account details are returned when the user is successfully authenticated.

func (*Gitea) Netrc

func (c *Gitea) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

Netrc returns a netrc file capable of authenticating Gitea requests and cloning Gitea repositories. The netrc will use the global machine account when configured.

func (*Gitea) Perm

func (c *Gitea) Perm(ctx context.Context, u *model.User, r *model.Repo) (*model.Perm, error)

Perm returns the user permissions for the named Gitea repository.

func (*Gitea) Refresh

func (c *Gitea) Refresh(ctx context.Context, user *model.User) (bool, error)

Refresh refreshes the Gitea oauth2 access token. If the token is refreshed the user is updated and a true value is returned.

func (*Gitea) Repo

func (c *Gitea) Repo(ctx context.Context, u *model.User, owner, name string) (*model.Repo, error)

Repo returns the named Gitea repository.

func (*Gitea) Repos

func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)

Repos returns a list of all repositories for the Gitea account, including organization repositories.

func (*Gitea) Status

func (c *Gitea) Status(ctx context.Context, user *model.User, repo *model.Repo, build *model.Build, proc *model.Proc) error

Status is supported by the Gitea driver.

func (*Gitea) TeamPerm

func (c *Gitea) TeamPerm(u *model.User, org string) (*model.Perm, error)

TeamPerm is not supported by the Gitea driver.

func (*Gitea) Teams

func (c *Gitea) Teams(ctx context.Context, u *model.User) ([]*model.Team, error)

Teams is supported by the Gitea driver.

type Opts

type Opts struct {
	URL        string // Gitea server url.
	Client     string // OAuth2 Client ID
	Secret     string // OAuth2 Client Secret
	SkipVerify bool   // Skip ssl verification.
}

Opts defines configuration options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL