source

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package source provides the ability for Vela to integrate with different supported Source control providers.

Usage:

import "github.com/go-vela/server/source"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToContext

func ToContext(c Setter, s Service)

ToContext adds the source Service to this context if it supports the Setter interface.

Types

type Service

type Service interface {

	// Authorize defines a function that uses the
	// given access token to authorize the user.
	Authorize(string) (string, error)
	// Authenticate defines a function that completes
	// the OAuth workflow for the session.
	Authenticate(http.ResponseWriter, *http.Request, string) (*library.User, error)
	// Login defines a function that begins
	// the OAuth workflow for the session.
	Login(http.ResponseWriter, *http.Request) (string, error)
	// LoginCLI defines a function that begins
	// the OAuth workflow for the session.
	LoginCLI(string, string, string) (*library.User, error)

	// OrgAccess defines a function that captures
	// the user's access level for an org.
	OrgAccess(*library.User, string) (string, error)
	// RepoAccess defines a function that captures
	// the user's access level for a repo.
	RepoAccess(*library.User, string, string) (string, error)
	// TeamAccess defines a function that captures
	// the user's access level for a team.
	TeamAccess(*library.User, string, string) (string, error)

	// Changeset defines a function that captures the list
	// of files changed for a commit.
	//
	// https://en.wikipedia.org/wiki/Changeset.
	Changeset(*library.User, *library.Repo, string) ([]string, error)
	// ChangesetPR defines a function that captures the list
	// of files changed for a pull request.
	//
	// https://en.wikipedia.org/wiki/Changeset.
	ChangesetPR(*library.User, *library.Repo, int) ([]string, error)

	// GetDeployment defines a function that
	// gets a deployment by number and repo.
	GetDeployment(*library.User, *library.Repo, int64) (*library.Deployment, error)
	// GetDeploymentCount defines a function that
	// counts a list of all deployment for a repo.
	GetDeploymentCount(*library.User, *library.Repo) (int64, error)
	// GetDeploymentList defines a function that gets
	// a list of all deployments for a repo.
	GetDeploymentList(*library.User, *library.Repo, int, int) ([]*library.Deployment, error)
	// CreateDeployment defines a function that
	// creates a new deployment.
	CreateDeployment(*library.User, *library.Repo, *library.Deployment) error

	// Config defines a function that captures
	// the pipeline configuration from a repo.
	Config(user *library.User, org, name, ref string) ([]byte, error)
	// ConfigBackoff is a truncated constant backoff wrapper for Config.
	// Retry again in five seconds if Config fails to retrieve yaml/yml file.
	// Will return an error after five failed attempts.
	ConfigBackoff(user *library.User, org, name, ref string) ([]byte, error)
	// Disable defines a function that deactivates
	// a repo by destroying the webhook.
	Disable(*library.User, string, string) error
	// Enable defines a function that activates
	// a repo by creating the webhook.
	Enable(*library.User, string, string, string) (string, error)
	// Status defines a function that sends the
	// commit status for the given SHA from a repo.
	Status(*library.User, *library.Build, string, string) error
	// ListUserRepos defines a function that retrieves
	// all repos with admin rights for the user.
	ListUserRepos(*library.User) ([]*library.Repo, error)
	// GetPullRequest defines a function that retrieves
	// a pull request for a repo.
	GetPullRequest(*library.User, *library.Repo, int) (string, string, string, string, error)

	// ProcessWebhook defines a function that
	// parses the webhook from a repo.
	ProcessWebhook(*http.Request) (*types.Webhook, error)
	// VerifyWebhook defines a function that
	// verifies the webhook from a repo.
	VerifyWebhook(*http.Request, *library.Repo) error
}

Service represents the interface for Vela integrating with the different supported source providers.

func FromContext

func FromContext(c context.Context) Service

FromContext returns the source Service associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Directories

Path Synopsis
Package github provides the ability for Vela to integrate with GitHub or GitHub Enterprise as a source provider.
Package github provides the ability for Vela to integrate with GitHub or GitHub Enterprise as a source provider.

Jump to

Keyboard shortcuts

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