gitlab

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

README

Gitlab

Supported

  • ACL (Access Control List) on project or group

  • /ok-to-test support from allowed users

  • /retest support.

  • /retest on a non owner mr from a owner will retest it but subsequent submissions would not be allowed. (only ok-to-test allows it)

  • OWNERS files

  • Report build status on MR if token has access of submitted source

  • Report pull request status via comments if no access

  • Get files via APIs

  • Webhook via api token attached to repo secret

  • Auto secret attached for git-clone support on private repo.

  • Private instance is supported, the private instance is not required to be specified in config since auto detect but if for whatever reason you want to set another api url you can do this on Repository :

    kind: Repository
    spec:
      url: https://apiurl/project/repo
      provider:
        url: https://apiurl
        secret:
          name: secret-ref
          key: token
    

TODO

Until there is a ask for it
  • /ok-to-test in threads comments (only top level comment is supported atm).
  • caching API calls for permissions.

NOTES

  • since orgs may have subpaths we switch the / to - so we can use it for the pac automatic secret and label. Sucks a bit but such is life

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Client *gitlab.Client
	Logger *zap.SugaredLogger

	Token *string
	// contains filtered or unexported fields
}

func (*Provider) CheckPolicyAllowing added in v0.20.0

func (v *Provider) CheckPolicyAllowing(_ context.Context, _ *info.Event, _ []string) (bool, string)

CheckPolicyAllowing TODO: Implement ME.

func (*Provider) CreateStatus

func (v *Provider) CreateStatus(_ context.Context, event *info.Event, statusOpts provider.StatusOpts,
) error

func (*Provider) CreateToken added in v0.19.0

func (v *Provider) CreateToken(_ context.Context, _ []string, _ *info.Event) (string, error)

func (*Provider) Detect

func (v *Provider) Detect(req *http.Request, payload string, logger *zap.SugaredLogger) (bool, bool, *zap.SugaredLogger, string, error)

Detect processes event and detect if it is a gitlab event, whether to process or reject it returns (if is a GL event, whether to process or reject, logger with event metadata,, error if any occurred).

func (*Provider) GetCommitInfo

func (v *Provider) GetCommitInfo(_ context.Context, runevent *info.Event) error

func (*Provider) GetConfig

func (v *Provider) GetConfig() *info.ProviderConfig

func (*Provider) GetFileInsideRepo

func (v *Provider) GetFileInsideRepo(_ context.Context, runevent *info.Event, path, _ string) (string, error)

func (*Provider) GetFiles added in v0.12.0

func (v *Provider) GetFiles(_ context.Context, runevent *info.Event) (changedfiles.ChangedFiles, error)

func (*Provider) GetTaskURI added in v0.13.0

func (v *Provider) GetTaskURI(_ context.Context, _ *info.Event, _ string) (bool, string, error)

GetTaskURI TODO: Implement me.

func (*Provider) GetTektonDir

func (v *Provider) GetTektonDir(_ context.Context, event *info.Event, path, provenance string) (string, error)

func (*Provider) IsAllowed

func (v *Provider) IsAllowed(ctx context.Context, event *info.Event) (bool, error)

func (*Provider) IsAllowedOwnersFile added in v0.22.1

func (v *Provider) IsAllowedOwnersFile(_ context.Context, event *info.Event) (bool, error)

IsAllowedOwnersFile get the owner files (OWNERS, OWNERS_ALIASES) from main branch and check if we have explicitly allowed the user in there.

func (*Provider) ParsePayload

func (v *Provider) ParsePayload(_ context.Context, _ *params.Run, request *http.Request,
	payload string,
) (*info.Event, error)

func (*Provider) SetClient

func (v *Provider) SetClient(_ context.Context, run *params.Run, runevent *info.Event, _ *v1alpha1.Repository, _ *events.EventEmitter) error

func (*Provider) SetLogger

func (v *Provider) SetLogger(logger *zap.SugaredLogger)

func (*Provider) SetPacInfo added in v0.26.0

func (v *Provider) SetPacInfo(pacInfo *info.PacOpts)

func (*Provider) Validate

func (v *Provider) Validate(_ context.Context, _ *params.Run, event *info.Event) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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