commit
f647e9ac0e
30 changed files with 58 additions and 58 deletions
|
@ -4,7 +4,7 @@
|
|||
local golang = "golang:1.11";
|
||||
|
||||
# defines a temporary volume so that the Go cache can
|
||||
# be shared with all pipeine steps.
|
||||
# be shared with all pipeline steps.
|
||||
local volumes = [
|
||||
{
|
||||
name: "gopath",
|
||||
|
|
|
@ -82,7 +82,7 @@ func main() {
|
|||
Errorln("cannot ping the docker daemon")
|
||||
time.Sleep(time.Second)
|
||||
} else {
|
||||
logrus.Debugln("succussfully pinged the docker daemon")
|
||||
logrus.Debugln("successfully pinged the docker daemon")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
// helper funciton configures the logging.
|
||||
// helper function configures the logging.
|
||||
func initLogging(c config.Config) {
|
||||
if c.Logging.Debug {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
|
|
@ -128,7 +128,7 @@ func isKubernetes() bool {
|
|||
return os.Getenv("KUBERNETES_SERVICE_HOST") != ""
|
||||
}
|
||||
|
||||
// helper funciton configures the logging.
|
||||
// helper function configures the logging.
|
||||
func initLogging(c config.Config) {
|
||||
if c.Logging.Debug {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
|
|
@ -36,7 +36,7 @@ var loginSet = wire.NewSet(
|
|||
)
|
||||
|
||||
// provideLogin is a Wire provider function that returns an
|
||||
// autenticator based on the environment configuration.
|
||||
// authenticator based on the environment configuration.
|
||||
func provideLogin(config config.Config) login.Middleware {
|
||||
switch {
|
||||
case config.Bitbucket.ClientID != "":
|
||||
|
@ -57,7 +57,7 @@ func provideLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideBitbucketLogin is a Wire provider function that
|
||||
// returns a Bitbucket Cloud autenticator based on the
|
||||
// returns a Bitbucket Cloud authenticator based on the
|
||||
// environment configuration.
|
||||
func provideBitbucketLogin(config config.Config) login.Middleware {
|
||||
if config.Bitbucket.ClientID == "" {
|
||||
|
@ -71,7 +71,7 @@ func provideBitbucketLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideGithubLogin is a Wire provider function that returns
|
||||
// a GitHub autenticator based on the environment configuration.
|
||||
// a GitHub authenticator based on the environment configuration.
|
||||
func provideGithubLogin(config config.Config) login.Middleware {
|
||||
if config.Github.ClientID == "" {
|
||||
return nil
|
||||
|
@ -87,7 +87,7 @@ func provideGithubLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideGiteaLogin is a Wire provider function that returns
|
||||
// a Gitea autenticator based on the environment configuration.
|
||||
// a Gitea authenticator based on the environment configuration.
|
||||
func provideGiteaLogin(config config.Config) login.Middleware {
|
||||
if config.Gitea.Server == "" {
|
||||
return nil
|
||||
|
@ -112,7 +112,7 @@ func provideGiteaLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideGitlabLogin is a Wire provider function that returns
|
||||
// a GitLab autenticator based on the environment configuration.
|
||||
// a GitLab authenticator based on the environment configuration.
|
||||
func provideGitlabLogin(config config.Config) login.Middleware {
|
||||
if config.GitLab.ClientID == "" {
|
||||
return nil
|
||||
|
@ -127,7 +127,7 @@ func provideGitlabLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideGogsLogin is a Wire provider function that returns
|
||||
// a Gogs autenticator based on the environment configuration.
|
||||
// a Gogs authenticator based on the environment configuration.
|
||||
func provideGogsLogin(config config.Config) login.Middleware {
|
||||
if config.Gogs.Server == "" {
|
||||
return nil
|
||||
|
@ -141,7 +141,7 @@ func provideGogsLogin(config config.Config) login.Middleware {
|
|||
}
|
||||
|
||||
// provideStashLogin is a Wire provider function that returns
|
||||
// a Stash autenticator based on the environment configuration.
|
||||
// a Stash authenticator based on the environment configuration.
|
||||
func provideStashLogin(config config.Config) login.Middleware {
|
||||
if config.Stash.ConsumerKey == "" {
|
||||
return nil
|
||||
|
|
|
@ -131,7 +131,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
// helper funciton configures the logging.
|
||||
// helper function configures the logging.
|
||||
func initLogging(c config.Config) {
|
||||
if c.Logging.Debug {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
|
|
@ -18,7 +18,7 @@ import "context"
|
|||
|
||||
// AdmissionService grants access to the system. The service can
|
||||
// be used to restrict access to authorized users, such as
|
||||
// members of an organiozation in your soruce control management
|
||||
// members of an organization in your source control management
|
||||
// system.
|
||||
type AdmissionService interface {
|
||||
Admit(context.Context, *User) error
|
||||
|
|
|
@ -47,7 +47,7 @@ type (
|
|||
}
|
||||
|
||||
// PermStore defines operations for working with
|
||||
// repostiory permissions.
|
||||
// repository permissions.
|
||||
PermStore interface {
|
||||
// Find returns a project member from the
|
||||
// datastore.
|
||||
|
|
|
@ -23,7 +23,7 @@ type Message struct {
|
|||
Data []byte
|
||||
}
|
||||
|
||||
// Pubsub provides publish subscriber capablities, distributing
|
||||
// Pubsub provides publish subscriber capabilities, distributing
|
||||
// messages from multiple publishers to multiple subscribers.
|
||||
type Pubsub interface {
|
||||
// Publish publishes the message to all subscribers.
|
||||
|
|
|
@ -77,7 +77,7 @@ type (
|
|||
ListRecent(context.Context, int64) ([]*Repository, error)
|
||||
|
||||
// ListIncomplete returns a non-unique repository list form
|
||||
// the datastore with incmoplete builds.
|
||||
// the datastore with incomplete builds.
|
||||
ListIncomplete(context.Context) ([]*Repository, error)
|
||||
|
||||
// Find returns a repository from the datastore.
|
||||
|
|
|
@ -16,7 +16,7 @@ package core
|
|||
|
||||
import "context"
|
||||
|
||||
// Syncer synchonrizes the account repository list.
|
||||
// Syncer synchronizes the account repository list.
|
||||
type Syncer interface {
|
||||
Sync(context.Context, *User) (*Batch, error)
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ func InjectRepository(
|
|||
if err != nil {
|
||||
log.WithError(err).Debugln("api: cannot cache repository permissions")
|
||||
} else {
|
||||
log.Debugln("api: repository permissions synchrnoized")
|
||||
log.Debugln("api: repository permissions synchronized")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/drone/drone/logger"
|
||||
)
|
||||
|
||||
// HandleAuthentication returns an http.HandlerFunc middlewrae that authenticates
|
||||
// HandleAuthentication returns an http.HandlerFunc middleware that authenticates
|
||||
// the http.Request and errors if the account cannot be authenticated.
|
||||
func HandleAuthentication(session core.Session) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
|
|
|
@ -29,7 +29,7 @@ type CCProject struct {
|
|||
WebURL string `xml:"webUrl,attr"`
|
||||
}
|
||||
|
||||
// New creates a new CCPojrect from the Repository and Build details.
|
||||
// New creates a new CCProject from the Repository and Build details.
|
||||
func New(r *core.Repository, b *core.Build, link string) *CCProjects {
|
||||
proj := &CCProject{
|
||||
Name: r.Slug,
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
// HandleRepair returns an http.HandlerFunc that processes http
|
||||
// requests to repair the repository hooks and sync the repository
|
||||
// deetails.
|
||||
// details.
|
||||
func HandleRepair(
|
||||
hooks core.HookService,
|
||||
repoz core.RepositoryService,
|
||||
|
|
|
@ -39,7 +39,7 @@ func HandleSync(syncer core.Syncer, repos core.RepositoryStore) http.HandlerFunc
|
|||
_, err := syncer.Sync(ctx, viewer)
|
||||
if err != nil {
|
||||
logger.FromContext(ctx).WithError(err).
|
||||
Debugln("api: cannot synchrnoize account")
|
||||
Debugln("api: cannot synchronize account")
|
||||
}
|
||||
}(ctx, viewer)
|
||||
w.WriteHeader(204)
|
||||
|
@ -50,7 +50,7 @@ func HandleSync(syncer core.Syncer, repos core.RepositoryStore) http.HandlerFunc
|
|||
if err != nil {
|
||||
render.InternalError(w, err)
|
||||
logger.FromRequest(r).WithError(err).
|
||||
Warnln("api: cannot synchrnoize account")
|
||||
Warnln("api: cannot synchronize account")
|
||||
return
|
||||
}
|
||||
list, err := repos.List(r.Context(), viewer.ID)
|
||||
|
|
|
@ -141,7 +141,7 @@ func HandleLogin(
|
|||
user.Expiry = tok.Expires.Unix()
|
||||
}
|
||||
|
||||
// If the user account has never been synchrnoized we
|
||||
// If the user account has never been synchronized we
|
||||
// execute the synchonrization logic.
|
||||
if time.Unix(user.Synced, 0).Add(syncPeriod).Before(time.Now()) {
|
||||
user.Syncing = true
|
||||
|
|
|
@ -438,7 +438,7 @@ func (m *Manager) Netrc(ctx context.Context, id int64) (*core.Netrc, error) {
|
|||
if err != nil {
|
||||
logger = logger.WithError(err)
|
||||
logger = logger.WithField("repo.name", repo.Slug)
|
||||
logger.Warnln("manager: cannot gernerate netrc")
|
||||
logger.Warnln("manager: cannot generate netrc")
|
||||
}
|
||||
return netrc, err
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ func (s *Client) Before(ctx context.Context, step *core.Step) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// the step ID and version (optomistic locking) are
|
||||
// the step ID and version (optimistic locking) are
|
||||
// updated when the step is created. Copy the updated
|
||||
// values back to the original step object.
|
||||
step.ID = out.ID
|
||||
|
@ -138,7 +138,7 @@ func (s *Client) After(ctx context.Context, step *core.Step) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// the step version (optomistic locking) is updated
|
||||
// the step version (optimistic locking) is updated
|
||||
// when the step is created. Copy the updated values
|
||||
// back to the original step object.
|
||||
step.Version = out.Version
|
||||
|
@ -173,7 +173,7 @@ func (s *Client) AfterAll(ctx context.Context, stage *core.Stage) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// the stage timestamps and version (optomistic locking)
|
||||
// the stage timestamps and version (optimistic locking)
|
||||
// are updated when the step is created. Copy the updated
|
||||
// values back to the original step object.
|
||||
stage.Version = out.Version
|
||||
|
@ -237,7 +237,7 @@ func (s *Client) send(ctx context.Context, path string, in, out interface{}) err
|
|||
}
|
||||
|
||||
// Check the response for a 409 conflict. This indicates an
|
||||
// optimtistic lock error, in which case multiple clients may
|
||||
// optimistic lock error, in which case multiple clients may
|
||||
// be attempting to update the same record. Convert this error
|
||||
// code to a proper error.
|
||||
if res.StatusCode == 409 {
|
||||
|
|
|
@ -342,7 +342,7 @@ func TestAfterAll(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestBefore_OptomisticLock(t *testing.T) {
|
||||
func TestBefore_OptimisticLock(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
gock.New("http://drone.company.com").
|
||||
|
@ -353,14 +353,14 @@ func TestBefore_OptomisticLock(t *testing.T) {
|
|||
gock.InterceptClient(client.client.HTTPClient)
|
||||
err := client.Before(noContext, new(core.Step))
|
||||
if err != db.ErrOptimisticLock {
|
||||
t.Errorf("Want optomistic lock error")
|
||||
t.Errorf("Want optimistic lock error")
|
||||
}
|
||||
if gock.IsPending() {
|
||||
t.Errorf("Unfinished requests")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAfter_OptomisticLock(t *testing.T) {
|
||||
func TestAfter_OptimisticLock(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
gock.New("http://drone.company.com").
|
||||
|
@ -371,14 +371,14 @@ func TestAfter_OptomisticLock(t *testing.T) {
|
|||
gock.InterceptClient(client.client.HTTPClient)
|
||||
err := client.After(noContext, new(core.Step))
|
||||
if err != db.ErrOptimisticLock {
|
||||
t.Errorf("Want optomistic lock error")
|
||||
t.Errorf("Want optimistic lock error")
|
||||
}
|
||||
if gock.IsPending() {
|
||||
t.Errorf("Unfinished requests")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBeforeAll_OptomisticLock(t *testing.T) {
|
||||
func TestBeforeAll_OptimisticLock(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
gock.New("http://drone.company.com").
|
||||
|
@ -389,14 +389,14 @@ func TestBeforeAll_OptomisticLock(t *testing.T) {
|
|||
gock.InterceptClient(client.client.HTTPClient)
|
||||
err := client.BeforeAll(noContext, new(core.Stage))
|
||||
if err != db.ErrOptimisticLock {
|
||||
t.Errorf("Want optomistic lock error")
|
||||
t.Errorf("Want optimistic lock error")
|
||||
}
|
||||
if gock.IsPending() {
|
||||
t.Errorf("Unfinished requests")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAfterAll_OptomisticLock(t *testing.T) {
|
||||
func TestAfterAll_OptimisticLock(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
gock.New("http://drone.company.com").
|
||||
|
@ -407,7 +407,7 @@ func TestAfterAll_OptomisticLock(t *testing.T) {
|
|||
gock.InterceptClient(client.client.HTTPClient)
|
||||
err := client.AfterAll(noContext, new(core.Stage))
|
||||
if err != db.ErrOptimisticLock {
|
||||
t.Errorf("Want optomistic lock error")
|
||||
t.Errorf("Want optimistic lock error")
|
||||
}
|
||||
if gock.IsPending() {
|
||||
t.Errorf("Unfinished requests")
|
||||
|
|
|
@ -517,7 +517,7 @@ func (r *Runner) Run(ctx context.Context, id int64) error {
|
|||
}
|
||||
|
||||
// Start starts N build runner processes. Each process polls
|
||||
// the server for pednding builds to execute.
|
||||
// the server for pending builds to execute.
|
||||
func (r *Runner) Start(ctx context.Context, n int) error {
|
||||
var g errgroup.Group
|
||||
for i := 0; i < n; i++ {
|
||||
|
@ -536,7 +536,7 @@ func (r *Runner) start(ctx context.Context) error {
|
|||
default:
|
||||
// This error is ignored on purpose. The system
|
||||
// should not exit the runner on error. The run
|
||||
// funciton logs all errors, which should be enough
|
||||
// function logs all errors, which should be enough
|
||||
// to surface potential issues to an administrator.
|
||||
r.poll(ctx)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
// user is a human being.
|
||||
var ErrCannotVerify = errors.New("Cannot verify user authenticity")
|
||||
|
||||
// Nobot enfoces an admission policy that restricts access to
|
||||
// Nobot enforces an admission policy that restricts access to
|
||||
// users accounts that were recently created and may be bots.
|
||||
// The policy expects the source control management system will
|
||||
// identify and remove the bot accounts before they would be
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
// user account and admissions are closed.
|
||||
var ErrClosed = errors.New("User registration is disabled")
|
||||
|
||||
// Open enfoces an open admission policy by default unless
|
||||
// Open enforces an open admission policy by default unless
|
||||
// disabled.
|
||||
func Open(disabled bool) core.AdmissionService {
|
||||
return &closed{disabled: disabled}
|
||||
|
|
|
@ -44,7 +44,7 @@ func (c *combined) List(ctx context.Context, req *core.RegistryArgs) ([]*core.Re
|
|||
}
|
||||
// if trace level debugging is enabled we print
|
||||
// all registry credentials retrieved from the
|
||||
// various registy sources.
|
||||
// various registry sources.
|
||||
logger := logger.FromContext(ctx)
|
||||
if logrus.IsLevelEnabled(logrus.TraceLevel) {
|
||||
if len(all) == 0 {
|
||||
|
|
|
@ -49,7 +49,7 @@ import (
|
|||
// TODO(bradrydzewski): gitea, push hook missing repository html url
|
||||
|
||||
// TODO(bradrydzewski): bitbucket, pull request hook missing author email.
|
||||
// TODO(bradrydzewski): bitbucket, hooks missing defualt repository branch.
|
||||
// TODO(bradrydzewski): bitbucket, hooks missing default repository branch.
|
||||
|
||||
// TODO(bradrydzewski): github, push hook timestamp is negative value.
|
||||
// TODO(bradrydzewski): github, pull request message is empty
|
||||
|
|
|
@ -38,7 +38,7 @@ func convertRepository(src *scm.Repository) *core.Repository {
|
|||
}
|
||||
|
||||
// convertVisibility is a helper function that returns the
|
||||
// repository visibliity based on the privacy flag.
|
||||
// repository visibility based on the privacy flag.
|
||||
func convertVisibility(src *scm.Repository) string {
|
||||
switch {
|
||||
case src.Private == true:
|
||||
|
|
|
@ -55,7 +55,7 @@ func (s *Synchronizer) SetFilter(fn FilterFunc) {
|
|||
s.match = fn
|
||||
}
|
||||
|
||||
// Sync synchonrizes the user repository list in 6 easy steps.
|
||||
// Sync synchronizes the user repository list in 6 easy steps.
|
||||
func (s *Synchronizer) Sync(ctx context.Context, user *core.User) (*core.Batch, error) {
|
||||
logger := logrus.WithField("login", user.Login)
|
||||
logger.Debugln("syncer: begin repository sync")
|
||||
|
|
|
@ -121,7 +121,7 @@ func (db *DB) Driver() Driver {
|
|||
return db.driver
|
||||
}
|
||||
|
||||
// Close cloes the database connection.
|
||||
// Close closes the database connection.
|
||||
func (db *DB) Close() error {
|
||||
return db.conn.Close()
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ func TestCron(t *testing.T) {
|
|||
defer controller.Finish()
|
||||
|
||||
checkBuild := func(_ context.Context, _ *core.Repository, hook *core.Hook) {
|
||||
ignoreHookFileds := cmpopts.IgnoreFields(core.Hook{},
|
||||
ignoreHookFields := cmpopts.IgnoreFields(core.Hook{},
|
||||
"Source", "Before")
|
||||
if diff := cmp.Diff(hook, dummyHook, ignoreHookFileds); diff != "" {
|
||||
if diff := cmp.Diff(hook, dummyHook, ignoreHookFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func TestCron_Cancel(t *testing.T) {
|
|||
|
||||
// This unit tests demonstrates that if an error is encountered
|
||||
// when returning a list of ready cronjobs, the process exits
|
||||
// immadiately with an error message.
|
||||
// immediately with an error message.
|
||||
func TestCron_ErrorList(t *testing.T) {
|
||||
controller := gomock.NewController(t)
|
||||
defer controller.Finish()
|
||||
|
@ -484,6 +484,6 @@ var (
|
|||
},
|
||||
}
|
||||
|
||||
ignoreBuildFileds = cmpopts.IgnoreFields(core.Build{},
|
||||
ignoreBuildFields = cmpopts.IgnoreFields(core.Build{},
|
||||
"Created", "Updated")
|
||||
)
|
||||
|
|
|
@ -77,7 +77,7 @@ func skipMessageEval(str string) bool {
|
|||
// func skipPaths(document *config.Config, paths []string) bool {
|
||||
// switch {
|
||||
// // changed files are only returned for push and pull request
|
||||
// // events. If the list of changed files is empty the sytem will
|
||||
// // events. If the list of changed files is empty the system will
|
||||
// // force-run all pipelines and pipeline steps
|
||||
// case len(paths) == 0:
|
||||
// return false
|
||||
|
|
|
@ -33,19 +33,19 @@ func TestTrigger(t *testing.T) {
|
|||
defer controller.Finish()
|
||||
|
||||
checkBuild := func(_ context.Context, build *core.Build, stages []*core.Stage) {
|
||||
if diff := cmp.Diff(build, dummyBuild, ignoreBuildFileds); diff != "" {
|
||||
if diff := cmp.Diff(build, dummyBuild, ignoreBuildFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
if diff := cmp.Diff(stages, dummyStages, ignoreStageFileds); diff != "" {
|
||||
if diff := cmp.Diff(stages, dummyStages, ignoreStageFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
}
|
||||
|
||||
checkStatus := func(_ context.Context, _ *core.User, req *core.StatusInput) error {
|
||||
if diff := cmp.Diff(req.Build, dummyBuild, ignoreBuildFileds); diff != "" {
|
||||
if diff := cmp.Diff(req.Build, dummyBuild, ignoreBuildFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
if diff := cmp.Diff(req.Repo, dummyRepo, ignoreStageFileds); diff != "" {
|
||||
if diff := cmp.Diff(req.Repo, dummyRepo, ignoreStageFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
return nil
|
||||
|
@ -88,7 +88,7 @@ func TestTrigger(t *testing.T) {
|
|||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if diff := cmp.Diff(build, dummyBuild, ignoreBuildFileds); diff != "" {
|
||||
if diff := cmp.Diff(build, dummyBuild, ignoreBuildFields); diff != "" {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
}
|
||||
|
@ -487,9 +487,9 @@ var (
|
|||
Data: "kind: pipeline\ntrigger: { event: { exclude: push } }",
|
||||
}
|
||||
|
||||
ignoreBuildFileds = cmpopts.IgnoreFields(core.Build{},
|
||||
ignoreBuildFields = cmpopts.IgnoreFields(core.Build{},
|
||||
"Created", "Updated")
|
||||
|
||||
ignoreStageFileds = cmpopts.IgnoreFields(core.Stage{},
|
||||
ignoreStageFields = cmpopts.IgnoreFields(core.Stage{},
|
||||
"Created", "Updated")
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue