ci

package
v0.0.0-...-4df811a Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubCINbSlots    = 5
	GithubCISLotLength = 64 * 1024
)
View Source
const (
	OPTION_KEY_BASE_URL = "base_url"
	OPTION_KEY_API_KEY  = "api_key"
	OPTION_KEY_PROJECT  = "project"
)
View Source
const (
	SLOT_SIZE = 1024
	N_SLOTS   = 5
)

Variables

View Source
var (
	ErrorMissingCiInformation error = errors.New("missing CI information")
	ErrorNoCIServiceWithName        = errors.New(
		"no ci service with that name",
	)
	ErrorUnknownServiceType      = errors.New("unknown service type")
	ErrorInvalidServiceType      = errors.New("invalid service type")
	ErrorNoCIServices            = errors.New("no ci services")
	ErrorNoSecretsForEnvironment = errors.New(
		"no secrets for environment",
	)
)
View Source
var (
	ErrorGithubCIPermissionDenied error = errors.New(
		"you don't have rights to send secrets to the repo. Please ensure your personal access token has access to \"repo\" scope",
	)
	ErrorGithubCINoSuchRepository = errors.New(
		"you are trying to send secret to a repository that doesn't exist. Please make sure repo's name and owner is correct",
	)
	ErrorGithubCITooLarge = errors.New(
		"secrets and files are too large to send to CI",
	)
)

Functions

func AddCiService

func AddCiService(ctx *core.Context, service CiService) (err error)

AddCiService adds a CI service configuration to the keystone file

func FindCiServiceWithName

func FindCiServiceWithName(
	ctx *core.Context,
	name string,
) (service keystonefile.CiService, found bool)

FindCiServiceWithName returns the CI service configuration matching `name`

func ListCiServices

func ListCiServices(ctx *core.Context) (_ []keystonefile.CiService, err error)

ListCiServices returns the list of configured CI services

func RemoveCiService

func RemoveCiService(ctx *core.Context, serviceName string) (err error)

RemoveCiService remove the CI service configuration matching `serviceName` from the keystone file.

Types

type ApiKey

type ApiKey string

type CiService

type CiService interface {
	Name() string
	Type() string
	Usage() string
	Setup() CiService
	GetOptions() map[string]string

	PushSecret(message models.MessagePayload, environment string) CiService
	CleanSecret(environment string) CiService
	CheckSetup() CiService
	Error() error
}

func GenericCi

func GenericCi(ctx *core.Context, name string) CiService

GenericCi function returns an instance of genericCiService

func GetCiService

func GetCiService(
	serviceName string,
	ctx *core.Context,
	apiUrl string,
) (CiService, error)

GetCiService function returns an instance of CiService. The service name should be coming from config file, and will be used to determine the type of service to instanciate.

func GitHubCi

func GitHubCi(ctx *core.Context, name string, apiUrl string) CiService

GitHubCi function return a `CiService` that works with the GitHub API

func GitLabCi

func GitLabCi(ctx *core.Context, name string, apiUrl string) CiService

GitLabCi function return a `CiService` that works with the GitLab API

func PickCiService

func PickCiService(
	name string,
	ctx *core.Context,
	apiUrl string,
) (CiService, error)

Asks the user to pick a type of CI service among the available ones It returns a `CiService` instance ready to be setup, and an error

func SelectCiServiceConfiguration

func SelectCiServiceConfiguration(
	serviceName string,
	ctx *core.Context,
	apiUrl string,
) (CiService, error)

Asks the user the select a CI Service Configuration

type CiServiceType

type CiServiceType string
const GenericCI CiServiceType = "generic-ci"
const GithubCI CiServiceType = "github-ci"
const GitlabCI CiServiceType = "gitlab-ci"
const (
	StubCI CiServiceType = "stub-ci"
)

type GitlabOptions

type GitlabOptions struct {
	BaseUrl string `yaml:"base_url"`
	Project string `yaml:"project"`
}

type ServicesKeys

type ServicesKeys map[string]string

Jump to

Keyboard shortcuts

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