sdk

package
Version: v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: BSD-3-Clause Imports: 56 Imported by: 85

Documentation

Index

Constants

View Source
const (
	DefaultAction = "Default"
	BuiltinAction = "Builtin"
	PluginAction  = "Plugin"
	JoinedAction  = "Joined"
)

Action type

View Source
const (
	ScriptAction              = "Script"
	JUnitAction               = "JUnit"
	CoverageAction            = "Coverage"
	GitCloneAction            = "GitClone"
	GitTagAction              = "GitTag"
	ReleaseVCSAction          = "ReleaseVCS"
	CheckoutApplicationAction = "CheckoutApplication"
	DeployApplicationAction   = "DeployApplication"
	PushBuildInfo             = "PushBuildInfo"
	InstallKeyAction          = "InstallKey"
	ReleaseAction             = "Release"
	PromoteAction             = "Promote"

	DefaultGitCloneParameterTagValue = "{{.git.tag}}"
)

Builtin Action

View Source
const (
	SeverityUnknown    string = "unknown"
	SeverityNegligible string = "negligible"
	SeverityLow        string = "low"
	SeverityMedium     string = "medium"
	SeverityHigh       string = "high"
	SeverityCritical   string = "critical"
	SeverityDefcon1    string = "defcon1"
)
View Source
const (
	ArtifactUpload   = "Artifact Upload"
	ArtifactDownload = "Artifact Download"
	ServeStaticFiles = "Serve Static Files"

	ArtifactUploadPluginInputPath = "cds.integration.artifact_manager.upload.path"

	ArtifactUploadPluginOutputPathFileName = "name"
	ArtifactUploadPluginOutputPathFilePath = "path"
	ArtifactUploadPluginOutputPathRepoType = "repository_type"
	ArtifactUploadPluginOutputPathRepoName = "repository_name"
	ArtifactUploadPluginOutputPathMD5      = "md5"
	ArtifactUploadPluginOutputPerm         = "perm"
	ArtifactUploadPluginOutputSize         = "size"

	ArtifactDownloadPluginInputDestinationPath = "cds.integration.artifact_manager.download.destination.path"
	ArtifactDownloadPluginInputFilePath        = "cds.integration.artifact_manager.download.file.path"
	ArtifactDownloadPluginInputMd5             = "cds.integration.artifact_manager.download.file.md5"
	ArtifactDownloadPluginInputPerm            = "cds.integration.artifact_manager.download.file.perm"
)

Builtin artifact manipulation actions

View Source
const (
	AuditAdd    = "add"
	AuditUpdate = "update"
	AuditDelete = "delete"
)

Different type of Audit event

View Source
const (
	StatusPending           = "Pending"
	StatusWaiting           = "Waiting"
	StatusChecking          = "Checking" // DEPRECATED, to remove when removing pipelineBuild
	StatusBuilding          = "Building"
	StatusSuccess           = "Success"
	StatusFail              = "Fail"
	StatusDisabled          = "Disabled"
	StatusNeverBuilt        = "Never Built"
	StatusUnknown           = "Unknown"
	StatusSkipped           = "Skipped"
	StatusStopped           = "Stopped"
	StatusWorkerPending     = "Pending"
	StatusWorkerRegistering = "Registering"
)

Action status in queue

View Source
const (
	// PermissionRead  read permission on the resource
	PermissionRead = 4
	// PermissionReadExecute  read & execute permission on the resource
	PermissionReadExecute = 5
	// PermissionReadWriteExecute read/execute/write permission on the resource
	PermissionReadWriteExecute = 7
)
View Source
const (
	WebHookModelName              = "WebHook"
	RepositoryWebHookModelName    = "RepositoryWebHook"
	GerritHookModelName           = "GerritHook"
	SchedulerModelName            = "Scheduler"
	GitPollerModelName            = "Git Repository Poller"
	KafkaHookModelName            = "Kafka hook"
	RabbitMQHookModelName         = "RabbitMQ hook"
	WorkflowModelName             = "Workflow"
	HookConfigProject             = "project"
	HookConfigWorkflow            = "workflow"
	HookConfigTargetProject       = "target_project"
	HookConfigTargetWorkflow      = "target_workflow"
	HookConfigTargetHook          = "target_hook"
	HookConfigWorkflowID          = "workflow_id"
	HookConfigWebHookID           = "webHookID"
	HookConfigVCSServer           = "vcsServer"
	HookConfigEventFilter         = "eventFilter"
	HookConfigRepoFullName        = "repoFullName"
	HookConfigModelType           = "model_type"
	HookConfigModelName           = "model_name"
	HookConfigIcon                = "hookIcon"
	WebHookModelConfigMethod      = "method"
	RepositoryWebHookModelMethod  = "method"
	SchedulerModelCron            = "cron"
	SchedulerModelTimezone        = "timezone"
	Payload                       = "payload"
	HookModelIntegration          = "integration"
	KafkaHookModelConsumerGroup   = "consumer group"
	KafkaHookModelTopic           = "topic"
	RabbitMQHookModelQueue        = "queue"
	RabbitMQHookModelBindingKey   = "binding_key"
	RabbitMQHookModelExchangeType = "exchange_type"
	RabbitMQHookModelExchangeName = "exchange_name"
	RabbitMQHookModelConsumerTag  = "consumer_tag"
	SchedulerUsername             = "cds.scheduler"
	SchedulerFullname             = "CDS Scheduler"
)

These are constants about hooks

View Source
const (
	KafkaIntegrationModel           = "Kafka"
	RabbitMQIntegrationModel        = "RabbitMQ"
	OpenstackIntegrationModel       = "Openstack"
	AWSIntegrationModel             = "AWS"
	DefaultStorageIntegrationName   = "shared.infra"
	ArtifactoryIntegrationModelName = "Artifactory"

	ArtifactoryConfigPlatform              = "platform"
	ArtifactoryConfigURL                   = "url"
	ArtifactoryConfigTokenName             = "token.name"
	ArtifactoryConfigToken                 = "token"
	ArtifactoryConfigReleaseToken          = "release.token"
	ArtifactoryConfigCdsRepository         = "cds.repository"
	ArtifactoryConfigProjectKey            = "project.key"
	ArtifactoryConfigPromotionLowMaturity  = "promotion.maturity.low"
	ArtifactoryConfigPromotionHighMaturity = "promotion.maturity.high"
	ArtifactoryConfigBuildInfoPrefix       = "build.info.prefix"
)

This is the buitin integration model

View Source
const (
	IntegrationTypeEvent      = IntegrationType("event")
	IntegrationTypeCompute    = IntegrationType("compute")
	IntegrationTypeHook       = IntegrationType("hook")
	IntegrationTypeStorage    = IntegrationType("storage")
	IntegrationTypeDeployment = IntegrationType("deployment")
)
View Source
const (
	// IntegrationConfigTypeString represents a string configuration value
	IntegrationConfigTypeString = "string"
	// IntegrationConfigTypeText represents a text configuration value
	IntegrationConfigTypeText = "text"
	// IntegrationConfigTypePassword represents a password configuration value
	IntegrationConfigTypePassword = "password"
	// IntegrationConfigTypeBoolean represents a password configuration value
	IntegrationConfigTypeBoolean = "boolean"
	// IntegrationConfigTypeRegion represents a region requirement
	IntegrationConfigTypeRegion = "region"

	IntegrationVariablePrefixDeployment      = "deployment"
	IntegrationVariablePrefixArtifactManager = "artifact_manager"
)
View Source
const (
	MaintenanceAPIKey    string = "cds_maintenance_api"
	MaintenanceQueueName string = "cds_maintenance"
)
View Source
const (
	MetricKeyVulnerability = "Vulnerability"
	MetricKeyUnitTest      = "UnitTest"
	MetricKeyCoverage      = "Coverage"
)
View Source
const (
	// MigrationStatusTodo is the constant to indicate that the migration is "to do"
	MigrationStatusTodo string = "TODO"
	// MigrationStatusInProgress is the constant to indicate that the migration is "in progress"
	MigrationStatusInProgress string = "IN PROGRESS"
	// MigrationStatusDone is the constant to indicate that the migration is "done"
	MigrationStatusDone string = "DONE"
	// MigrationStatusCanceled is the constant to indicate that the migration is "canceled"
	MigrationStatusCanceled string = "CANCELED"
	// MigrationStatusNotExecuted is the constant to indicate that the migration is "not executed"
	MigrationStatusNotExecuted string = "NOT EXECUTED"
)
View Source
const (
	EmailUserNotification  = "email"
	JabberUserNotification = "jabber"
	VCSUserNotification    = "vcs"
	EventsNotification     = "event"
)

const

View Source
const (
	UserNotificationAlways = "always"
	UserNotificationNever  = "never"
	UserNotificationChange = "change"
)

const

View Source
const (
	EnvironmentParameter = "env"
	PipelineParameter    = "pipeline"
	ListParameter        = "list"
	NumberParameter      = "number"
	StringParameter      = "string"
	TextParameter        = "text"
	BooleanParameter     = "boolean"
	KeySSHParameter      = "ssh-key"
	KeyPGPParameter      = "pgp-key"
	KeyParameter         = "key"
)

Different type of Parameter

View Source
const (
	GRPCPluginDeploymentIntegration = "integration-deploy_application"
	GRPCPluginUploadArtifact        = "integration-upload_artifact"
	GRPCPluginDownloadArtifact      = "integration-download_artifact"
	GRPCPluginBuildInfo             = "integration-build_info"
	GRPCPluginRelease               = "integration-release"
	GRPCPluginPromote               = "integration-promote"
	GRPCPluginAction                = "action"
)

These are type of plugins

View Source
const (
	// ApplicationLastModificationType represent key for last update event about application
	ApplicationLastModificationType = "application"
	// PipelineLastModificationType represent key for last update event about pipeline
	PipelineLastModificationType = "pipeline"
	// WorkflowLastModificationType represent key for last update event about workflow
	WorkflowLastModificationType = "workflow"
	// ProjectLastModificationType represent key for last update event about project
	ProjectLastModificationType = "project"
	// ProjectPipelineLastModificationType represent key for last update event about project.pipeline (rename, delete or add a pipeline)
	ProjectPipelineLastModificationType = "project.pipeline"
	// ProjectApplicationLastModificationType represent key for last update event about project.application (rename, delete or add an application)
	ProjectApplicationLastModificationType = "project.application"
	// ProjectEnvironmentLastModificationType represent key for last update event about project.environment (rename, delete or add an environment)
	ProjectEnvironmentLastModificationType = "project.environment"
	// ProjectWorkflowLastModificationType represent key for last update event about project.workflow (rename, delete or add a workflow)
	ProjectWorkflowLastModificationType = "project.workflow"
	// ProjectVariableLastModificationType represent key for last update event about project.variable (rename, delete or add a variable)
	ProjectVariableLastModificationType = "project.variable"
	// ProjectKeysLastModificationType represent key for last update event about project.keys (add, delete a key)
	ProjectKeysLastModificationType = "project.keys"
	// ProjectIntegrationsLastModificationType represent key for last update event about project.integrations (add, update, delete a integration)
	ProjectIntegrationsLastModificationType = "project.integrations"
)
View Source
const (
	// ResponseWorkflowNameHeader is used as HTTP header
	ResponseWorkflowNameHeader = "X-Api-Workflow-Name"
	// ResponseWorkflowIDHeader is used as HTTP header
	ResponseWorkflowIDHeader = "X-Api-Workflow-Id"
	// WorkflowAsCodeHeader is used as HTTP header
	WorkflowAsCodeHeader = "X-Api-Workflow-As-Code"

	// ResponseTemplateGroupNameHeader is used as HTTP header
	ResponseTemplateGroupNameHeader = "X-Api-Template-Group-Name"
	// ResponseTemplateSlugHeader is used as HTTP header
	ResponseTemplateSlugHeader = "X-Api-Template-Slug"
)
View Source
const (
	//BinaryRequirement refers to the need to a specific binary on host running the action
	BinaryRequirement = "binary"
	// ModelRequirement refers to the need fo a specific model
	ModelRequirement = "model"
	// HostnameRequirement checks the hostname of the worker
	HostnameRequirement = "hostname"
	//PluginRequirement installs & checks plugins of the worker
	PluginRequirement = "plugin"
	//ServiceRequirement links a service to a worker
	ServiceRequirement = "service"
	//MemoryRequirement set memory limit on a container
	MemoryRequirement = "memory"
	// OSArchRequirement checks the 'dist' of a worker eg {GOOS}/{GOARCH}
	OSArchRequirement = "os-architecture"
	// RegionRequirement lets a use to force a job running in a hatchery's region
	RegionRequirement = "region"
)
View Source
const (
	TypeHooks         = "hooks"
	TypeRepositories  = "repositories"
	TypeElasticsearch = "elasticsearch"
	TypeVCS           = "vcs"
	TypeAPI           = "api"
	TypeUI            = "ui"
	TypeCDN           = "cdn"
	TypeHatchery      = "hatchery"
	TypeDBMigrate     = "dbmigrate"
)

Those are constant for services types

View Source
const (
	MonitoringStatusAlert = "AL"
	MonitoringStatusWarn  = "WARN"
	MonitoringStatusOK    = "OK"
)

This constants deals with Monitoring statuses

View Source
const (
	UserRingAdmin      = "ADMIN"
	UserRingMaintainer = "MAINTAINER"
	UserRingUser       = "USER"
)

User rings.

View Source
const (
	SecretVariable     = "password"
	TextVariable       = "text"
	StringVariable     = "string"
	KeyVariable        = "key"
	BooleanVariable    = "boolean"
	NumberVariable     = "number"
	RepositoryVariable = "repository"
)

Different type of Variable

View Source
const (
	HeaderXAccessToken        = "X-CDS-ACCESS-TOKEN"
	HeaderXAccessTokenCreated = "X-CDS-ACCESS-TOKEN-CREATED"
	HeaderXAccessTokenSecret  = "X-CDS-ACCESS-TOKEN-SECRET"
)

HTTP Headers

View Source
const (
	WarningMissingProjectVariableEnv               = "MISSING_PROJECT_VARIABLE_ENVIRONMENT"
	WarningMissingProjectVariableApplication       = "MISSING_PROJECT_VARIABLE_APPLICATION"
	WarningMissingProjectVariablePipelineParameter = "MISSING_PROJECT_VARIABLE_PIPELINE_PARAMETER"
	WarningMissingProjectVariablePipelineJob       = "MISSING_PROJECT_VARIABLE_PIPELINE_JOB"
	WarningMissingProjectVariableWorkflow          = "MISSING_PROJECT_VARIABLE_WORKFLOW"
	WarningUnusedProjectVariable                   = "UNUSED_PROJECT_VARIABLE"
	WarningMissingProjectPermissionEnv             = "MISSING_PROJECT_PERMISSION_ENV"
	WarningMissingProjectPermissionWorkflow        = "MISSING_PROJECT_PERMISSION_WORKFLOW"
	WarningMissingProjectKeyApplication            = "MISSING_PROJECT_KEY_APPLICATION"
	WarningMissingProjectKeyPipelineParameter      = "MISSING_PROJECT_KEY_PIPELINE_PARAMETER"
	WarningMissingProjectKeyPipelineJob            = "MISSING_PROJECT_KEY_PIPELINE_JOB"
	WarningUnusedProjectKey                        = "UNUSED_PROJECT_KEY"
	WarningMissingProjectVCSServer                 = "MISSING_PROJECT_VCS"
	WarningUnusedProjectVCSServer                  = "UNUSED_PROJECT_VCS"
	WarningMissingVCSConfiguration                 = "MISSING_VCS_CONFIGURATION"
	WarningMissingApplicationVariable              = "MISSING_APPLICATION_VARIABLE"
	WarningUnusedApplicationVariable               = "UNUSED_APPLICATION_VARIABLE"
	WarningMissingApplicationKey                   = "MISSING_APPLICATION_KEY"
	WarningUnusedApplicationKey                    = "UNUSED_APPLICATION_KEY"
	WarningMissingEnvironmentVariable              = "MISSING_ENVIRONMENT_VARIABLE"
	WarningUnusedEnvironmentVariable               = "UNUSED_ENVIRONMENT_VARIABLE"
	WarningMissingEnvironmentKey                   = "MISSING_ENVIRONMENT_KEY"
	WarningUnusedEnvironmentKey                    = "UNUSED_ENVIRONMENT_KEY"
	WarningMissingPipelineParameter                = "MISSING_PIPELINE_PARAMETER"
	WarningUnusedPipelineParameter                 = "UNUSED_PIPELINE_PARAMETER"
)
View Source
const (
	Docker      = "docker"
	HostProcess = "host"
	Openstack   = "openstack"
	VSphere     = "vsphere"
)

Existing worker model type

View Source
const (
	WorkflowConditionsOperatorEquals             = "eq"
	WorkflowConditionsOperatorNotEquals          = "ne"
	WorkflowConditionsOperatorLessThan           = "lt"
	WorkflowConditionsOperatorLessOrEqualThan    = "le"
	WorkflowConditionsOperatorGreaterThan        = "gt"
	WorkflowConditionsOperatorGreaterOrEqualThan = "ge"
	WorkflowConditionsOperatorRegex              = "regex"
)

WorkflowData conditions operator

View Source
const (
	GitlabIcon    = "Gitlab"
	GitHubIcon    = "Github"
	BitbucketIcon = "Bitbucket"
	GerritIcon    = "git"
)

Those are icon for hooks

View Source
const (
	// HookConfigTypeString type string
	HookConfigTypeString = "string"
	// HookConfigTypeIntegration type integration
	HookConfigTypeIntegration = "integration"
	// HookConfigTypeProject type project
	HookConfigTypeProject = "project"
	// HookConfigTypeWorkflow type workflow
	HookConfigTypeWorkflow = "workflow"
	// HookConfigTypeHook type hook
	HookConfigTypeHook = "hook"
	// HookConfigTypeMultiChoice type multiple
	HookConfigTypeMultiChoice = "multiple"
)
View Source
const (
	NodeTypePipeline     = "pipeline"
	NodeTypeJoin         = "join"
	NodeTypeOutGoingHook = "outgoinghook"
	NodeTypeFork         = "fork"
)
View Source
const (
	RunInfoTypInfo     = "Info"
	RunInfoTypeWarning = "Warning"
	RunInfoTypeError   = "Error"
)
View Source
const AuthSigninConsumerTokenDuration time.Duration = time.Minute * 5
View Source
const (
	CDSSessionID = "X-CDS-Session-ID"
)
View Source
const (
	DefaultHistoryLength int64 = 20
)

DefaultHistoryLength is the default history length

View Source
const DefaultWorkflowNodeRunReport = `` /* 833-byte string literal not displayed */
View Source
const IconFormat = "data:image/"

IconFormat is the format prefix accepted for icon

View Source
const MaxIconSize = 120000

MaxIconSize is the maximum size of the icon in octet

View Source
const NamePattern = "^[a-zA-Z0-9._-]{1,}$"

NamePattern Pattern for project/application/pipeline/group name

View Source
const NamePatternSpace = `^[\sa-zA-Z0-9._-]{1,}$`

NamePatternSpace Pattern for stage name

View Source
const (
	// Different types of warning for PipelineBuild
	OptionalStepFailed = "optional_step_failed"
)

This constant deals with pipelines

View Source
const (
	PasswordPlaceholder string = "**********"
)

Value of passwords when leaving the API

View Source
const ProjectKeyPattern = "^[A-Z0-9]{1,}$"

ProjectKeyPattern pattern for project key

View Source
const (
	// SecretMinLength is the minimal size of a secret
	// variable to be considered as a secret
	// a secret variable displayed, with less then 6, will
	// displayed, instead of appears as **cds.app.my-password**
	SecretMinLength = 6
)
View Source
const SharedInfraGroupName = "shared.infra"

SharedInfraGroupName is the name of the builtin group used to share infrastructure between projects

View Source
const URLGithubIssues = "https://github.com/ovh/cds/issues"

URLGithubIssues contains a link to CDS Issues

View Source
const URLGithubReleases = "https://github.com/ovh/cds/releases"

URLGithubReleases contains a link to CDS Official Releases

View Source
const UserContactTypeEmail = "email"
View Source
const WorkflowHookModelBuiltin = "builtin"

WorkflowHookModelBuiltin is a constant for the builtin hook models

Variables

View Source
var (
	StatusTerminated    = True
	StatusNotTerminated = False
)
View Source
var (
	True        = true
	False       = false
	TrueString  = "true"
	FalseString = "false"
)

True of false

View Source
var (
	ErrUnknownError                                  = Error{ID: 1, Status: http.StatusInternalServerError}
	ErrActionAlreadyUpdated                          = Error{ID: 2, Status: http.StatusBadRequest}
	ErrNoAction                                      = Error{ID: 3, Status: http.StatusNotFound}
	ErrActionLoop                                    = Error{ID: 4, Status: http.StatusBadRequest}
	ErrInvalidID                                     = Error{ID: 5, Status: http.StatusBadRequest}
	ErrInvalidProject                                = Error{ID: 6, Status: http.StatusBadRequest}
	ErrInvalidProjectKey                             = Error{ID: 7, Status: http.StatusBadRequest}
	ErrProjectHasPipeline                            = Error{ID: 8, Status: http.StatusForbidden}
	ErrProjectHasApplication                         = Error{ID: 9, Status: http.StatusForbidden}
	ErrUnauthorized                                  = Error{ID: 10, Status: http.StatusUnauthorized}
	ErrForbidden                                     = Error{ID: 11, Status: http.StatusForbidden}
	ErrPipelineNotFound                              = Error{ID: 12, Status: http.StatusBadRequest}
	ErrPipelineNotAttached                           = Error{ID: 13, Status: http.StatusBadRequest}
	ErrNoEnvironmentProvided                         = Error{ID: 14, Status: http.StatusBadRequest}
	ErrEnvironmentProvided                           = Error{ID: 15, Status: http.StatusBadRequest}
	ErrUnknownEnv                                    = Error{ID: 16, Status: http.StatusBadRequest}
	ErrEnvironmentExist                              = Error{ID: 17, Status: http.StatusForbidden}
	ErrNoPipelineBuild                               = Error{ID: 18, Status: http.StatusNotFound}
	ErrInvalidUsername                               = Error{ID: 21, Status: http.StatusBadRequest}
	ErrInvalidEmail                                  = Error{ID: 22, Status: http.StatusBadRequest}
	ErrGroupPresent                                  = Error{ID: 23, Status: http.StatusBadRequest}
	ErrInvalidName                                   = Error{ID: 24, Status: http.StatusBadRequest}
	ErrInvalidUser                                   = Error{ID: 25, Status: http.StatusBadRequest}
	ErrBuildArchived                                 = Error{ID: 26, Status: http.StatusBadRequest}
	ErrNoEnvironment                                 = Error{ID: 27, Status: http.StatusNotFound}
	ErrModelNameExist                                = Error{ID: 28, Status: http.StatusForbidden}
	ErrNoProject                                     = Error{ID: 30, Status: http.StatusNotFound}
	ErrVariableExists                                = Error{ID: 31, Status: http.StatusForbidden}
	ErrInvalidGroupPattern                           = Error{ID: 32, Status: http.StatusBadRequest}
	ErrGroupExists                                   = Error{ID: 33, Status: http.StatusForbidden}
	ErrNotEnoughAdmin                                = Error{ID: 34, Status: http.StatusBadRequest}
	ErrInvalidProjectName                            = Error{ID: 35, Status: http.StatusBadRequest}
	ErrInvalidApplicationPattern                     = Error{ID: 36, Status: http.StatusBadRequest}
	ErrInvalidPipelinePattern                        = Error{ID: 37, Status: http.StatusBadRequest}
	ErrNotFound                                      = Error{ID: 38, Status: http.StatusNotFound}
	ErrNoHook                                        = Error{ID: 40, Status: http.StatusNotFound}
	ErrNoAttachedPipeline                            = Error{ID: 41, Status: http.StatusNotFound}
	ErrNoReposManager                                = Error{ID: 42, Status: http.StatusNotFound}
	ErrNoReposManagerAuth                            = Error{ID: 43, Status: http.StatusUnauthorized}
	ErrNoReposManagerClientAuth                      = Error{ID: 44, Status: http.StatusForbidden}
	ErrRepoNotFound                                  = Error{ID: 45, Status: http.StatusNotFound}
	ErrSecretStoreUnreachable                        = Error{ID: 46, Status: http.StatusMethodNotAllowed}
	ErrSecretKeyFetchFailed                          = Error{ID: 47, Status: http.StatusMethodNotAllowed}
	ErrInvalidGoPath                                 = Error{ID: 48, Status: http.StatusBadRequest}
	ErrCommitsFetchFailed                            = Error{ID: 49, Status: http.StatusNotFound}
	ErrInvalidSecretFormat                           = Error{ID: 50, Status: http.StatusInternalServerError}
	ErrNoPreviousSuccess                             = Error{ID: 52, Status: http.StatusNotFound}
	ErrNoPermExecution                               = Error{ID: 53, Status: http.StatusForbidden}
	ErrInvalidSecretValue                            = Error{ID: 55, Status: http.StatusBadRequest}
	ErrPipelineHasApplication                        = Error{ID: 56, Status: http.StatusBadRequest}
	ErrNoDirectSecretUse                             = Error{ID: 57, Status: http.StatusForbidden}
	ErrNoBranch                                      = Error{ID: 58, Status: http.StatusNotFound}
	ErrLDAPConn                                      = Error{ID: 59, Status: http.StatusInternalServerError}
	ErrServiceUnavailable                            = Error{ID: 60, Status: http.StatusServiceUnavailable}
	ErrParseUserNotification                         = Error{ID: 61, Status: http.StatusBadRequest}
	ErrNotSupportedUserNotification                  = Error{ID: 62, Status: http.StatusBadRequest}
	ErrGroupNeedAdmin                                = Error{ID: 63, Status: http.StatusBadRequest}
	ErrGroupNeedWrite                                = Error{ID: 64, Status: http.StatusBadRequest}
	ErrNoVariable                                    = Error{ID: 65, Status: http.StatusNotFound}
	ErrPluginInvalid                                 = Error{ID: 66, Status: http.StatusBadRequest}
	ErrApplicationExist                              = Error{ID: 69, Status: http.StatusForbidden}
	ErrBranchNameNotProvided                         = Error{ID: 70, Status: http.StatusBadRequest}
	ErrInfiniteTriggerLoop                           = Error{ID: 71, Status: http.StatusBadRequest}
	ErrInvalidResetUser                              = Error{ID: 72, Status: http.StatusBadRequest}
	ErrUserConflict                                  = Error{ID: 73, Status: http.StatusBadRequest}
	ErrWrongRequest                                  = Error{ID: 74, Status: http.StatusBadRequest}
	ErrAlreadyExist                                  = Error{ID: 75, Status: http.StatusForbidden}
	ErrInvalidType                                   = Error{ID: 76, Status: http.StatusBadRequest}
	ErrParentApplicationAndPipelineMandatory         = Error{ID: 77, Status: http.StatusBadRequest}
	ErrNoParentBuildFound                            = Error{ID: 78, Status: http.StatusNotFound}
	ErrParameterExists                               = Error{ID: 79, Status: http.StatusForbidden}
	ErrNoHatchery                                    = Error{ID: 80, Status: http.StatusNotFound}
	ErrInvalidWorkerStatus                           = Error{ID: 81, Status: http.StatusNotFound}
	ErrInvalidToken                                  = Error{ID: 82, Status: http.StatusUnauthorized}
	ErrAppBuildingPipelines                          = Error{ID: 83, Status: http.StatusForbidden}
	ErrInvalidTimezone                               = Error{ID: 84, Status: http.StatusBadRequest}
	ErrEnvironmentCannotBeDeleted                    = Error{ID: 85, Status: http.StatusForbidden}
	ErrInvalidPipeline                               = Error{ID: 86, Status: http.StatusBadRequest}
	ErrKeyNotFound                                   = Error{ID: 87, Status: http.StatusNotFound}
	ErrPipelineAlreadyExists                         = Error{ID: 88, Status: http.StatusForbidden}
	ErrJobAlreadyBooked                              = Error{ID: 89, Status: http.StatusForbidden}
	ErrPipelineBuildNotFound                         = Error{ID: 90, Status: http.StatusNotFound}
	ErrAlreadyTaken                                  = Error{ID: 91, Status: http.StatusGone}
	ErrWorkflowNodeNotFound                          = Error{ID: 93, Status: http.StatusNotFound}
	ErrWorkflowInvalidRoot                           = Error{ID: 94, Status: http.StatusBadRequest}
	ErrWorkflowNodeRef                               = Error{ID: 95, Status: http.StatusBadRequest}
	ErrWorkflowInvalid                               = Error{ID: 96, Status: http.StatusBadRequest}
	ErrWorkflowNodeJoinNotFound                      = Error{ID: 97, Status: http.StatusNotFound}
	ErrInvalidJobRequirement                         = Error{ID: 98, Status: http.StatusBadRequest}
	ErrNotImplemented                                = Error{ID: 99, Status: http.StatusNotImplemented}
	ErrParameterNotExists                            = Error{ID: 100, Status: http.StatusNotFound}
	ErrUnknownKeyType                                = Error{ID: 101, Status: http.StatusBadRequest}
	ErrInvalidKeyPattern                             = Error{ID: 102, Status: http.StatusBadRequest}
	ErrWebhookConfigDoesNotMatch                     = Error{ID: 103, Status: http.StatusBadRequest}
	ErrPipelineUsedByWorkflow                        = Error{ID: 104, Status: http.StatusBadRequest}
	ErrMethodNotAllowed                              = Error{ID: 105, Status: http.StatusMethodNotAllowed}
	ErrInvalidNodeNamePattern                        = Error{ID: 106, Status: http.StatusBadRequest}
	ErrWorkflowNodeParentNotRun                      = Error{ID: 107, Status: http.StatusForbidden}
	ErrHookNotFound                                  = Error{ID: 108, Status: http.StatusNotFound}
	ErrDefaultGroupPermission                        = Error{ID: 109, Status: http.StatusBadRequest}
	ErrLastGroupWithWriteRole                        = Error{ID: 110, Status: http.StatusForbidden}
	ErrInvalidEmailDomain                            = Error{ID: 111, Status: http.StatusForbidden}
	ErrWorkflowNodeRunJobNotFound                    = Error{ID: 112, Status: http.StatusNotFound}
	ErrBuiltinKeyNotFound                            = Error{ID: 113, Status: http.StatusInternalServerError}
	ErrStepNotFound                                  = Error{ID: 114, Status: http.StatusNotFound}
	ErrWorkerModelAlreadyBooked                      = Error{ID: 115, Status: http.StatusForbidden}
	ErrConditionsNotOk                               = Error{ID: 116, Status: http.StatusBadRequest}
	ErrDownloadInvalidOS                             = Error{ID: 117, Status: http.StatusNotFound}
	ErrDownloadInvalidArch                           = Error{ID: 118, Status: http.StatusNotFound}
	ErrDownloadInvalidName                           = Error{ID: 119, Status: http.StatusNotFound}
	ErrDownloadDoesNotExist                          = Error{ID: 120, Status: http.StatusNotFound}
	ErrTokenNotFound                                 = Error{ID: 121, Status: http.StatusNotFound}
	ErrWorkflowNotificationNodeRef                   = Error{ID: 122, Status: http.StatusBadRequest}
	ErrInvalidJobRequirementDuplicateModel           = Error{ID: 123, Status: http.StatusBadRequest}
	ErrInvalidJobRequirementDuplicateHostname        = Error{ID: 124, Status: http.StatusBadRequest}
	ErrInvalidKeyName                                = Error{ID: 125, Status: http.StatusBadRequest}
	ErrRepoOperationTimeout                          = Error{ID: 126, Status: http.StatusRequestTimeout}
	ErrInvalidGitBranch                              = Error{ID: 127, Status: http.StatusBadRequest}
	ErrInvalidFavoriteType                           = Error{ID: 128, Status: http.StatusBadRequest}
	ErrUnsupportedOSArchPlugin                       = Error{ID: 129, Status: http.StatusNotFound}
	ErrNoBroadcast                                   = Error{ID: 130, Status: http.StatusNotFound}
	ErrBroadcastNotFound                             = Error{ID: 131, Status: http.StatusNotFound}
	ErrInvalidPatternModel                           = Error{ID: 132, Status: http.StatusBadRequest}
	ErrWorkerModelNoAdmin                            = Error{ID: 133, Status: http.StatusForbidden}
	ErrWorkerModelNoPattern                          = Error{ID: 134, Status: http.StatusForbidden}
	ErrJobNotBooked                                  = Error{ID: 135, Status: http.StatusBadRequest}
	ErrUserNotFound                                  = Error{ID: 136, Status: http.StatusNotFound}
	ErrInvalidNumber                                 = Error{ID: 137, Status: http.StatusBadRequest}
	ErrKeyAlreadyExist                               = Error{ID: 138, Status: http.StatusForbidden}
	ErrPipelineNameImport                            = Error{ID: 139, Status: http.StatusBadRequest}
	ErrWorkflowNameImport                            = Error{ID: 140, Status: http.StatusBadRequest}
	ErrIconBadFormat                                 = Error{ID: 141, Status: http.StatusBadRequest}
	ErrIconBadSize                                   = Error{ID: 142, Status: http.StatusBadRequest}
	ErrWorkflowConditionBadOperator                  = Error{ID: 143, Status: http.StatusBadRequest}
	ErrColorBadFormat                                = Error{ID: 144, Status: http.StatusBadRequest}
	ErrInvalidHookConfiguration                      = Error{ID: 145, Status: http.StatusBadRequest}
	ErrWorkerModelDeploymentFailed                   = Error{ID: 146, Status: http.StatusBadRequest}
	ErrJobLocked                                     = Error{ID: 147, Status: http.StatusConflict}
	ErrWorkflowNodeRunLocked                         = Error{ID: 148, Status: http.StatusConflict}
	ErrInvalidData                                   = Error{ID: 149, Status: http.StatusBadRequest}
	ErrInvalidGroupAdmin                             = Error{ID: 150, Status: http.StatusForbidden}
	ErrInvalidGroupMember                            = Error{ID: 151, Status: http.StatusForbidden}
	ErrWorkflowNotGenerated                          = Error{ID: 152, Status: http.StatusForbidden}
	ErrAlreadyLatestTemplate                         = Error{ID: 153, Status: http.StatusForbidden}
	ErrInvalidNodeDefaultPayload                     = Error{ID: 154, Status: http.StatusBadRequest}
	ErrInvalidApplicationRepoStrategy                = Error{ID: 155, Status: http.StatusBadRequest}
	ErrWorkflowNodeRootUpdate                        = Error{ID: 156, Status: http.StatusBadRequest}
	ErrWorkflowAlreadyAsCode                         = Error{ID: 157, Status: http.StatusBadRequest}
	ErrNoDBMigrationID                               = Error{ID: 158, Status: http.StatusNotFound}
	ErrCannotParseTemplate                           = Error{ID: 159, Status: http.StatusBadRequest}
	ErrGroupNotFoundInProject                        = Error{ID: 160, Status: http.StatusBadRequest}
	ErrGroupNotFoundInWorkflow                       = Error{ID: 161, Status: http.StatusBadRequest}
	ErrWorkflowPermInsufficient                      = Error{ID: 162, Status: http.StatusBadRequest}
	ErrApplicationUsedByWorkflow                     = Error{ID: 163, Status: http.StatusBadRequest}
	ErrLocked                                        = Error{ID: 164, Status: http.StatusConflict}
	ErrInvalidJobRequirementWorkerModelPermission    = Error{ID: 165, Status: http.StatusBadRequest}
	ErrInvalidJobRequirementWorkerModelCapabilitites = Error{ID: 166, Status: http.StatusBadRequest}
	ErrMalformattedStep                              = Error{ID: 167, Status: http.StatusBadRequest}
	ErrVCSUsedByApplication                          = Error{ID: 168, Status: http.StatusBadRequest}
	ErrApplicationAsCodeOverride                     = Error{ID: 169, Status: http.StatusForbidden}
	ErrPipelineAsCodeOverride                        = Error{ID: 170, Status: http.StatusForbidden}
	ErrEnvironmentAsCodeOverride                     = Error{ID: 171, Status: http.StatusForbidden}
	ErrWorkflowAsCodeOverride                        = Error{ID: 172, Status: http.StatusForbidden}
	ErrProjectSecretDataUnknown                      = Error{ID: 173, Status: http.StatusBadRequest}
	ErrApplicationMandatoryOnWorkflowAsCode          = Error{ID: 174, Status: http.StatusBadRequest}
	ErrInvalidPassword                               = Error{ID: 175, Status: http.StatusBadRequest}
	ErrInvalidPayloadVariable                        = Error{ID: 176, Status: http.StatusBadRequest}
	ErrRepositoryUsedByHook                          = Error{ID: 177, Status: http.StatusForbidden}
	ErrResourceNotInProject                          = Error{ID: 178, Status: http.StatusForbidden}
	ErrEnvironmentNotFound                           = Error{ID: 179, Status: http.StatusBadRequest}
	ErrIntegrationtNotFound                          = Error{ID: 180, Status: http.StatusBadRequest}
	ErrBadBrokerConfiguration                        = Error{ID: 181, Status: http.StatusBadRequest}
	ErrSignupDisabled                                = Error{ID: 182, Status: http.StatusForbidden}
	ErrUsernamePresent                               = Error{ID: 183, Status: http.StatusBadRequest}
	ErrInvalidJobRequirementNetworkAccess            = Error{ID: 184, Status: http.StatusBadRequest}
	ErrInvalidWorkerModelNamePattern                 = Error{ID: 185, Status: http.StatusBadRequest}
	ErrWorkflowAsCodeResync                          = Error{ID: 186, Status: http.StatusForbidden}
	ErrWorkflowNodeNameDuplicate                     = Error{ID: 187, Status: http.StatusBadRequest}
	ErrUnsupportedMediaType                          = Error{ID: 188, Status: http.StatusUnsupportedMediaType}
	ErrNothingToPush                                 = Error{ID: 189, Status: http.StatusBadRequest}
	ErrWorkerErrorCommand                            = Error{ID: 190, Status: http.StatusBadRequest}
	ErrRepoAnalyzeFailed                             = Error{ID: 191, Status: http.StatusInternalServerError}
	ErrConflictData                                  = Error{ID: 192, Status: http.StatusConflict}
	ErrWebsocketUpgrade                              = Error{ID: 193, Status: http.StatusUpgradeRequired}
	ErrMFARequired                                   = Error{ID: 194, Status: http.StatusForbidden}
	ErrHatcheryNoResourceAvailable                   = Error{ID: 195, Status: http.StatusInternalServerError}
	ErrRegionNotAllowed                              = Error{ID: 196, Status: http.StatusInternalServerError}
)

Existing CDS errors Note: the error id is useless except to ensure objects are different in map

View Source
var (
	BuiltinHookModels = []*WorkflowHookModel{
		&WebHookModel,
		&RepositoryWebHookModel,
		&GitPollerModel,
		&SchedulerModel,
		&KafkaHookModel,
		&RabbitMQHookModel,
		&WorkflowModel,
		&GerritHookModel,
	}

	BuiltinOutgoingHookModels = []*WorkflowHookModel{
		&OutgoingWebHookModel,
		&OutgoingWorkflowModel,
	}

	KafkaHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/kafka",
		Name:       KafkaHookModelName,
		Icon:       "Linkify",
		DefaultConfig: WorkflowNodeHookConfig{
			HookModelIntegration: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeIntegration,
			},
			KafkaHookModelTopic: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	RabbitMQHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/rabbitmq",
		Name:       RabbitMQHookModelName,
		Icon:       "Linkify",
		DefaultConfig: WorkflowNodeHookConfig{
			HookModelIntegration: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeIntegration,
			},
			RabbitMQHookModelQueue: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			RabbitMQHookModelExchangeType: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			RabbitMQHookModelExchangeName: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			RabbitMQHookModelBindingKey: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			RabbitMQHookModelConsumerTag: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	WebHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/webhook",
		Name:       WebHookModelName,
		Icon:       "Linkify",
		DefaultConfig: WorkflowNodeHookConfig{
			WebHookModelConfigMethod: {
				Value:        "POST",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	RepositoryWebHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/repositorywebhook",
		Name:       RepositoryWebHookModelName,
		Icon:       "Linkify",
		DefaultConfig: WorkflowNodeHookConfig{
			RepositoryWebHookModelMethod: {
				Value:        "POST",
				Configurable: false,
				Type:         HookConfigTypeString,
			},
			HookConfigEventFilter: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeMultiChoice,
			},
		},
	}

	GitPollerModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/poller",
		Name:       GitPollerModelName,
		Icon:       "git square",
		DefaultConfig: WorkflowNodeHookConfig{
			"payload": {
				Value:        "{}",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	SchedulerModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/scheduler",
		Name:       SchedulerModelName,
		Icon:       "fa-clock-o",
		DefaultConfig: WorkflowNodeHookConfig{
			SchedulerModelCron: {
				Value:        "0 * * * *",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			SchedulerModelTimezone: {
				Value:        "UTC",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			Payload: {
				Value:        "{}",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	GerritHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/gerrit",
		Name:       GerritHookModelName,
		Icon:       "git",
		DefaultConfig: WorkflowNodeHookConfig{
			HookConfigEventFilter: {
				Value:        "",
				Configurable: true,
				Type:         HookConfigTypeMultiChoice,
			},
		},
	}

	WorkflowModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/workflowhook",
		Name:       WorkflowModelName,
		Icon:       "sitemap",
	}

	OutgoingWebHookModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/webhook",
		Name:       WebHookModelName,
		Icon:       "Linkify",
		DefaultConfig: WorkflowNodeHookConfig{
			WebHookModelConfigMethod: {
				Value:        "POST",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			"URL": {
				Configurable: true,
				Type:         HookConfigTypeString,
			},
			Payload: {
				Value:        "{}",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}

	OutgoingWorkflowModel = WorkflowHookModel{
		Author:     "CDS",
		Type:       WorkflowHookModelBuiltin,
		Identifier: "github.com/ovh/cds/hook/builtin/workflowhook",
		Name:       WorkflowModelName,
		Icon:       "sitemap",
		DefaultConfig: WorkflowNodeHookConfig{
			HookConfigTargetProject: {
				Configurable: true,
				Type:         HookConfigTypeProject,
			},
			HookConfigTargetWorkflow: {
				Configurable: true,
				Type:         HookConfigTypeWorkflow,
			},
			HookConfigTargetHook: {
				Configurable: true,
				Type:         HookConfigTypeHook,
			},
			Payload: {
				Value:        "{}",
				Configurable: true,
				Type:         HookConfigTypeString,
			},
		},
	}
)

Here are the default hooks

View Source
var (
	BuiltinIntegrationModels = []*IntegrationModel{
		&KafkaIntegration,
		&RabbitMQIntegration,
		&OpenstackIntegration,
		&AWSIntegration,
		&ArtifactoryIntegration,
	}
	// KafkaIntegration represents a kafka integration
	KafkaIntegration = IntegrationModel{
		Name:       KafkaIntegrationModel,
		Author:     "CDS",
		Identifier: "github.com/ovh/cds/integration/builtin/kafka",
		Icon:       "",
		DefaultConfig: IntegrationConfig{
			"broker url": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"username": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"password": IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
			"topic": IntegrationConfigValue{
				Type:        IntegrationConfigTypeString,
				Description: "This is mandatory only if you want to use Event Integration",
			},
		},
		Disabled: false,
		Hook:     true,
		Event:    true,
	}
	// RabbitMQIntegration represents a kafka integration
	RabbitMQIntegration = IntegrationModel{
		Name:       RabbitMQIntegrationModel,
		Author:     "CDS",
		Identifier: "github.com/ovh/cds/integration/builtin/rabbitmq",
		Icon:       "",
		DefaultConfig: IntegrationConfig{
			"uri": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"username": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"password": IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
		},
		Disabled: false,
		Hook:     true,
	}
	// OpenstackIntegration represents an openstack integration
	OpenstackIntegration = IntegrationModel{
		Name:       OpenstackIntegrationModel,
		Author:     "CDS",
		Identifier: "github.com/ovh/cds/integration/builtin/openstack",
		Icon:       "",
		DefaultConfig: IntegrationConfig{
			"address": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"region": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"domain": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"tenant_name": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"username": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"password": IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
			"storage_container_prefix": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"storage_temporary_url_supported": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
		},
		Storage:  true,
		Disabled: false,
		Hook:     false,
	}
	// ArtifactoryIntegration represent integration with artifactory
	ArtifactoryIntegration = IntegrationModel{
		Name:       ArtifactoryIntegrationModelName,
		Author:     "CDS",
		Identifier: "github.com/ovh/cds/integration/builtin/artifactory",
		Icon:       "",
		DefaultConfig: IntegrationConfig{
			ArtifactoryConfigPlatform: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigURL: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigTokenName: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigToken: IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
			ArtifactoryConfigReleaseToken: IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
			ArtifactoryConfigProjectKey: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigCdsRepository: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigPromotionLowMaturity: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigPromotionHighMaturity: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			ArtifactoryConfigBuildInfoPrefix: IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
		},
		ArtifactManager: true,
	}
	// AWSIntegration represents an aws integration
	AWSIntegration = IntegrationModel{
		Name:       AWSIntegrationModel,
		Author:     "CDS",
		Identifier: "github.com/ovh/cds/integration/builtin/aws",
		Icon:       "",
		DefaultConfig: IntegrationConfig{
			"region": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"bucket_name": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"prefix": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"access_key_id": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"secret_access_key": IntegrationConfigValue{
				Type: IntegrationConfigTypePassword,
			},
			"endpoint": IntegrationConfigValue{
				Type: IntegrationConfigTypeString,
			},
			"disable_ssl": IntegrationConfigValue{
				Type: IntegrationConfigTypeBoolean,
			},
			"force_path_style": IntegrationConfigValue{
				Type: IntegrationConfigTypeBoolean,
			},
		},
		Storage:  true,
		Disabled: false,
		Hook:     false,
	}
)

Here are the default plateform models

View Source
var (
	FR = lang(language.French)
	EN = lang(language.AmericanEnglish)
)

Supported API language

View Source
var (
	MsgAppCreated                           = &Message{"MsgAppCreated", trad{FR: "L'application %s a été créée avec succès", EN: "Application %s successfully created"}, nil, RunInfoTypInfo}
	MsgAppUpdated                           = &Message{"MsgAppUpdated", trad{FR: "L'application %s a été mise à jour avec succès", EN: "Application %s successfully updated"}, nil, RunInfoTypInfo}
	MsgPipelineCreated                      = &Message{"MsgPipelineCreated", trad{FR: "Le pipeline %s a été créé avec succès", EN: "Pipeline %s successfully created"}, nil, RunInfoTypInfo}
	MsgPipelineCreationAborted              = &Message{"MsgPipelineCreationAborted", trad{FR: "La création du pipeline %s a été abandonnée", EN: "Pipeline %s creation aborted"}, nil, RunInfoTypeError}
	MsgPipelineExists                       = &Message{"MsgPipelineExists", trad{FR: "Le pipeline %s existe déjà", EN: "Pipeline %s already exists"}, nil, RunInfoTypInfo}
	MsgAppVariablesCreated                  = &Message{"MsgAppVariablesCreated", trad{FR: "Les variables ont été ajoutées avec succès sur l'application %s", EN: "Application variables for %s are successfully created"}, nil, RunInfoTypInfo}
	MsgAppKeyCreated                        = &Message{"MsgAppKeyCreated", trad{FR: "La clé %s %s a été créée sur l'application %s", EN: "%s key %s created on application %s"}, nil, RunInfoTypInfo}
	MsgEnvironmentExists                    = &Message{"MsgEnvironmentExists", trad{FR: "L'environnement %s existe déjà", EN: "Environment %s already exists"}, nil, RunInfoTypInfo}
	MsgEnvironmentCreated                   = &Message{"MsgEnvironmentCreated", trad{FR: "L'environnement %s a été créé avec succès", EN: "Environment %s successfully created"}, nil, RunInfoTypInfo}
	MsgEnvironmentVariableUpdated           = &Message{"MsgEnvironmentVariableUpdated", trad{FR: "La variable %s de l'environnement %s a été mise à jour", EN: "Variable %s on environment %s has been updated"}, nil, RunInfoTypInfo}
	MsgEnvironmentVariableCannotBeUpdated   = &Message{"MsgEnvironmentVariableCannotBeUpdated", trad{FR: "La variable %s de l'environnement %s n'a pu être mise à jour : %s", EN: "Variable %s on environment %s cannot be updated: %s"}, nil, RunInfoTypeError}
	MsgEnvironmentVariableCreated           = &Message{"MsgEnvironmentVariableCreated", trad{FR: "La variable %s de l'environnement %s a été ajoutée", EN: "Variable %s on environment %s has been added"}, nil, RunInfoTypInfo}
	MsgEnvironmentVariableCannotBeCreated   = &Message{"MsgEnvironmentVariableCannotBeCreated", trad{FR: "La variable %s de l'environnement %s n'a pu être ajoutée : %s", EN: "Variable %s on environment %s cannot be added: %s"}, nil, RunInfoTypeError}
	MsgEnvironmentGroupUpdated              = &Message{"MsgEnvironmentGroupUpdated", trad{FR: "Le groupe %s de l'environnement %s a été mis à jour", EN: "Group %s on environment %s has been updated"}, nil, RunInfoTypInfo}
	MsgEnvironmentGroupCannotBeUpdated      = &Message{"MsgEnvironmentGroupCannotBeUpdated", trad{FR: "Le groupe %s de l'environnement %s n'a pu être mis à jour : %s", EN: "Group %s on environment %s cannot be updated: %s"}, nil, RunInfoTypeError}
	MsgEnvironmentGroupCreated              = &Message{"MsgEnvironmentGroupCreated", trad{FR: "Le groupe %s de l'environnement %s a été ajouté", EN: "Group %s on environment %s has been added"}, nil, RunInfoTypInfo}
	MsgEnvironmentGroupCannotBeCreated      = &Message{"MsgEnvironmentGroupCannotBeCreated", trad{FR: "Le groupe %s de l'environnement %s n'a pu être ajouté : %s", EN: "Group %s on environment %s cannot be added: %s"}, nil, RunInfoTypeError}
	MsgEnvironmentGroupDeleted              = &Message{"MsgEnvironmentGroupDeleted", trad{FR: "Le groupe %s de l'environnement %s a été supprimé", EN: "Group %s on environment %s has been deleted"}, nil, RunInfoTypInfo}
	MsgEnvironmentGroupCannotBeDeleted      = &Message{"MsgEnvironmentGMsgEnvironmentGroupCannotBeDeletedroupCannotBeCreated", trad{FR: "Le groupe %s de l'environnement %s n'a pu être supprimé : %s", EN: "Group %s on environment %s cannot be deleted: %s"}, nil, RunInfoTypeError}
	MsgEnvironmentKeyCreated                = &Message{"MsgEnvironmentKeyCreated", trad{FR: "La clé %s %s a été créée sur l'environnement %s", EN: "%s key %s created on environment %s"}, nil, RunInfoTypInfo}
	MsgJobNotValidActionNotFound            = &Message{"MsgJobNotValidActionNotFound", trad{FR: "Erreur de validation du Job %s : L'action %s à l'étape %d n'a pas été trouvée", EN: "Job %s validation Failure: Unknown action %s on step #%d"}, nil, RunInfoTypeError}
	MsgJobNotValidInvalidActionParameter    = &Message{"MsgJobNotValidInvalidActionParameter", trad{FR: "Erreur de validation du Job %s : Le paramètre %s de l'étape %d - %s est invalide", EN: "Job %s validation Failure: Invalid parameter %s on step #%d %s"}, nil, RunInfoTypeError}
	MsgPipelineGroupUpdated                 = &Message{"MsgPipelineGroupUpdated", trad{FR: "Les permissions du groupe %s sur le pipeline %s on été mises à jour", EN: "Permission for group %s on pipeline %s has been updated"}, nil, RunInfoTypInfo}
	MsgPipelineGroupAdded                   = &Message{"MsgPipelineGroupAdded", trad{FR: "Les permissions du groupe %s sur le pipeline %s on été ajoutées", EN: "Permission for group %s on pipeline %s has been added"}, nil, RunInfoTypInfo}
	MsgPipelineGroupDeleted                 = &Message{"MsgPipelineGroupDeleted", trad{FR: "Les permissions du groupe %s sur le pipeline %s on été supprimées", EN: "Permission for group %s on pipeline %s has been deleted"}, nil, RunInfoTypInfo}
	MsgPipelineStageUpdated                 = &Message{"MsgPipelineStageUpdated", trad{FR: "Le stage %s a été mis à jour", EN: "Stage %s updated"}, nil, RunInfoTypInfo}
	MsgPipelineStageUpdating                = &Message{"MsgPipelineStageUpdating", trad{FR: "Mise à jour du stage %s en cours...", EN: "Updating stage %s ..."}, nil, RunInfoTypInfo}
	MsgPipelineStageDeletingOldJobs         = &Message{"MsgPipelineStageDeletingOldJobs", trad{FR: "Suppression des anciens jobs du stage %s en cours...", EN: "Deleting old jobs in stage %s ..."}, nil, RunInfoTypInfo}
	MsgPipelineStageInsertingNewJobs        = &Message{"MsgPipelineStageInsertingNewJobs", trad{FR: "Insertion des nouveaux jobs dans le stage %s en cours...", EN: "Inserting new jobs in stage %s ..."}, nil, RunInfoTypInfo}
	MsgPipelineStageAdded                   = &Message{"MsgPipelineStageAdded", trad{FR: "Le stage %s a été ajouté", EN: "Stage %s added"}, nil, RunInfoTypInfo}
	MsgPipelineStageDeleted                 = &Message{"MsgPipelineStageDeleted", trad{FR: "Le stage %s a été supprimé", EN: "Stage %s deleted"}, nil, RunInfoTypInfo}
	MsgPipelineJobUpdated                   = &Message{"MsgPipelineJobUpdated", trad{FR: "Le job %s du stage %s a été mis à jour", EN: "Job %s in stage %s updated"}, nil, RunInfoTypInfo}
	MsgPipelineJobAdded                     = &Message{"MsgPipelineJobAdded", trad{FR: "Le job %s du stage %s a été ajouté", EN: "Job %s in stage %s added"}, nil, RunInfoTypInfo}
	MsgPipelineJobDeleted                   = &Message{"MsgPipelineJobDeleted", trad{FR: "Le job %s du stage %s a été supprimé", EN: "Job %s in stage %s deleted"}, nil, RunInfoTypInfo}
	MsgPipelineDetached                     = &Message{"MsgPipelineDetached", trad{FR: "Le pipeline %s est détaché du repository %s", EN: "The pipeline %s is detached from repository %s"}, nil, RunInfoTypInfo}
	MsgApplicationDetached                  = &Message{"MsgApplicationDetached", trad{FR: "L'application %s est détachée du repository %s", EN: "The application %s is detached from repository %s"}, nil, RunInfoTypInfo}
	MsgEnvironmentDetached                  = &Message{"MsgEnvironmentDetached", trad{FR: "L'environnement %s est détaché du repository %s", EN: "The environment %s is detached from repository %s"}, nil, RunInfoTypInfo}
	MsgWorkflowDetached                     = &Message{"MsgWorkflowDetached", trad{FR: "Le workflow %s est détaché du repository %s", EN: "The workflow %s is detached from repository %s"}, nil, RunInfoTypInfo}
	MsgSpawnInfoHatcheryStarts              = &Message{"MsgSpawnInfoHatcheryStarts", trad{FR: "La Hatchery %s a démarré le lancement du worker avec le modèle %s", EN: "Hatchery %s starts spawn worker with model %s"}, nil, RunInfoTypInfo}
	MsgSpawnInfoHatcheryErrorSpawn          = &Message{"MsgSpawnInfoHatcheryErrorSpawn", trad{FR: "Une erreur est survenue lorsque la Hatchery %s a démarré un worker avec le modèle %s après %s, err: %s", EN: "Error while Hatchery %s spawns worker with model %s after %s, err: %s"}, nil, RunInfoTypeError}
	MsgSpawnInfoHatcheryStartDockerPull     = &Message{"MsgSpawnInfoHatcheryStartDockerPull", trad{FR: "La Hatchery %s a démarré le docker pull de l'image %s...", EN: "Hatchery %s starts docker pull %s..."}, nil, RunInfoTypInfo}
	MsgSpawnInfoHatcheryEndDockerPull       = &Message{"MsgSpawnInfoHatcheryEndDockerPull", trad{FR: "La Hatchery %s a terminé le docker pull de l'image %s", EN: "Hatchery %s docker pull %s done"}, nil, RunInfoTypInfo}
	MsgSpawnInfoHatcheryEndDockerPullErr    = &Message{"MsgSpawnInfoHatcheryEndDockerPullErr", trad{FR: "⚠ La Hatchery %s a terminé le docker pull de l'image %s en erreur: %s", EN: "⚠ Hatchery %s - docker pull %s done with error: %v"}, nil, RunInfoTypeError}
	MsgSpawnInfoDeprecatedModel             = &Message{"MsgSpawnInfoDeprecatedModel", trad{FR: "⚠ Attention vous utilisez un worker model (%s) déprécié", EN: "⚠ Pay attention you are using a deprecated worker model (%s)"}, nil, RunInfoTypeWarning}
	MsgSpawnInfoWorkerEnd                   = &Message{"MsgSpawnInfoWorkerEnd", trad{FR: "✓ Le worker %s a terminé et a passé %s à travailler sur les étapes", EN: "✓ Worker %s finished working on this job"}, nil, RunInfoTypInfo}
	MsgSpawnInfoJobInQueue                  = &Message{"MsgSpawnInfoJobInQueue", trad{FR: "✓ Le job a été mis en file d'attente", EN: "✓ Job has been queued"}, nil, RunInfoTypInfo}
	MsgSpawnInfoJobTaken                    = &Message{"MsgSpawnInfoJobTaken", trad{FR: "Le job %s a été pris par le worker %s", EN: "Job %s has been taken by worker %s"}, nil, RunInfoTypInfo}
	MsgSpawnInfoJobTakenWorkerVersion       = &Message{"MsgSpawnInfoJobTakenWorkerVersion", trad{FR: "Worker %s version:%s os:%s arch:%s", EN: "Worker %s version:%s os:%s arch:%s"}, nil, RunInfoTypInfo}
	MsgSpawnInfoWorkerForJob                = &Message{"MsgSpawnInfoWorkerForJob", trad{FR: "Ce worker %s a été créé pour lancer ce job", EN: "This worker %s was created to take this action"}, nil, RunInfoTypInfo}
	MsgSpawnInfoWorkerForJobError           = &Message{"MsgSpawnInfoWorkerForJobError", trad{FR: "⚠ Ce worker %s a été créé pour lancer ce job, mais ne possède pas tous les pré-requis. Vérifiez que les prérequis suivants:%s", EN: "⚠ This worker %s was created to take this action, but does not have all prerequisites. Please verify the following prerequisites:%s"}, nil, RunInfoTypeError}
	MsgSpawnInfoJobError                    = &Message{"MsgSpawnInfoJobError", trad{FR: "⚠ Impossible de lancer ce job : %s", EN: "⚠ Unable to run this job: %s"}, nil, RunInfoTypInfo}
	MsgWorkflowStarting                     = &Message{"MsgWorkflowStarting", trad{FR: "Le workflow %s#%s a été démarré", EN: "Workflow %s#%s has been started"}, nil, RunInfoTypInfo}
	MsgWorkflowError                        = &Message{"MsgWorkflowError", trad{FR: "⚠ Une erreur est survenue: %v", EN: "⚠ An error has occurred: %v"}, nil, RunInfoTypeError}
	MsgWorkflowConditionError               = &Message{"MsgWorkflowConditionError", trad{FR: "Les conditions de lancement ne sont pas respectées.", EN: "Run conditions aren't ok."}, nil, RunInfoTypInfo}
	MsgWorkflowNodeStop                     = &Message{"MsgWorkflowNodeStop", trad{FR: "Le pipeline a été arrété par %s", EN: "The pipeline has been stopped by %s"}, nil, RunInfoTypInfo}
	MsgWorkflowNodeMutex                    = &Message{"MsgWorkflowNodeMutex", trad{FR: "Le pipeline %s est mis en attente tant qu'il est en cours sur un autre run", EN: "The pipeline %s is waiting while it's running on another run"}, nil, RunInfoTypInfo}
	MsgWorkflowNodeMutexRelease             = &Message{"MsgWorkflowNodeMutexRelease", trad{FR: "Lancement du pipeline %s", EN: "Triggering pipeline %s"}, nil, RunInfoTypInfo}
	MsgWorkflowImportedUpdated              = &Message{"MsgWorkflowImportedUpdated", trad{FR: "Le workflow %s a été mis à jour", EN: "Workflow %s has been updated"}, nil, RunInfoTypInfo}
	MsgWorkflowImportedInserted             = &Message{"MsgWorkflowImportedInserted", trad{FR: "Le workflow %s a été créé", EN: "Workflow %s has been created"}, nil, RunInfoTypInfo}
	MsgSpawnInfoHatcheryCannotStartJob      = &Message{"MsgSpawnInfoHatcheryCannotStart", trad{FR: "Aucune hatchery n'a pu démarrer de worker respectant vos pré-requis de job, merci de les vérifier.", EN: "No hatchery can spawn a worker corresponding your job's requirements. Please check your job's requirements."}, nil, RunInfoTypeWarning}
	MsgWorkflowRunBranchDeleted             = &Message{"MsgWorkflowRunBranchDeleted", trad{FR: "La branche %s  a été supprimée", EN: "Branch %s has been deleted"}, nil, RunInfoTypInfo}
	MsgWorkflowTemplateImportedInserted     = &Message{"MsgWorkflowTemplateImportedInserted", trad{FR: "Le template de workflow %s/%s a été créé", EN: "Workflow template %s/%s has been created"}, nil, RunInfoTypInfo}
	MsgWorkflowTemplateImportedUpdated      = &Message{"MsgWorkflowTemplateImportedUpdated", trad{FR: "Le template de workflow %s/%s a été mis à jour", EN: "Workflow template %s/%s has been updated"}, nil, RunInfoTypInfo}
	MsgWorkflowErrorBadPipelineName         = &Message{"MsgWorkflowErrorBadPipelineName", trad{FR: "Le pipeline %s indiqué dans votre fichier yaml de workflow n'existe pas", EN: "The pipeline %s mentioned in your workflow's yaml file doesn't exist"}, nil, RunInfoTypeError}
	MsgWorkflowErrorBadApplicationName      = &Message{"MsgWorkflowErrorBadApplicationName", trad{FR: "L'application %s indiquée dans votre fichier yaml de workflow n'existe pas ou ne correspond pas aux normes ^[a-zA-Z0-9._-]{1,}$", EN: "The application %s mentioned in your workflow's yaml file doesn't exist or is incorrect with ^[a-zA-Z0-9._-]{1,}$"}, nil, RunInfoTypeError}
	MsgWorkflowErrorBadEnvironmentName      = &Message{"MsgWorkflowErrorBadEnvironmentName", trad{FR: "L'environnement %s indiqué dans votre fichier yaml de workflow n'existe pas", EN: "The environment %s mentioned in your workflow's yaml file doesn't exist"}, nil, RunInfoTypeError}
	MsgWorkflowErrorBadIntegrationName      = &Message{"MsgWorkflowErrorBadIntegrationName", trad{FR: "L'intégration %s indiquée dans votre fichier yaml n'existe pas", EN: "The integration %s mentioned in your yaml file doesn't exist"}, nil, RunInfoTypeError}
	MsgWorkflowErrorBadCdsDir               = &Message{"MsgWorkflowErrorBadCdsDir", trad{FR: "Un problème est survenu avec votre répertoire .cds", EN: "A problem occurred about your .cds directory"}, nil, RunInfoTypeError}
	MsgWorkflowErrorUnknownKey              = &Message{"MsgWorkflowErrorUnknownKey", trad{FR: "La clé '%s' est incorrecte ou n'existe pas", EN: "The key '%s' is incorrect or doesn't exist"}, nil, RunInfoTypeError}
	MsgWorkflowErrorBadVCSStrategy          = &Message{"MsgWorkflowErrorBadVCSStrategy", trad{FR: "Vos informations vcs_* sont incorrectes", EN: "Your vcs_* fields are incorrects"}, nil, RunInfoTypeError}
	MsgWorkflowDeprecatedVersion            = &Message{"MsgWorkflowDeprecatedVersion", trad{FR: "La configuration yaml de votre workflow est dans un format déprécié. Exportez le avec la CLI `cdsctl workflow export %s %s`", EN: "The yaml workflow configuration format is deprecated. Export your workflow with CLI `cdsctl workflow export %s %s`"}, nil, RunInfoTypeWarning}
	MsgWorkflowGeneratedFromTemplateVersion = &Message{"MsgWorkflowGeneratedFromTemplateVersion", trad{FR: "Le workflow a été généré à partir du modèle de workflow: %s", EN: "The workflow was generated from the template: %s"}, nil, RunInfoTypInfo}
	MsgTooMuchWorkflowRun                   = &Message{"MsgTooMuchWorkflowRun", trad{FR: "L'exécution de ce workflow est suspendu. Vous dépassez le nombre maximum d'éxécution autorisé (%.f). Merci de revoir la politique de retention de ce workflow", EN: "Workflow run is delayed. The maximum number of runs for this workflow has been reached ( %.f ). Please update your workflow retention policy"}, nil, RunInfoTypeWarning}
	MsgSpawnErrorHatcheryRetryAttempt       = &Message{"MsgSpawnErrorHatcheryRetryAttempt", trad{EN: "Job execution failed by hatchery %s. Reason: %s"}, nil, RunInfoTypeError}
	MsgWorkflowV3Preview                    = &Message{"MsgWorkflowV3Preview", trad{FR: "Le workflow a été généré en version 3 à partir d'une ancienne version", EN: "The workflow was generated in version 3 from an old version"}, nil, RunInfoTypeWarning}
)

Message list

View Source
var (
	UserNotificationTemplateEmail = UserNotificationTemplate{
		Subject: "{{.cds.project}}/{{.cds.workflow}}#{{.cds.version}} {{.cds.status}}",
		Body: `Project : {{.cds.project}}
Workflow : {{.cds.workflow}}#{{.cds.version}}
Pipeline : {{.cds.node}}
Status : {{.cds.status}}
Details : {{.cds.buildURL}}
Triggered by : {{.cds.triggered_by.username}}
Branch : {{.git.branch | default "n/a"}}`,
	}

	UserNotificationTemplateJabber = UserNotificationTemplate{
		Subject: "{{.cds.project}}/{{.cds.workflow}}#{{.cds.version}} {{.cds.status}}",
		Body:    `{{.cds.buildURL}}`,
	}

	UserNotificationTemplateMap = map[string]UserNotificationTemplate{
		EmailUserNotification:  UserNotificationTemplateEmail,
		JabberUserNotification: UserNotificationTemplateJabber,
		VCSUserNotification: {
			Body: DefaultWorkflowNodeRunReport,
		},
	}
)

Default template values

View Source
var (
	// AvailableRequirementsType List of all requirements
	AvailableRequirementsType = []string{
		BinaryRequirement,
		HostnameRequirement,
		MemoryRequirement,
		ModelRequirement,
		OSArchRequirement,
		PluginRequirement,
		RegionRequirement,
		ServiceRequirement,
	}

	// OSArchRequirementValues comes from go tool dist list
	OSArchRequirementValues = RequirementList{
		{Name: "linux/amd64", Type: OSArchRequirement, Value: "linux/amd64"},
		{Name: "linux/386", Type: OSArchRequirement, Value: "linux/386"},

		{Name: "darwin/amd64", Type: OSArchRequirement, Value: "darwin/amd64"},

		{Name: "freebsd/386", Type: OSArchRequirement, Value: "freebsd/386"},
		{Name: "freebsd/amd64", Type: OSArchRequirement, Value: "freebsd/amd64"},

		{Name: "linux/arm64", Type: OSArchRequirement, Value: "linux/arm64"},

		{Name: "netbsd/386", Type: OSArchRequirement, Value: "netbsd/386"},
		{Name: "netbsd/amd64", Type: OSArchRequirement, Value: "netbsd/amd64"},

		{Name: "openbsd/386", Type: OSArchRequirement, Value: "openbsd/386"},
		{Name: "openbsd/amd64", Type: OSArchRequirement, Value: "openbsd/amd64"},

		{Name: "windows/386", Type: OSArchRequirement, Value: "windows/386"},
		{Name: "windows/amd64", Type: OSArchRequirement, Value: "windows/amd64"},
	}
)
View Source
var (
	// AvailableVariableType list all existing variable type in CDS
	AvailableVariableType = []string{
		SecretVariable,
		TextVariable,
		StringVariable,
		BooleanVariable,
		NumberVariable,
	}

	BasicVariableNames = []string{
		"cds.version",
		"cds.application",
		"cds.environment",
		"cds.job",
		"cds.manual",
		"cds.pipeline",
		"cds.project",
		"cds.run",
		"cds.run.number",
		"cds.run.subnumber",
		"cds.stage",
		"cds.triggered_by.email",
		"cds.triggered_by.fullname",
		"cds.triggered_by.username",
		"cds.ui.pipeline.run",
		"cds.worker",
		"cds.workflow",
		"cds.workspace",
		"payload",
	}

	BasicGitVariableNames = []string{
		"git.repository",
		"git.branch",
		"git.message",
		"git.author",
		"git.hash",
		"git.hash.short",
		"git.url",
		"git.http_url",
		"git.server",
	}
)
View Source
var (
	BitbucketEvents = []string{
		"repo:refs_changed",
		"repo:modified",
		"repo:forked",
		"repo:comment:added",
		"repo:comment:edited",
		"repo:comment:deleted",
		"pr:from_ref_updated",
		"pr:opened",
		"pr:modified",
		"pr:reviewer:updated",
		"pr:reviewer:approved",
		"pr:reviewer:unapproved",
		"pr:reviewer:needs_work",
		"pr:merged",
		"pr:declined",
		"pr:deleted",
		"pr:comment:added",
		"pr:comment:edited",
		"pr:comment:deleted",
	}

	BitbucketEventsDefault = []string{
		"repo:refs_changed",
	}

	BitbucketCloudEvents = []string{
		"repo:push",
		"pullrequest:unapproved",
		"issue:comment_created",
		"pullrequest:approved",
		"repo:created",
		"repo:deleted",
		"repo:imported",
		"pullrequest:comment_updated",
		"issue:updated",
		"project:updated",
		"pullrequest:comment_created",
		"repo:commit_status_updated",
		"pullrequest:updated",
		"issue:created",
		"repo:fork",
		"pullrequest:comment_deleted",
		"repo:commit_status_created",
		"repo:updated",
		"pullrequest:rejected",
		"pullrequest:fulfilled",
		"pullrequest:created",
		"repo:transfer",
		"repo:commit_comment_created",
	}

	BitbucketCloudEventsDefault = []string{
		"repo:push",
	}

	GitHubEvents = []string{
		"push",
		"check_run",
		"check_suite",
		"commit_comment",
		"create",
		"delete",
		"deployment",
		"deployment_status",
		"fork",
		"github_app_authorization",
		"gollum",
		"installation",
		"installation_repositories",
		"issue_comment",
		"issues",
		"label",
		"marketplace_purchase",
		"member",
		"membership",
		"milestone",
		"organization",
		"org_block",
		"page_build",
		"project_card",
		"project_column",
		"project",
		"public",
		"pull_request_review_comment",
		"pull_request_review",
		"pull_request",
		"repository",
		"repository_import",
		"repository_vulnerability_alert",
		"release",
		"security_advisory",
		"status",
		"team",
		"team_add",
		"watch",
	}

	GitHubEventsDefault = []string{
		"push",
	}

	GitlabEventsDefault = []string{
		"Push Hook",
		"Tag Push Hook",
	}

	GerritEvents = []string{
		GerritEventTypePatchsetCreated,
		GerritEventTypeAssignedChanged,
		GerritEventTypeChangeAbandoned,
		GerritEventTypeChangeDeleted,
		GerritEventTypeChangeMerged,
		GerritEventTypeChangeRestored,
		GerritEventTypeCommentAdded,
		GerritEventTypeDrafPublished,
		GerritEventTypeDroppedOutput,
		GerritEventTypeHashTagsChanged,
		GerritEventTypeProjectCreated,
		GerritEventTypeRefUpdated,
		GerritEventTypeReviewerAdded,
		GerritEventTypeReviewerDelete,
		GerritEventTypeTopicChanged,
		GerritEventTypeWIPStateChanged,
		GerritEventTypePrivateStateChanged,
		GerritEventTypeVoteDeleted,
	}

	GerritEventTypeAssignedChanged     = "assignee-changed"
	GerritEventTypeChangeAbandoned     = "change-abandoned"
	GerritEventTypeChangeDeleted       = "change-deleted"
	GerritEventTypeChangeMerged        = "change-merged"
	GerritEventTypeChangeRestored      = "change-restored"
	GerritEventTypeCommentAdded        = "comment-added"
	GerritEventTypeDrafPublished       = "draft-published"
	GerritEventTypeDroppedOutput       = "dropped-output"
	GerritEventTypeHashTagsChanged     = "hashtags-changed"
	GerritEventTypeProjectCreated      = "project-created"
	GerritEventTypePatchsetCreated     = "patchset-created"
	GerritEventTypeRefUpdated          = "ref-updated"
	GerritEventTypeReviewerAdded       = "reviewer-added"
	GerritEventTypeReviewerDelete      = "reviewer-deleted"
	GerritEventTypeTopicChanged        = "topic-changed"
	GerritEventTypeWIPStateChanged     = "wip-state-changed"
	GerritEventTypePrivateStateChanged = "private-state-changed"
	GerritEventTypeVoteDeleted         = "vote-deleted"

	GerritEventsDefault = []string{
		GerritEventTypePatchsetCreated,
	}
)
View Source
var (
	//VERSION is set with -ldflags "-X github.com/ovh/cds/sdk.VERSION=$(VERSION)"
	VERSION = "snapshot"

	//GOOS is set with -ldflags "-X github.com/ovh/cds/sdk.GOOS=$(GOOS)"
	GOOS = ""

	//GOARCH is set with -ldflags "-X github.com/ovh/cds/sdk.GOARCH=$(GOARCH)"
	GOARCH = ""

	//GITHASH is set with -ldflags "-X github.com/ovh/cds/sdk.GITHASH=$(GITHASH)"
	GITHASH = ""

	//BUILDTIME is set with -ldflags "-X github.com/ovh/cds/sdk.BUILDTIME=$(BUILDTIME)"
	BUILDTIME = ""

	//BINARY is set with -ldflags "-X github.com/ovh/cds/sdk.BINARY=$(BINARY)"
	BINARY = ""

	//DBMIGRATE is set with -ldflags "-X github.com/ovh/cds/sdk.DBMIGRATE=$(DBMIGRATE)"
	// this flag contains the number of sql files to migrate for this version
	DBMIGRATE = ""
)
View Source
var (
	WorkflowRunHeader = "X-Workflow-Run"
	WorkflowHeader    = "X-Workflow"
	ProjectKeyHeader  = "X-Project-Key"
)

AuthConsumerScopes list.

View Source
var (
	// AvailableParameterType list all existing parameters type in CDS
	AvailableParameterType = []string{
		StringParameter,
		NumberParameter,
		TextParameter,
		EnvironmentParameter,
		BooleanParameter,
		ListParameter,
		PipelineParameter,
		KeySSHParameter,
		KeyPGPParameter,
		KeyParameter,
	}
)
View Source
var (
	// AvailableWorkerModelType List of all worker model type
	AvailableWorkerModelType = []string{
		string(Docker),
		string(HostProcess),
		string(Openstack),
		string(VSphere),
	}
)
View Source
var ColorRegexp = regexp.MustCompile(`^#\w{3,8}$`)

ColorRegexp represent the regexp for a format to hexadecimal color

View Source
var ErrExecutableNotFound = errors.New("executable file not found in $PATH")

ErrExecutableNotFound is the error resulting if a path search failed to find an executable file.

View Source
var MapMergeOptions = struct {
	// Function to exclude git parameters
	ExcludeGitParams CheckFunc
}{
	ExcludeGitParams: excludeGitParams,
}

MapMergeOptions options for mapMerge functions

View Source
var MessageAmericanEnglish = map[string]string{
	WarningMissingProjectVariableEnv:               `Variable {{index . "VarName"}} is used by environment {{index . "EnvironmentName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectVariableApplication:       `Variable {{index . "VarName"}} is used by application {{index . "ApplicationName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectVariablePipelineParameter: `Variable {{index . "VarName"}} is used by parameter in pipeline {{index . "PipelineName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectVariablePipelineJob:       `Variable {{index . "VarName"}} is used in pipeline {{index . "PipelineName"}}, in stage {{index . "StageName"}} by job {{index . "JobName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectVariableWorkflow:          `Variable {{index . "VarName"}} is used by the workflow {{index . "WorkflowName"}} in Pipeline {{index . "NodeName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningUnusedProjectVariable:                   `Unused variable {{index . "VarName"}} on project {{index . "ProjectKey"}}.`,
	WarningMissingProjectPermissionEnv:             `Group {{index . "GroupName"}} is not on project {{index . "ProjectKey"}} but is used on Environment {{index . "EnvironmentName"}}.`,
	WarningMissingProjectPermissionWorkflow:        `Group {{index . "GroupName"}} is not on project {{index . "ProjectKey"}} but is used on Workflow {{index . "WorkflowName"}}.`,
	WarningMissingProjectKeyApplication:            `Key {{index . "KeyName"}} is used by application {{index . "ApplicationName"}} but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectKeyPipelineParameter:      `Key {{index . "KeyName"}} is used by a parameter in pipeline {{index . "PipelineName"}}  but does not exist on project {{index . "ProjectKey"}}`,
	WarningMissingProjectKeyPipelineJob:            `Key {{index . "KeyName"}} is used by pipeline {{index . "PipelineName"}} in stage {{index . "StageName"}} in job {{index . "JobName"}}  but does not exist on project {{index . "ProjectKey"}}`,
	WarningUnusedProjectKey:                        `Unused key {{index . "KeyName"}} on project {{index . "ProjectKey"}}.`,
	WarningMissingProjectVCSServer:                 `Repository manager {{index . "VCSName"}} is used by Application: "{{index . "ApplicationName"}}" but does not exist on project {{index . "ProjectKey"}}`,
	WarningUnusedProjectVCSServer:                  `Unused repository manager {{index . "VCSName"}} on project {{index . "ProjectKey"}}.`,
	WarningMissingVCSConfiguration:                 `CDS variables .git.* are used but there is no repository manager on project {{index . "ProjectKey"}}`,
	WarningMissingApplicationVariable:              `Variable {{index . "VarName"}} is used but does not exist on project/application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}`,
	WarningUnusedApplicationVariable:               `Unused variable {{index . "VarName"}} on project/application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}.`,
	WarningMissingApplicationKey:                   `Key {{index . "KeyName"}} is used but does not exist on project/application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}`,
	WarningUnusedApplicationKey:                    `Unused key {{index . "KeyName"}} on project/application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}.`,
	WarningMissingEnvironmentVariable:              `Variable {{index . "VarName"}} is used but does not exist on project/environment {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}`,
	WarningUnusedEnvironmentVariable:               `Unused variable {{index . "VarName"}} on project/environment {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}.`,
	WarningMissingEnvironmentKey:                   `Key {{index . "KeyName"}} is used but does not exist on project/environment {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}`,
	WarningUnusedEnvironmentKey:                    `Unused key {{index . "KeyName"}} on project/environment {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}.`,
	WarningMissingPipelineParameter:                `Parameter {{index . "ParamName"}} is used but does not exist on project/pipeline {{index . "ProjectKey"}}/{{index . "PipelineName"}}`,
	WarningUnusedPipelineParameter:                 `Unused parameter {{index . "ParamName"}} on project/pipeline {{index . "ProjectKey"}}/{{index . "PipelineName"}}.`,
}
View Source
var MessageFrench = map[string]string{
	WarningMissingProjectVariableEnv:               `La variable {{index . "VarName"}} est utilisée par l'environment {{index . "EnvironmentName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectVariableApplication:       `La variable {{index . "VarName"}} est utilisée par l'application {{index . "ApplicationName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectVariablePipelineParameter: `La variable {{index . "VarName"}} est utilisée par les paramètre du pipeline {{index . "PipelineName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectVariablePipelineJob:       `La variable {{index . "VarName"}} est utilisée par le pipeline {{index . "PipelineName"}}, dans le stage {{index . "StageName"}} dans le job {{index . "JobName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectVariableWorkflow:          `La variable {{index . "VarName"}} est utilisée par le workflow {{index . "WorkflowName"}} par le pipeline {{index . "NodeName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningUnusedProjectVariable:                   `La variable {{index . "VarName"}} est inutilisée dans le projet {{index . "ProjectKey"}}.`,
	WarningMissingProjectPermissionEnv:             `Le groupe {{index . "GroupName"}} n'a pas accès au projet {{index . "ProjectKey"}} mais est positionné sur l'environment {{index . "EnvironmentName"}}.`,
	WarningMissingProjectPermissionWorkflow:        `Le groupe {{index . "GroupName"}} n'a pas accès au projet {{index . "ProjectKey"}} mais est positionné sur le workflow {{index . "WorkflowName"}}.`,
	WarningMissingProjectKeyApplication:            `La clé {{index . "KeyName"}} est utilisée dans l'application {{index . "ApplicationName"}} mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectKeyPipelineParameter:      `La clé {{index . "KeyName"}} est utilisée dans le pipeline {{index . "PipelineName"}}  mais n'existe pas dans le projet {{index . "ProjectKey"}}`,
	WarningMissingProjectKeyPipelineJob:            `La clé {{index . "KeyName"}} est utilisée dans le pipeline {{index . "PipelineName"}} dans le stage {{index . "StageName"}} dans le job {{index . "JobName"}}  but does not exist on project {{index . "ProjectKey"}}`,
	WarningUnusedProjectKey:                        `La clé {{index . "KeyName"}} est inutilisé dans le projet {{index . "ProjectKey"}}.`,
	WarningMissingProjectVCSServer:                 `Le gestionnaire de dépôt {{index . "VCSName"}} est utilisés par l'application' : "{{index . "ApplicationName"}}" mais n'existe pas sur le projet {{index . "ProjectKey"}}`,
	WarningUnusedProjectVCSServer:                  `Le gestionnaire de dépôt {{index . "VCSName"}} est inutilisé dans le project {{index . "ProjectKey"}}`,
	WarningMissingVCSConfiguration:                 `Les variables CDS git.* sont utilisées mais aucun repository manager n'est lié au projet {{index . "ProjectKey"}}`,
	WarningMissingApplicationVariable:              `La variable {{index . "VarName"}} est utilisée mais n'existe pas dans l'application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}`,
	WarningUnusedApplicationVariable:               `La variable {{index . "VarName"}} est inutilisée dans l'application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}.`,
	WarningMissingApplicationKey:                   `La clé {{index . "KeyName"}} est utilisée mais n'existe pas dans l'application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}`,
	WarningUnusedApplicationKey:                    `La clé {{index . "KeyName"}} est inutilisée dans l'application {{index . "ProjectKey"}}/{{index . "ApplicationName"}}.`,
	WarningMissingEnvironmentVariable:              `La variable {{index . "VarName"}} est utilisée mais n'existe pas dans l'environnement {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}`,
	WarningUnusedEnvironmentVariable:               `La variable {{index . "VarName"}} est inutilisée dans l'environnement {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}.`,
	WarningMissingEnvironmentKey:                   `La clé {{index . "KeyName"}} est utilisée mais n'existe pas dans l'environnement {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}`,
	WarningUnusedEnvironmentKey:                    `La clé {{index . "KeyName"}} est inutilisée dans l'environnement {{index . "ProjectKey"}}/{{index . "EnvironmentName"}}.`,
	WarningMissingPipelineParameter:                `Le paramètre {{index . "ParamName"}} est utilisé mais n'existe pas dans le pipeline {{index . "ProjectKey"}}/{{index . "PipelineName"}}`,
	WarningUnusedPipelineParameter:                 `Le paramètre {{index . "ParamName"}} est inutilisé dans le pipeline {{index . "ProjectKey"}}/{{index . "PipelineName"}}.`,
}
View Source
var Messages = map[string]*Message{
	MsgAppCreated.ID:                           MsgAppCreated,
	MsgAppUpdated.ID:                           MsgAppUpdated,
	MsgPipelineCreated.ID:                      MsgPipelineCreated,
	MsgPipelineCreationAborted.ID:              MsgPipelineCreationAborted,
	MsgPipelineExists.ID:                       MsgPipelineExists,
	MsgAppVariablesCreated.ID:                  MsgAppVariablesCreated,
	MsgAppKeyCreated.ID:                        MsgAppKeyCreated,
	MsgEnvironmentExists.ID:                    MsgEnvironmentExists,
	MsgEnvironmentCreated.ID:                   MsgEnvironmentCreated,
	MsgEnvironmentVariableUpdated.ID:           MsgEnvironmentVariableUpdated,
	MsgEnvironmentVariableCannotBeUpdated.ID:   MsgEnvironmentVariableCannotBeUpdated,
	MsgEnvironmentVariableCreated.ID:           MsgEnvironmentVariableCreated,
	MsgEnvironmentVariableCannotBeCreated.ID:   MsgEnvironmentVariableCannotBeCreated,
	MsgEnvironmentGroupUpdated.ID:              MsgEnvironmentGroupUpdated,
	MsgEnvironmentGroupCannotBeUpdated.ID:      MsgEnvironmentGroupCannotBeUpdated,
	MsgEnvironmentGroupCreated.ID:              MsgEnvironmentGroupCreated,
	MsgEnvironmentGroupCannotBeCreated.ID:      MsgEnvironmentGroupCannotBeCreated,
	MsgEnvironmentGroupDeleted.ID:              MsgEnvironmentGroupDeleted,
	MsgEnvironmentGroupCannotBeDeleted.ID:      MsgEnvironmentGroupCannotBeDeleted,
	MsgEnvironmentKeyCreated.ID:                MsgEnvironmentKeyCreated,
	MsgJobNotValidActionNotFound.ID:            MsgJobNotValidActionNotFound,
	MsgJobNotValidInvalidActionParameter.ID:    MsgJobNotValidInvalidActionParameter,
	MsgPipelineGroupUpdated.ID:                 MsgPipelineGroupUpdated,
	MsgPipelineGroupAdded.ID:                   MsgPipelineGroupAdded,
	MsgPipelineGroupDeleted.ID:                 MsgPipelineGroupDeleted,
	MsgPipelineStageUpdated.ID:                 MsgPipelineStageUpdated,
	MsgPipelineStageUpdating.ID:                MsgPipelineStageUpdating,
	MsgPipelineStageDeletingOldJobs.ID:         MsgPipelineStageDeletingOldJobs,
	MsgPipelineStageInsertingNewJobs.ID:        MsgPipelineStageInsertingNewJobs,
	MsgPipelineStageAdded.ID:                   MsgPipelineStageAdded,
	MsgPipelineStageDeleted.ID:                 MsgPipelineStageDeleted,
	MsgPipelineJobUpdated.ID:                   MsgPipelineJobUpdated,
	MsgPipelineJobAdded.ID:                     MsgPipelineJobAdded,
	MsgPipelineJobDeleted.ID:                   MsgPipelineJobDeleted,
	MsgPipelineDetached.ID:                     MsgPipelineDetached,
	MsgApplicationDetached.ID:                  MsgApplicationDetached,
	MsgEnvironmentDetached.ID:                  MsgEnvironmentDetached,
	MsgWorkflowDetached.ID:                     MsgWorkflowDetached,
	MsgSpawnInfoHatcheryStarts.ID:              MsgSpawnInfoHatcheryStarts,
	MsgSpawnInfoHatcheryErrorSpawn.ID:          MsgSpawnInfoHatcheryErrorSpawn,
	MsgSpawnInfoHatcheryStartDockerPull.ID:     MsgSpawnInfoHatcheryStartDockerPull,
	MsgSpawnInfoHatcheryEndDockerPull.ID:       MsgSpawnInfoHatcheryEndDockerPull,
	MsgSpawnInfoHatcheryEndDockerPullErr.ID:    MsgSpawnInfoHatcheryEndDockerPullErr,
	MsgSpawnInfoDeprecatedModel.ID:             MsgSpawnInfoDeprecatedModel,
	MsgSpawnInfoWorkerEnd.ID:                   MsgSpawnInfoWorkerEnd,
	MsgSpawnInfoJobInQueue.ID:                  MsgSpawnInfoJobInQueue,
	MsgSpawnInfoJobTaken.ID:                    MsgSpawnInfoJobTaken,
	MsgSpawnInfoJobTakenWorkerVersion.ID:       MsgSpawnInfoJobTakenWorkerVersion,
	MsgSpawnInfoWorkerForJob.ID:                MsgSpawnInfoWorkerForJob,
	MsgSpawnInfoWorkerForJobError.ID:           MsgSpawnInfoWorkerForJobError,
	MsgSpawnInfoJobError.ID:                    MsgSpawnInfoJobError,
	MsgWorkflowStarting.ID:                     MsgWorkflowStarting,
	MsgWorkflowError.ID:                        MsgWorkflowError,
	MsgWorkflowConditionError.ID:               MsgWorkflowConditionError,
	MsgWorkflowNodeStop.ID:                     MsgWorkflowNodeStop,
	MsgWorkflowNodeMutex.ID:                    MsgWorkflowNodeMutex,
	MsgWorkflowNodeMutexRelease.ID:             MsgWorkflowNodeMutexRelease,
	MsgWorkflowImportedUpdated.ID:              MsgWorkflowImportedUpdated,
	MsgWorkflowImportedInserted.ID:             MsgWorkflowImportedInserted,
	MsgSpawnInfoHatcheryCannotStartJob.ID:      MsgSpawnInfoHatcheryCannotStartJob,
	MsgWorkflowRunBranchDeleted.ID:             MsgWorkflowRunBranchDeleted,
	MsgWorkflowTemplateImportedInserted.ID:     MsgWorkflowTemplateImportedInserted,
	MsgWorkflowTemplateImportedUpdated.ID:      MsgWorkflowTemplateImportedUpdated,
	MsgWorkflowErrorBadPipelineName.ID:         MsgWorkflowErrorBadPipelineName,
	MsgWorkflowErrorBadApplicationName.ID:      MsgWorkflowErrorBadApplicationName,
	MsgWorkflowErrorBadEnvironmentName.ID:      MsgWorkflowErrorBadEnvironmentName,
	MsgWorkflowErrorBadIntegrationName.ID:      MsgWorkflowErrorBadIntegrationName,
	MsgWorkflowErrorBadCdsDir.ID:               MsgWorkflowErrorBadCdsDir,
	MsgWorkflowErrorUnknownKey.ID:              MsgWorkflowErrorUnknownKey,
	MsgWorkflowErrorBadVCSStrategy.ID:          MsgWorkflowErrorBadVCSStrategy,
	MsgWorkflowDeprecatedVersion.ID:            MsgWorkflowDeprecatedVersion,
	MsgWorkflowGeneratedFromTemplateVersion.ID: MsgWorkflowGeneratedFromTemplateVersion,
	MsgTooMuchWorkflowRun.ID:                   MsgTooMuchWorkflowRun,
	MsgSpawnErrorHatcheryRetryAttempt.ID:       MsgSpawnErrorHatcheryRetryAttempt,
	MsgWorkflowV3Preview.ID:                    MsgWorkflowV3Preview,
}

Messages contains all sdk Messages

View Source
var NamePatternRegex = regexp.MustCompile(NamePattern)

NamePatternRegex Pattern regexp

View Source
var NamePatternSpaceRegex = regexp.MustCompile(NamePatternSpace)

NamePatternSpaceRegex Pattern regexp

View Source
var SIGINFO = unix.SIGUSR1
View Source
var (
	SupportedLanguages = []language.Tag{
		language.AmericanEnglish,
		language.French,
	}
)

SupportedLanguages on API errors

WorkflowData conditions operator

Functions

func ActionInfoMarkdown

func ActionInfoMarkdown(a Action, filename string) string

ActionInfoMarkdown returns string formatted with markdown.

func ActionsToGroupIDs

func ActionsToGroupIDs(as []*Action) []int64

ActionsToGroupIDs returns group ids for given actions list.

func ActionsToIDs

func ActionsToIDs(as []*Action) []int64

ActionsToIDs returns ids for given actions list.

func AddParameter

func AddParameter(array *[]Parameter, name string, parameterType string, value string)

AddParameter append a parameter in a parameter array

func AddRequirement

func AddRequirement(array *RequirementList, id int64, name string, requirementType string, value string)

AddRequirement append a requirement in a requirement array

func AllowIntegrationInVariable

func AllowIntegrationInVariable(model IntegrationModel) bool

func AuthConsumersToAuthentifiedUserIDs

func AuthConsumersToAuthentifiedUserIDs(cs []*AuthConsumer) []string

AuthConsumersToAuthentifiedUserIDs returns ids of given auth consumers.

func AuthConsumersToIDs

func AuthConsumersToIDs(cs []AuthConsumer) []string

AuthConsumersToIDs returns ids of given auth consumers.

func AuthentifiedUsersToIDs

func AuthentifiedUsersToIDs(users []*AuthentifiedUser) []string

AuthentifiedUsersToIDs returns ids for given authentified user list.

func BinaryFilename

func BinaryFilename(name, os, arch, variant string) string

BinaryFilename returns artifact name cds-name-os-arch-variant this name is used on Github Releases

func Cause

func Cause(err error) error

Cause returns recursively the root error from given error.

func CheckContentTypeBinary

func CheckContentTypeBinary(resp *http.Response) error

CheckContentTypeBinary returns an error if Content-Type is not application/octet-stream

func ComputeWorkerModelPath

func ComputeWorkerModelPath(groupName, modelName string) string

ComputeWorkerModelPath returns path for a worker model with given group name and model name.

func ContextWithStacktrace

func ContextWithStacktrace(ctx context.Context, err error) context.Context

func CreateTarFromPaths

func CreateTarFromPaths(fs afero.Fs, cwd string, paths []string, w io.Writer, opts *TarOptions) error

CreateTarFromPaths returns a tar formatted reader of a tar made of several path

func DecodeError

func DecodeError(data []byte) error

DecodeError return an Error struct from json

func DefaultIfEmptyStorage

func DefaultIfEmptyStorage(integrationName string) string

DefaultIfEmptyStorage return sdk.DefaultStorageIntegrationName if integrationName is empty

func DeleteEmptyValueFromArray

func DeleteEmptyValueFromArray(array []string) []string

DeleteEmptyValueFromArray deletes empty value from an array of string

func DeleteFromArray

func DeleteFromArray(array []string, el string) []string

DeleteFromArray deletes value from an array of string

func DeleteFromInt64Array

func DeleteFromInt64Array(array []int64, el int64) []int64

DeleteFromArray deletes value from an array of int64

func DirectoryExists

func DirectoryExists(path string) (bool, error)

DirectoryExists checks if the directory exists

func DownloadFromGitHub

func DownloadFromGitHub(ctx context.Context, directory, filename string, version string) error

func DownloadURLFromGithub

func DownloadURLFromGithub(filename string, version string) (string, error)

func EnvVartoENV

func EnvVartoENV(p Parameter) []string

func ErrorIs

func ErrorIs(err error, target Error) bool

ErrorIs returns true if error match the target error.

func ErrorIsUnknown

func ErrorIsUnknown(err error) bool

ErrorIsUnknown returns true the error is unknown (sdk.ErrUnknownError or lib error).

func ErrorWithFallback

func ErrorWithFallback(err error, httpError Error, from string, args ...interface{}) error

ErrorWithFallback returns the current error if it's not a ErrUnknownError else it returns a new ErrorWithStack

func Exit

func Exit(format string, args ...interface{})

Exit func display an error message on stderr and exit 1

func FileMd5sum

func FileMd5sum(filePath string) (string, error)

FileMd5sum returns the md5sum of a file

func FileSHA512sum

func FileSHA512sum(filePath string) (string, error)

FileSHA512sum returns the sha512sum of a file

func FormatDateRFC5322

func FormatDateRFC5322(date time.Time) string

FormatDateRFC5322 format an RFC 5322 date string.

func GenerateHash

func GenerateHash() (string, error)

func GenerateProjectDefaultKeyName

func GenerateProjectDefaultKeyName(projectKey string, t KeyType) string

func GetContentType

func GetContentType(resp *http.Response) string

GetContentType returns the content-type header from a http.Response

func GetIntegrationVariablePrefix

func GetIntegrationVariablePrefix(model IntegrationModel) string

func GoroutineID

func GoroutineID() uint64

func GroupPointersToIDs

func GroupPointersToIDs(gs []*Group) []int64

GroupPointersToIDs returns ids of given groups.

func IPinRange

func IPinRange(ctx context.Context, IPrange string) ([]string, error)

IPinRange returns a slice of all IP in given IP range i.e 10.35.11.240/28

func IPinRanges

func IPinRanges(ctx context.Context, IPranges string) ([]string, error)

IPinRanges returns a slice of all IP in all given IP ranges i.e 72.44.1.240/28,72.42.1.23/27

func InitSupportedOSArch

func InitSupportedOSArch(supportedOSArchConf []string) error

func IntMapToSlice

func IntMapToSlice(m map[int64]struct{}) []int64

IntMapToSlice converts a map struct to a slice for int64 keys

func InterfaceSlice

func InterfaceSlice(slice interface{}) []interface{}

InterfaceSlice cast a untyped slice into a slice of untypes things. It will panic if the parameter is not a slice

func IsDownloadedBinary

func IsDownloadedBinary(directoriesDownload, filename string) bool

IsDownloadedBinary returns true if the binary is already downloaded, false otherwise

func IsErrorWithStack

func IsErrorWithStack(err error) bool

IsErrorWithStack returns true if given error is an errorWithStack.

func IsGz

func IsGz(buf []byte) bool

IsGz returns true if the content is gzipped

func IsInArray

func IsInArray(elt string, array []string) bool

IsInArray checks if the element is in the array

func IsInInt64Array

func IsInInt64Array(elt int64, array []int64) bool

IsInInt64Array checks if the element is in the array (int64)

func IsTar

func IsTar(buf []byte) bool

IsTar returns true if the content is a tar

func IsURL

func IsURL(path string) bool

IsURL returns if given path is a url according to the URL regex.

func IsValidEmail

func IsValidEmail(email string) bool

IsValidEmail Check if user email address is ok

func IsValidPermissionValue

func IsValidPermissionValue(v int) bool

IsValidPermissionValue checks that given permission int value match an exiting level.

func IsValidUUID

func IsValidUUID(uu string) bool

func IsValidUsername

func IsValidUsername(username string) error

func JSONUnmarshal

func JSONUnmarshal(btes []byte, i interface{}) error

func JSONWithoutHTMLEncode

func JSONWithoutHTMLEncode(t interface{}) ([]byte, error)

JSONWithoutHTMLEncode return byte array of a struct into json without HTML encode

func ListGoroutines

func ListGoroutines() ([]*stack.Goroutine, error)

func LookPath

func LookPath(fs afero.Fs, file string) (string, error)

LookPath searches for an executable named file in the directories named by the PATH environment variable. If file contains a slash, it is tried directly and the PATH is not consulted. The result may be an absolute path or a path relative to the current directory.

func MessagesToError

func MessagesToError(messages []Message) error

MessagesToError returns a translated slices of messages as an error

func ModelsToGroupIDs

func ModelsToGroupIDs(ms []*Model) []int64

ModelsToGroupIDs returns group ids of given worker models.

func NeedPlaceholder

func NeedPlaceholder(t string) bool

NeedPlaceholder returns true if variable type is either secret or key

func NewArtifactoryClient

func NewArtifactoryClient(url string, token string) (artifactory.ArtifactoryServicesManager, error)

func NewError

func NewError(httpError Error, err error) error

NewError returns a merge of given err with new http error.

func NewErrorFrom

func NewErrorFrom(err error, from string, args ...interface{}) error

NewErrorFrom returns the given error with given from details.

func NewErrorWithStack

func NewErrorWithStack(root error, err error) error

NewErrorWithStack wraps given root error and override its http error with given error.

func ParameterAddOrSetValue

func ParameterAddOrSetValue(vars *[]Parameter, name string, parameterType string, value string)

ParameterAddOrSetValue add a new parameter or update a value

func ParameterValue

func ParameterValue(vars []Parameter, s string) string

ParameterValue return a parameter value given its name if it exists in array, else it returns empty string

func ParametersFromApplicationKeys

func ParametersFromApplicationKeys(app Application) map[string]string

ParametersFromApplicationVariables returns a map from application key

func ParametersFromApplicationVariables

func ParametersFromApplicationVariables(app Application) map[string]string

ParametersFromApplicationVariables returns a map from a slice of parameters

func ParametersFromEnvironmentKeys

func ParametersFromEnvironmentKeys(env Environment) map[string]string

ParametersFromEnvironmentKeys returns a map from environment key

func ParametersFromEnvironmentVariables

func ParametersFromEnvironmentVariables(env Environment) map[string]string

ParametersFromEnvironmentVariables returns a map from a slice of parameters

func ParametersFromIntegration

func ParametersFromIntegration(prefix string, ppf IntegrationConfig) map[string]string

ParametersFromIntegration returns a map of variables from a ProjectIntegration

func ParametersFromPipelineParameters

func ParametersFromPipelineParameters(pipParams []Parameter) map[string]string

ParametersFromPipelineParameters returns a map from a slice of parameters

func ParametersFromProjectKeys

func ParametersFromProjectKeys(proj Project) map[string]string

func ParametersFromProjectVariables

func ParametersFromProjectVariables(proj Project) map[string]string

ParametersFromProjectVariables returns a map from a slice of parameters

func ParametersMapMerge

func ParametersMapMerge(params map[string]string, otherParams map[string]string, checkFuncs ...func(string) bool) map[string]string

ParametersMapMerge merges two maps of parameters

func ParametersToMap

func ParametersToMap(params []Parameter) map[string]string

ParametersToMap returns a map from a slice of parameters

func ParseDateRFC5322

func ParseDateRFC5322(date string) (time.Time, error)

ParseDateRFC5322 parses an RFC 5322 date string.

func PathIsAbs

func PathIsAbs(s string) bool

func ProjectsToIDs

func ProjectsToIDs(ps []Project) []int64

ProjectsToIDs returns ids of given projects.

func RandomString

func RandomString(strlen int) string

RandomString generate random string containing a-zA-Z0-9

func ReflectFieldByTag

func ReflectFieldByTag(i interface{}, tagKey, tagValues string) interface{}

ReflectFieldByTag returns a pointer to a value corresponding to a tag For instance:

		sdk.ReflectFieldByTag(&Configuration{}, "toml", "api.database.name")

		Search for a field tagged 'toml:api' that is a struct.
		is this value, there is a field tagged 'toml:database' that is a struct.
     finally in this value, there a field tagged 'toml:name'. We return a pointer to this field.

func RemoveNotPrintableChar

func RemoveNotPrintableChar(in string) string

func Round

func Round(d, r time.Duration) time.Duration

Round rounds a duration, see original source here: https://play.golang.org/p/WjfKwhhjL5 round("1h23m45.6789s", time.Second} will returns want: "1h23m46s"

func SHA512sum

func SHA512sum(s string) (string, error)

func StatusIsTerminated

func StatusIsTerminated(status string) bool

StatusIsTerminated returns if status is terminated (nothing related to building or waiting, ...)

func StatusValidate

func StatusValidate(status ...string) bool

StatusValidate returns if given strings are valid status.

func StringFirstN

func StringFirstN(s string, i int) string

func StringIsAscii

func StringIsAscii(s string) bool

func ToVulnerabilitySeverity

func ToVulnerabilitySeverity(s string) string

ToVulnerabilitySeverity converts string to good severity name

func UUID

func UUID() string

UUID returns a UUID v4

func Untar

func Untar(fs afero.Fs, dst string, r io.Reader) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func UntarGz

func UntarGz(fs afero.Fs, dst string, r io.Reader) error

UntarGz takes a destination path and a reader; a tar.gz reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func VCSCommitStatusDescription

func VCSCommitStatusDescription(projKey, workflowName string, evt EventRunWorkflowNode) string

VCSCommitStatusDescription return a node formated status description

func ValidAndNotEmpty

func ValidAndNotEmpty(v reflect.Value) bool

func ValueFromInterface

func ValueFromInterface(i interface{}) reflect.Value

func VersionString

func VersionString() string

VersionString returns a string contains all about current version

func WithData

func WithData(err error, data interface{}) error

WithData returns an error with data from given error.

func WithStack

func WithStack(err error) error

WithStack returns an error with stack from given error.

func WorkerModelValidate

func WorkerModelValidate(modelType string) bool

WorkerModelValidate returns if given strings are valid worker model type.

func WorkflowCheckConditions

func WorkflowCheckConditions(conditions []WorkflowNodeCondition, params []Parameter) (bool, error)

WorkflowCheckConditions checks conditions given a list of parameters

func WorkflowTemplateInstancesToIDs

func WorkflowTemplateInstancesToIDs(wtis []*WorkflowTemplateInstance) []int64

WorkflowTemplateInstancesToIDs returns ids of given workflow template instances.

func WorkflowTemplateInstancesToWorkflowIDs

func WorkflowTemplateInstancesToWorkflowIDs(wtis []*WorkflowTemplateInstance) []int64

WorkflowTemplateInstancesToWorkflowIDs returns workflow ids of given workflow template instances.

func WorkflowTemplateInstancesToWorkflowTemplateIDs

func WorkflowTemplateInstancesToWorkflowTemplateIDs(wtis []*WorkflowTemplateInstance) []int64

WorkflowTemplateInstancesToWorkflowTemplateIDs returns workflow template ids of given workflow template instances.

func WorkflowTemplatesToGroupIDs

func WorkflowTemplatesToGroupIDs(wts []*WorkflowTemplate) []int64

WorkflowTemplatesToGroupIDs returns group ids of given workflow templates.

func WorkflowTemplatesToIDs

func WorkflowTemplatesToIDs(wts []*WorkflowTemplate) []int64

WorkflowTemplatesToIDs returns ids of given workflow templates.

func WorkflowToIDs

func WorkflowToIDs(ws []*Workflow) []int64

WorkflowToIDs returns ids of given workflows.

func WrapError

func WrapError(err error, format string, args ...interface{}) error

WrapError returns an error with stack and message.

Types

type APIConfig

type APIConfig struct {
	DefaultRunRetentionPolicy string `json:"default_run_retention_policy"`
}

type Action

type Action struct {
	ID          int64  `json:"id" yaml:"-" db:"id"`
	GroupID     *int64 `json:"group_id,omitempty" yaml:"-" db:"group_id"`
	Name        string `json:"name" db:"name"`
	Type        string `json:"type" yaml:"-" db:"type"`
	Description string `json:"description" yaml:"desc,omitempty" db:"description"`
	Enabled     bool   `json:"enabled" yaml:"-" db:"enabled"`
	Deprecated  bool   `json:"deprecated" yaml:"-" db:"deprecated"`
	// aggregates from action_edge
	StepName       string `json:"step_name,omitempty" yaml:"step_name,omitempty" db:"-"`
	Optional       bool   `json:"optional" yaml:"-" db:"-"`
	AlwaysExecuted bool   `json:"always_executed" yaml:"-" db:"-"`
	// aggregates
	Requirements RequirementList `json:"requirements" db:"-"`
	Parameters   []Parameter     `json:"parameters" db:"-"`
	Actions      []Action        `json:"actions,omitempty" yaml:"actions,omitempty" db:"-"`
	Group        *Group          `json:"group,omitempty" db:"-"`
	FirstAudit   *AuditAction    `json:"first_audit,omitempty" db:"-"`
	LastAudit    *AuditAction    `json:"last_audit,omitempty" db:"-"`
	Editable     bool            `json:"editable,omitempty" db:"-"`
}

Action is the base element of CDS pipeline

func ActionsFilterNotTypes

func ActionsFilterNotTypes(as []*Action, ts ...string) []*Action

ActionsFilterNotTypes returns a list of actions filtered by types.

func NewAction

func NewAction(name string) *Action

NewAction instantiate a new Action

func (*Action) Add

func (a *Action) Add(child Action) *Action

Add takes an action that will be executed when current action is executed

func (*Action) FlattenRequirements

func (a *Action) FlattenRequirements() RequirementList

FlattenRequirements returns all requirements for an action and its children.

func (Action) IsValid

func (a Action) IsValid() error

IsValid returns error if the action is not valid.

func (Action) IsValidDefault

func (a Action) IsValidDefault() error

IsValidDefault returns default action validity.

func (*Action) Parameter

func (a *Action) Parameter(p Parameter) *Action

Parameter add given parameter to Action

func (*Action) Requirement

func (a *Action) Requirement(name string, t string, value string) *Action

Requirement add given requirement to Action

func (*Action) Scan

func (a *Action) Scan(src interface{}) error

Scan action.

func (Action) ToSummary

func (a Action) ToSummary() ActionSummary

ToSummary returns an ActionSummary from an Action

func (Action) ToUniqueChildrenIDs

func (a Action) ToUniqueChildrenIDs() []int64

ToUniqueChildrenIDs returns distinct children ids for given action.

func (Action) Value

func (a Action) Value() (driver.Value, error)

Value returns driver.Value from action.

type ActionSummary

type ActionSummary struct {
	Name     string `json:"name"`
	StepName string `json:"step_name"`
}

ActionSummary is the light representation of an action for CDS event

type ActionUsages

type ActionUsages struct {
	Pipelines []UsagePipeline `json:"pipelines"`
	Actions   []UsageAction   `json:"actions"`
}

ActionUsages for action.

type Application

type Application struct {
	ID                   int64                        `json:"id" db:"id"`
	Name                 string                       `json:"name" db:"name" cli:"name,key"`
	Description          string                       `json:"description" db:"description"`
	Icon                 string                       `json:"icon" db:"icon"`
	ProjectID            int64                        `json:"-" db:"project_id"`
	ProjectKey           string                       `json:"project_key" db:"-" cli:"project_key"`
	Variables            []ApplicationVariable        `json:"variables,omitempty" db:"-"`
	Notifications        []UserNotification           `json:"notifications,omitempty" db:"-"`
	LastModified         time.Time                    `json:"last_modified" db:"last_modified" mapstructure:"-"`
	VCSServer            string                       `json:"vcs_server,omitempty" db:"vcs_server"`
	RepositoryFullname   string                       `json:"repository_fullname,omitempty" db:"repo_fullname" cli:"repository_fullname"`
	RepositoryStrategy   RepositoryStrategy           `json:"vcs_strategy,omitempty" db:"cipher_vcs_strategy" gorpmapping:"encrypted,ProjectID,Name"`
	Metadata             Metadata                     `json:"metadata" yaml:"metadata" db:"metadata"`
	Keys                 []ApplicationKey             `json:"keys" yaml:"keys" db:"-"`
	Usage                *Usage                       `json:"usage,omitempty" db:"-" cli:"-"`
	DeploymentStrategies map[string]IntegrationConfig `json:"deployment_strategies,omitempty" db:"-" cli:"-"`
	Vulnerabilities      []Vulnerability              `json:"vulnerabilities,omitempty" db:"-" cli:"-"`
	FromRepository       string                       `json:"from_repository,omitempty" db:"from_repository" cli:"-"`
	// aggregate
	WorkflowAscodeHolder *Workflow `json:"workflow_ascode_holder,omitempty" cli:"-" db:"-"`
}

Application represent an application in a project

func (Application) GetKey

func (app Application) GetKey(kname string) *ApplicationKey

GetKey return a key by name

func (Application) GetSSHKey

func (app Application) GetSSHKey(kname string) *ApplicationKey

GetSSHKey return a key by name

func (Application) IsValid

func (app Application) IsValid() error

IsValid returns error if the application is not valid.

func (Application) PGPKeys

func (app Application) PGPKeys() []ApplicationKey

PGPKeys returns the slice of pgp key for an application

func (Application) SSHKeys

func (app Application) SSHKeys() []ApplicationKey

SSHKeys returns the slice of ssh key for an application

type ApplicationKey

type ApplicationKey struct {
	ID            int64   `json:"id" db:"id" cli:"-"`
	Name          string  `json:"name" db:"name" cli:"name"`
	Public        string  `json:"public" db:"public" cli:"publickey"`
	Private       string  `json:"private" db:"private" cli:"-" gorpmapping:"encrypted,ID,Name"`
	KeyID         string  `json:"key_id" db:"key_id" cli:"-"`
	Type          KeyType `json:"type" db:"type" cli:"type"`
	ApplicationID int64   `json:"application_id" db:"application_id"`
}

ApplicationKey represent a key attach to an application

type ApplicationOverview

type ApplicationOverview struct {
	Graphs  []ApplicationOverviewGraph      `json:"graphs,omitempty"`
	GitURL  string                          `json:"git_url,omitempty"`
	History map[string][]WorkflowRunSummary `json:"history,omitempty"`
}

ApplicationOverview represents the overview of an application

type ApplicationOverviewGraph

type ApplicationOverviewGraph struct {
	Type  string            `json:"type"`
	Datas []json.RawMessage `json:"datas"`
}

ApplicationOverviewGraph represents data pushed by CDS for metrics

type ApplicationTemplate

type ApplicationTemplate struct {
	Value string `json:"value"`
}

ApplicationTemplate struct.

func (*ApplicationTemplate) IsValid

func (a *ApplicationTemplate) IsValid() error

IsValid returns application template validity.

type ApplicationTemplates

type ApplicationTemplates []ApplicationTemplate

ApplicationTemplates struct.

func (*ApplicationTemplates) Scan

func (a *ApplicationTemplates) Scan(src interface{}) error

Scan application templates.

func (ApplicationTemplates) Value

func (a ApplicationTemplates) Value() (driver.Value, error)

Value returns driver.Value from workflow template applications.

type ApplicationVariable

type ApplicationVariable struct {
	ID            int64  `json:"id,omitempty" cli:"-"`
	Name          string `json:"name" cli:"name,key"`
	Value         string `json:"value" cli:"value"`
	Type          string `json:"type" cli:"type"`
	ApplicationID int64  `json:"application_id" cli:"-"`
}

type ApplicationVariableAudit

type ApplicationVariableAudit struct {
	ID             int64                `json:"id" yaml:"-" db:"id"`
	ApplicationID  int64                `json:"application_id" yaml:"-" db:"application_id"`
	VariableID     int64                `json:"variable_id" yaml:"-" db:"variable_id"`
	Type           string               `json:"type" yaml:"-" db:"type"`
	VariableBefore *ApplicationVariable `json:"variable_before,omitempty" yaml:"-" db:"-"`
	VariableAfter  ApplicationVariable  `json:"variable_after,omitempty" yaml:"-" db:"-"`
	Versionned     time.Time            `json:"versionned" yaml:"-" db:"versionned"`
	Author         string               `json:"author" yaml:"-" db:"author"`
}

ApplicationVariableAudit represents an audit on an application variable

type ArtifactsStore

type ArtifactsStore struct {
	Name                  string `json:"name"`
	TemporaryURLSupported bool   `json:"temporary_url_supported"`
}

ArtifactsStore represents

type AsCodeEvent

type AsCodeEvent struct {
	ID             int64           `json:"id" db:"id"`
	WorkflowID     int64           `json:"workflow_id" db:"workflow_id"`
	PullRequestID  int64           `json:"pullrequest_id" db:"pullrequest_id"`
	PullRequestURL string          `json:"pullrequest_url" db:"pullrequest_url"`
	Username       string          `json:"username" db:"username"`
	CreateDate     time.Time       `json:"creation_date" db:"creation_date"`
	FromRepo       string          `json:"from_repository" db:"from_repository"`
	Migrate        bool            `json:"migrate" db:"migrate"`
	Data           AsCodeEventData `json:"data" db:"data"`
}

type AsCodeEventData

type AsCodeEventData struct {
	Workflows    AsCodeEventDataValue `json:"workflows"`
	Pipelines    AsCodeEventDataValue `json:"pipelines"`
	Applications AsCodeEventDataValue `json:"applications"`
	Environments AsCodeEventDataValue `json:"environments"`
}

func (*AsCodeEventData) Scan

func (d *AsCodeEventData) Scan(src interface{}) error

Scan consumer data.

func (AsCodeEventData) Value

func (d AsCodeEventData) Value() (driver.Value, error)

Value returns driver.Value from consumer data.

type AsCodeEventDataValue

type AsCodeEventDataValue map[int64]string

type Audit

type Audit interface {
	Compute(ctx context.Context, db gorp.SqlExecutor, e Event) error
}

Audit represents audit interface.

type AuditAction

type AuditAction struct {
	AuditCommon
	ActionID   int64  `json:"action_id" db:"action_id"`
	DataType   string `json:"data_type" db:"data_type"`
	DataBefore string `json:"data_before" db:"data_before"`
	DataAfter  string `json:"data_after" db:"data_after"`
}

AuditAction represents an audit data on a action.

type AuditCommon

type AuditCommon struct {
	ID          int64     `json:"id" db:"id"`
	TriggeredBy string    `json:"triggered_by" db:"triggered_by"`
	Created     time.Time `json:"created" db:"created" mapstructure:"-"`
	EventType   string    `json:"event_type" db:"event_type"`
}

AuditCommon contains basic stuff for audits.

type AuditWorkflow

type AuditWorkflow struct {
	AuditCommon
	ProjectKey string `json:"project_key" db:"project_key"`
	WorkflowID int64  `json:"workflow_id" db:"workflow_id"`
	DataType   string `json:"data_type" db:"data_type"`
	DataBefore string `json:"data_before" db:"data_before"`
	DataAfter  string `json:"data_after" db:"data_after"`
}

AuditWorkflow represents an audit data on a workflow.

type AuditWorkflowTemplate

type AuditWorkflowTemplate struct {
	AuditCommon
	WorkflowTemplateID int64            `json:"workflow_template_id" db:"workflow_template_id"`
	ChangeMessage      string           `json:"change_message,omitempty" db:"change_message"`
	DataBefore         WorkflowTemplate `json:"data_before" db:"data_before"`
	DataAfter          WorkflowTemplate `json:"data_after" db:"data_after"`
}

AuditWorkflowTemplate represents an audit data on a workflow template.

type AuditWorkflowTemplateInstance

type AuditWorkflowTemplateInstance struct {
	AuditCommon
	WorkflowTemplateInstanceID int64  `json:"workflow_template_instance_id" db:"workflow_template_instance_id"`
	DataType                   string `json:"data_type" db:"data_type"`
	DataBefore                 string `json:"data_before" db:"data_before"`
	DataAfter                  string `json:"data_after" db:"data_after"`
}

AuditWorkflowTemplateInstance represents an audit data on a workflow template instance.

type AuthConsumer

type AuthConsumer struct {
	ID                 string                      `json:"id" cli:"id,key" db:"id"`
	Name               string                      `json:"name" cli:"name" db:"name"`
	Description        string                      `json:"description" cli:"description" db:"description"`
	ParentID           *string                     `json:"parent_id,omitempty" db:"parent_id"`
	AuthentifiedUserID string                      `json:"user_id,omitempty" db:"user_id"`
	Type               AuthConsumerType            `json:"type" cli:"type" db:"type"`
	Data               AuthConsumerData            `json:"-" db:"data"` // NEVER returns auth consumer data in json, TODO this fields should be visible only in auth package
	Created            time.Time                   `json:"created" cli:"created" db:"created"`
	GroupIDs           Int64Slice                  `json:"group_ids,omitempty" cli:"group_ids" db:"group_ids"`
	InvalidGroupIDs    Int64Slice                  `json:"invalid_group_ids,omitempty" db:"invalid_group_ids"`
	ScopeDetails       AuthConsumerScopeDetails    `json:"scope_details,omitempty" cli:"scope_details" db:"scope_details"`
	DeprecatedIssuedAt time.Time                   `json:"issued_at" cli:"issued_at" db:"issued_at"`
	Disabled           bool                        `json:"disabled" cli:"disabled" db:"disabled"`
	Warnings           AuthConsumerWarnings        `json:"warnings,omitempty" db:"warnings"`
	LastAuthentication *time.Time                  `json:"last_authentication,omitempty" db:"last_authentication"`
	ValidityPeriods    AuthConsumerValidityPeriods `json:"validity_periods,omitempty" db:"validity_periods"`
	// aggregates
	AuthentifiedUser *AuthentifiedUser `json:"user,omitempty" db:"-"`
	Groups           Groups            `json:"groups,omitempty" db:"-"`
	// aggregates by router auth middleware
	Service *Service `json:"-" db:"-"`
	Worker  *Worker  `json:"-" db:"-"`
}

AuthConsumer issues session linked to an authentified user.

func (AuthConsumer) Admin

func (c AuthConsumer) Admin() bool

func (AuthConsumer) GetEmail

func (c AuthConsumer) GetEmail() string

func (AuthConsumer) GetFullname

func (c AuthConsumer) GetFullname() string

func (AuthConsumer) GetGroupIDs

func (c AuthConsumer) GetGroupIDs() []int64

GetGroupIDs returns group ids for auth consumer, if empty in consumer returns group ids from authentified user.

func (AuthConsumer) GetUsername

func (c AuthConsumer) GetUsername() string

func (AuthConsumer) IsValid

func (c AuthConsumer) IsValid(scopeDetails AuthConsumerScopeDetails) error

IsValid returns validity for auth consumer.

func (AuthConsumer) Maintainer

func (c AuthConsumer) Maintainer() bool

type AuthConsumerCreateResponse

type AuthConsumerCreateResponse struct {
	Token    string        `json:"token"` // sign in token
	Consumer *AuthConsumer `json:"consumer"`
}

AuthConsumerCreateResponse response for a auth consumer creation.

type AuthConsumerData

type AuthConsumerData map[string]string

AuthConsumerData contains specific information from the auth driver.

func (*AuthConsumerData) Scan

func (d *AuthConsumerData) Scan(src interface{}) error

Scan consumer data.

func (AuthConsumerData) Value

func (d AuthConsumerData) Value() (driver.Value, error)

Value returns driver.Value from consumer data.

type AuthConsumerRegenRequest

type AuthConsumerRegenRequest struct {
	RevokeSessions  bool   `json:"revoke_sessions"`
	OverlapDuration string `json:"overlap_duration"`
	NewDuration     int64  `json:"new_duration"`
}

AuthConsumerRegenRequest struct.

type AuthConsumerScope

type AuthConsumerScope string

AuthConsumerScope alias type for string.

const (
	AuthConsumerScopeUser         AuthConsumerScope = "User"
	AuthConsumerScopeAccessToken  AuthConsumerScope = "AccessToken"
	AuthConsumerScopeAction       AuthConsumerScope = "Action"
	AuthConsumerScopeAdmin        AuthConsumerScope = "Admin"
	AuthConsumerScopeGroup        AuthConsumerScope = "Group"
	AuthConsumerScopeTemplate     AuthConsumerScope = "Template"
	AuthConsumerScopeProject      AuthConsumerScope = "Project"
	AuthConsumerScopeRun          AuthConsumerScope = "Run"
	AuthConsumerScopeRunExecution AuthConsumerScope = "RunExecution"
	AuthConsumerScopeHooks        AuthConsumerScope = "Hooks"
	AuthConsumerScopeWorker       AuthConsumerScope = "Worker"
	AuthConsumerScopeWorkerModel  AuthConsumerScope = "WorkerModel"
	AuthConsumerScopeHatchery     AuthConsumerScope = "Hatchery"
	AuthConsumerScopeService      AuthConsumerScope = "Service"
)

Available auth consumer scopes.

func (AuthConsumerScope) IsValid

func (s AuthConsumerScope) IsValid() bool

IsValid returns validity for scope.

type AuthConsumerScopeDetail

type AuthConsumerScopeDetail struct {
	Scope     AuthConsumerScope          `json:"scope"`
	Endpoints AuthConsumerScopeEndpoints `json:"endpoints,omitempty"`
}

AuthConsumerScopeDetail contains all endpoints for a scope.

type AuthConsumerScopeDetails

type AuthConsumerScopeDetails []AuthConsumerScopeDetail

AuthConsumerScopeDetails type used for database json storage.

func NewAuthConsumerScopeDetails

func NewAuthConsumerScopeDetails(scopes ...AuthConsumerScope) AuthConsumerScopeDetails

func (AuthConsumerScopeDetails) IsValid

func (s AuthConsumerScopeDetails) IsValid() error

IsValid returns an error if current details are invalids.

func (*AuthConsumerScopeDetails) Scan

func (s *AuthConsumerScopeDetails) Scan(src interface{}) error

Scan scope detail slice.

func (AuthConsumerScopeDetails) ToEndpointsMap

func (AuthConsumerScopeDetails) Value

Value returns driver.Value from scope detail slice.

type AuthConsumerScopeEndpoint

type AuthConsumerScopeEndpoint struct {
	Route   string      `json:"route"`
	Methods StringSlice `json:"methods,omitempty"`
}

type AuthConsumerScopeEndpoints

type AuthConsumerScopeEndpoints []AuthConsumerScopeEndpoint

func (AuthConsumerScopeEndpoints) FindEndpoint

type AuthConsumerScopeSlice

type AuthConsumerScopeSlice []AuthConsumerScope

AuthConsumerScopeSlice type used for database json storage.

func (*AuthConsumerScopeSlice) Scan

func (s *AuthConsumerScopeSlice) Scan(src interface{}) error

Scan scope slice.

func (AuthConsumerScopeSlice) Value

Value returns driver.Value from scope slice.

type AuthConsumerSigninRequest

type AuthConsumerSigninRequest map[string]string

AuthConsumerSigninRequest struct for auth consumer signin request.

type AuthConsumerSigninResponse

type AuthConsumerSigninResponse struct {
	APIURL string            `json:"api_url,omitempty"`
	Token  string            `json:"token"` // session token
	User   *AuthentifiedUser `json:"user"`
}

AuthConsumerSigninResponse response for a auth consumer signin.

type AuthConsumerType

type AuthConsumerType string

AuthConsumerType constant to identify what is the driver used to create a consumer.

const (
	ConsumerBuiltin      AuthConsumerType = "builtin"
	ConsumerLocal        AuthConsumerType = "local"
	ConsumerLDAP         AuthConsumerType = "ldap"
	ConsumerCorporateSSO AuthConsumerType = "corporate-sso"
	ConsumerGithub       AuthConsumerType = "github"
	ConsumerGitlab       AuthConsumerType = "gitlab"
	ConsumerOIDC         AuthConsumerType = "openid-connect"
	ConsumerTest         AuthConsumerType = "futurama"
	ConsumerTest2        AuthConsumerType = "planet-express"
)

Consumer types.

func (AuthConsumerType) IsValid

func (t AuthConsumerType) IsValid() bool

IsValid returns validity of given auth consumer type.

func (AuthConsumerType) IsValidExternal

func (t AuthConsumerType) IsValidExternal() bool

IsValidExternal returns validity of given auth consumer type.

type AuthConsumerValidityPeriod

type AuthConsumerValidityPeriod struct {
	IssuedAt time.Time     `json:"issued_at" cli:"issued_at" `
	Duration time.Duration `json:"duration" cli:"duration"`
}

type AuthConsumerValidityPeriods

type AuthConsumerValidityPeriods []AuthConsumerValidityPeriod

func NewAuthConsumerValidityPeriod

func NewAuthConsumerValidityPeriod(iat time.Time, duration time.Duration) AuthConsumerValidityPeriods

func (AuthConsumerValidityPeriods) Latest

func (*AuthConsumerValidityPeriods) Scan

func (p *AuthConsumerValidityPeriods) Scan(src interface{}) error

func (*AuthConsumerValidityPeriods) Sort

func (p *AuthConsumerValidityPeriods) Sort()

func (AuthConsumerValidityPeriods) Value

type AuthConsumerWarning

type AuthConsumerWarning struct {
	Type      AuthConsumerWarningType `json:"type"`
	GroupID   int64                   `json:"group_id,omitempty"`
	GroupName string                  `json:"group_name,omitempty"`
}

AuthConsumerWarning contains info about a warning.

func NewConsumerWarningGroupInvalid

func NewConsumerWarningGroupInvalid(groupID int64, groupName string) AuthConsumerWarning

NewConsumerWarningGroupInvalid returns a new warning for given group info.

func NewConsumerWarningGroupRemoved

func NewConsumerWarningGroupRemoved(groupID int64, groupName string) AuthConsumerWarning

NewConsumerWarningGroupRemoved returns a new warning for given group info.

func NewConsumerWarningLastGroupRemoved

func NewConsumerWarningLastGroupRemoved() AuthConsumerWarning

NewConsumerWarningLastGroupRemoved returns a new warning.

type AuthConsumerWarningType

type AuthConsumerWarningType string

AuthConsumerWarningType constant for consumer warnings.

const (
	WarningGroupInvalid     AuthConsumerWarningType = "group-invalid"
	WarningGroupRemoved     AuthConsumerWarningType = "group-removed"
	WarningLastGroupRemoved AuthConsumerWarningType = "last-group-removed"
)

Consumer warning types.

type AuthConsumerWarnings

type AuthConsumerWarnings []AuthConsumerWarning

AuthConsumerWarnings contains specific information from the auth driver.

func (*AuthConsumerWarnings) Scan

func (w *AuthConsumerWarnings) Scan(src interface{}) error

Scan consumer data.

func (AuthConsumerWarnings) Value

func (w AuthConsumerWarnings) Value() (driver.Value, error)

Value returns driver.Value from consumer warnings.

type AuthConsumers

type AuthConsumers []AuthConsumer

AuthConsumers gives functions for auth consumer slice.

type AuthCurrentConsumerResponse

type AuthCurrentConsumerResponse struct {
	User           AuthentifiedUser   `json:"user"`
	Consumer       AuthConsumer       `json:"consumer"`
	Session        AuthSession        `json:"session"`
	DriverManifest AuthDriverManifest `json:"driver_manifest"`
}

AuthCurrentConsumerResponse describe the current consumer and the current session

type AuthDriver

type AuthDriver interface {
	GetManifest() AuthDriverManifest
	GetSessionDuration() time.Duration
	CheckSigninRequest(AuthConsumerSigninRequest) error
	GetUserInfo(context.Context, AuthConsumerSigninRequest) (AuthDriverUserInfo, error)
}

AuthDriver interface.

type AuthDriverManifest

type AuthDriverManifest struct {
	Type           AuthConsumerType `json:"type"`
	SignupDisabled bool             `json:"signup_disabled"`
	SupportMFA     bool             `json:"support_mfa"`
}

AuthDriverManifest struct describe a auth driver.

type AuthDriverManifests

type AuthDriverManifests []AuthDriverManifest

AuthDriverManifests gives functions on driver manifest slice.

func (AuthDriverManifests) ExistsConsumerType

func (a AuthDriverManifests) ExistsConsumerType(consumerType AuthConsumerType) bool

ExistsConsumerType returns if a driver exists for given consumer type.

func (AuthDriverManifests) FindByConsumerType

func (a AuthDriverManifests) FindByConsumerType(consumerType AuthConsumerType) (AuthDriverManifest, bool)

FindByConsumerType returns a manifest for given consumer type if exists.

type AuthDriverResponse

type AuthDriverResponse struct {
	IsFirstConnection bool                `json:"is_first_connection"`
	Drivers           AuthDriverManifests `json:"manifests"`
}

AuthDriverResponse struct contains drivers manifest and some info about auth config.

type AuthDriverSigningRedirect

type AuthDriverSigningRedirect struct {
	Method      string            `json:"method"`
	URL         string            `json:"url"`
	Body        map[string]string `json:"body"`
	ContentType string            `json:"content_type"`
}

type AuthDriverUserInfo

type AuthDriverUserInfo struct {
	ExternalID      string
	Username        string
	Fullname        string
	Email           string
	MFA             bool
	ExternalTokenID string
	Organization    string
}

AuthDriverUserInfo struct discribed a user returns by a auth driver.

type AuthDriverWithRedirect

type AuthDriverWithRedirect interface {
	AuthDriver
	GetSigninURI(AuthSigninConsumerToken) (AuthDriverSigningRedirect, error)
}

type AuthDriverWithSigninStateToken

type AuthDriverWithSigninStateToken interface {
	AuthDriver
	CheckSigninStateToken(AuthConsumerSigninRequest) error
}

type AuthSession

type AuthSession struct {
	ID         string    `json:"id" cli:"id,key" db:"id"`
	ConsumerID string    `json:"consumer_id" cli:"consumer_id" db:"consumer_id"`
	ExpireAt   time.Time `json:"expire_at,omitempty" cli:"expire_at" db:"expire_at"`
	Created    time.Time `json:"created" cli:"created" db:"created"`
	MFA        bool      `json:"mfa" cli:"mfa" db:"mfa"`
	// aggregates
	Consumer     *AuthConsumer `json:"consumer,omitempty" db:"-"`
	Groups       []Group       `json:"groups,omitempty" db:"-"`
	Current      bool          `json:"current,omitempty" cli:"current" db:"-"`
	LastActivity *time.Time    `json:"last_activity,omitempty" cli:"last_activity,omitempty" db:"-"`
}

AuthSession struct.

type AuthSessionJWTClaims

type AuthSessionJWTClaims struct {
	ID      string
	TokenID string
	jwt.StandardClaims
}

AuthSessionJWTClaims is the specific claims format for JWT session.

type AuthSessions

type AuthSessions []AuthSession

AuthSessions gives functions for auth session slice.

type AuthSigninConsumerToken

type AuthSigninConsumerToken struct {
	IssuedAt          int64  `json:"issued_at"`
	Origin            string `json:"origin,omitempty"`
	RedirectURI       string `json:"redirect_uri,omitempty"`
	RequireMFA        bool   `json:"require_mfa,omitempty"`
	IsFirstConnection bool   `json:"is_first_connection,omitempty"`
}

AuthSigninConsumerToken discribes the payload for a signin state token.

type AuthentifiedUser

type AuthentifiedUser struct {
	ID       string    `json:"id" yaml:"id" cli:"id" db:"id"`
	Created  time.Time `json:"created" yaml:"created" cli:"created" db:"created"`
	Username string    `json:"username" yaml:"username" cli:"username,key" db:"username"`
	Fullname string    `json:"fullname" yaml:"fullname,omitempty" cli:"fullname" db:"fullname"`
	Ring     string    `json:"ring" yaml:"ring,omitempty" cli:"ring" db:"ring"`
	// aggregates
	Contacts     UserContacts `json:"-" yaml:"-" db:"-"`
	Favorites    []Favorite   `json:"favorites" yaml:"favorites" db:"-"`
	Groups       Groups       `json:"groups" yaml:"groups" db:"-"`
	Organization string       `json:"organization,omitempty" yaml:"organization,omitempty" cli:"organization" db:"-"`
}

AuthentifiedUser struct contains all information about a cds user.

func (AuthentifiedUser) GetEmail

func (u AuthentifiedUser) GetEmail() string

GetEmail return the primary email for the authentified user (should exists).

func (AuthentifiedUser) GetFullname

func (u AuthentifiedUser) GetFullname() string

func (AuthentifiedUser) GetGroupIDs

func (u AuthentifiedUser) GetGroupIDs() []int64

GetGroupIDs returns groups ids for user

func (AuthentifiedUser) GetUsername

func (u AuthentifiedUser) GetUsername() string

func (AuthentifiedUser) IsValid

func (u AuthentifiedUser) IsValid() error

IsValid returns an error if given user's infos are not valid.

func (*AuthentifiedUser) Scan

func (u *AuthentifiedUser) Scan(src interface{}) error

Scan workflow template request.

func (AuthentifiedUser) Value

func (u AuthentifiedUser) Value() (driver.Value, error)

Value returns driver.Value from workflow template request.

type AuthentifiedUsers

type AuthentifiedUsers []AuthentifiedUser

AuthentifiedUsers provides func for authentified user list.

func (AuthentifiedUsers) IDs

func (a AuthentifiedUsers) IDs() []string

func (AuthentifiedUsers) ToMapByID

func (a AuthentifiedUsers) ToMapByID() map[string]AuthentifiedUser

ToMapByID returns a map of authentified users indexed by ids.

type Author

type Author struct {
	Username string `json:"username" cli:"-"`
	Fullname string `json:"fullname" cli:"-"`
	Email    string `json:"email" cli:"-"`
}

Author struct contains info about model author.

func (*Author) Scan

func (a *Author) Scan(src interface{}) error

Scan author.

func (Author) Value

func (a Author) Value() (driver.Value, error)

Value returns driver.Value from author.

type BitbucketServerActor

type BitbucketServerActor struct {
	Name         string `json:"name"`
	EmailAddress string `json:"emailAddress"`
	ID           int    `json:"id"`
	DisplayName  string `json:"displayName"`
	Active       bool   `json:"active"`
	Slug         string `json:"slug"`
	Type         string `json:"type"`
}

type BitbucketServerAuthor

type BitbucketServerAuthor struct {
	User     BitbucketServerActor `json:"user"`
	Role     string               `json:"role"`
	Approved bool                 `json:"approved"`
	Status   string               `json:"status"`
}

type BitbucketServerChange

type BitbucketServerChange struct {
	Ref      BitbucketServerRef `json:"ref"`
	RefID    string             `json:"refId"`
	FromHash string             `json:"fromHash"`
	ToHash   string             `json:"toHash"`
	Type     string             `json:"type"`
}

type BitbucketServerComment

type BitbucketServerComment struct {
	Properties  BitbucketServerProperties `json:"properties"`
	ID          int64                     `json:"id"`
	Version     int64                     `json:"version"`
	Text        string                    `json:"text"`
	Author      BitbucketServerActor      `json:"author"`
	CreatedDate int64                     `json:"createdDate"`
	UpdatedDate int64                     `json:"updatedDate"`
	Comments    []string                  `json:"comments"`
	Tasks       []string                  `json:"tasks"`
}

type BitbucketServerParticipant

type BitbucketServerParticipant struct {
	User               BitbucketServerActor `json:"user"`
	LastReviewedCommit string               `json:"lastReviewedCommit"`
	Role               string               `json:"role"`
	Approved           bool                 `json:"approved"`
	Status             string               `json:"status"`
}

type BitbucketServerPreviousTarget

type BitbucketServerPreviousTarget struct {
	ID              string `json:"id"`
	DisplayID       string `json:"displayId"`
	Type            string `json:"type"`
	LatestCommit    string `json:"latestCommit"`
	LatestChangeset string `json:"latestChangeset"`
}

type BitbucketServerProject

type BitbucketServerProject struct {
	Key    string `json:"key"`
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Public bool   `json:"public"`
	Type   string `json:"type"`
}

type BitbucketServerProperties

type BitbucketServerProperties struct {
	RepositoryID int64 `json:"repositoryId"`
}

type BitbucketServerPullRequest

type BitbucketServerPullRequest struct {
	ID          int                    `json:"id"`
	Version     int                    `json:"version"`
	Title       string                 `json:"title"`
	Description string                 `json:"description"`
	State       string                 `json:"state"`
	Open        bool                   `json:"open"`
	Closed      bool                   `json:"closed"`
	CreatedDate int                    `json:"createdDate"`
	UpdatedDate int                    `json:"updatedDate"`
	FromRef     BitbucketServerRef     `json:"fromRef"`
	ToRef       BitbucketServerRef     `json:"toRef"`
	Locked      bool                   `json:"locked"`
	Author      *BitbucketServerAuthor `json:"author,omitempty"`
	Reviewers   []struct {
		User               BitbucketServerActor `json:"user"`
		LastReviewedCommit string               `json:"lastReviewedCommit"`
		Role               string               `json:"role"`
		Approved           bool                 `json:"approved"`
		Status             string               `json:"status"`
	} `json:"reviewers,omitempty"`
	Participants []BitbucketServerParticipant `json:"participants,omitempty"`
	Properties   PullRequestProperties        `json:"properties,omitempty"`
	Links        struct {
		Self []struct {
			Href string `json:"href"`
		} `json:"self"`
	} `json:"links"`
}

type BitbucketServerRef

type BitbucketServerRef struct {
	ID           string                    `json:"id"`
	DisplayID    string                    `json:"displayId"`
	LatestCommit string                    `json:"latestCommit"`
	Repository   BitbucketServerRepository `json:"repository"`
}

type BitbucketServerRepository

type BitbucketServerRepository struct {
	ID            int64                  `json:"id"`
	Slug          string                 `json:"slug"`
	Name          interface{}            `json:"name"`
	ScmID         string                 `json:"scmId"`
	State         string                 `json:"state"`
	StatusMessage string                 `json:"statusMessage"`
	Forkable      bool                   `json:"forkable"`
	Project       BitbucketServerProject `json:"project"`
	Public        bool                   `json:"public"`
}

type BitbucketServerWebhookEvent

type BitbucketServerWebhookEvent struct {
	EventKey string                `json:"eventKey"`
	Date     string                `json:"date"`
	Actor    *BitbucketServerActor `json:"actor"`

	// PR event data
	PullRequest         *BitbucketServerPullRequest    `json:"pullRequest"`
	PreviousTitle       string                         `json:"previousTitle"`
	PreviousDescription interface{}                    `json:"previousDescription"`
	PreviousTarget      *BitbucketServerPreviousTarget `json:"previousTarget"`

	// Review event data
	Participant    *BitbucketServerParticipant `json:"participant"`
	PreviousStatus string                      `json:"previousStatus"`

	// Reviewer edited data
	AddedReviewers   []BitbucketServerActor `json:"addedReviewers"`
	RemovedReviewers []BitbucketServerActor `json:"removedReviewers"`

	// PR Comment event data
	Comment         *BitbucketServerComment `json:"comment"`
	PreviousComment string                  `json:"previousComment"`

	// PushEvent data
	Repository *BitbucketServerRepository `json:"repository"`
	Changes    []BitbucketServerChange    `json:"changes"`
}

type BookedBy

type BookedBy struct {
	Name string `json:"name,omitempty"`
	ID   int64  `json:"id,omitempty"`
}

type Bookmark

type Bookmark struct {
	Icon        string `json:"icon" db:"icon"`
	Description string `json:"description" db:"description"`
	NavbarProjectData
}

Bookmark represents the type for a bookmark with his icon and description

type Broadcast

type Broadcast struct {
	ID         int64     `json:"id" db:"id" cli:"num,key"`
	Title      string    `json:"title" db:"title" cli:"title"`
	Content    string    `json:"content" db:"content" cli:"content"`
	Level      string    `json:"level" db:"level" cli:"level"`
	ProjectKey string    `json:"project_key,omitempty" db:"-" cli:"project"`
	Created    time.Time `json:"created" db:"created" cli:"created"`
	Updated    time.Time `json:"updated" db:"updated" cli:"-"`
	ProjectID  *int64    `json:"project_id,omitempty" db:"project_id" cli:"-"`
	Archived   bool      `json:"archived" db:"archived" cli:"archived"`
	Read       bool      `json:"read" db:"-" cli:"read"`
}

Broadcast represents a message (communication CDS admins -> users)

type BuildNumberAndHash

type BuildNumberAndHash struct {
	BuildNumber int64
	Hash        string
	Branch      string
	Tag         string
	Remote      string
	RemoteURL   string
}

BuildNumberAndHash represents BuildNumber, Commit Hash and Branch for a Pipeline Build or Node Run

type CDNApiRef

type CDNApiRef interface {
	ToHash() (string, error)
	ToFilename() string
}

func NewCDNApiRef

func NewCDNApiRef(t CDNItemType, signature cdn.Signature) (CDNApiRef, error)

func NewCDNLogApiRef

func NewCDNLogApiRef(signature cdn.Signature) CDNApiRef

func NewCDNRunResultApiRef

func NewCDNRunResultApiRef(signature cdn.Signature) CDNApiRef

func NewCDNWorkerCacheApiRef

func NewCDNWorkerCacheApiRef(signature cdn.Signature) CDNApiRef

type CDNConfig

type CDNConfig struct {
	TCPURL          string `json:"tcp_url"`
	TCPURLEnableTLS bool   `json:"tcp_url_enable_tls"`
	HTTPURL         string `json:"http_url"`
}

type CDNItem

type CDNItem struct {
	ID           string          `json:"id" db:"id"`
	Created      time.Time       `json:"created" db:"created"`
	LastModified time.Time       `json:"last_modified" db:"last_modified"`
	Hash         string          `json:"hash" db:"cipher_hash" gorpmapping:"encrypted,ID,APIRefHash,Type"`
	APIRefRaw    json.RawMessage `json:"api_ref" db:"-"`
	APIRef       CDNApiRef       `json:"-" db:"-"`
	APIRefHash   string          `json:"api_ref_hash" db:"api_ref_hash"`
	Status       string          `json:"status" db:"status"`
	Type         CDNItemType     `json:"type" db:"type"`
	Size         int64           `json:"size" db:"size"`
	MD5          string          `json:"md5" db:"md5"`
	ToDelete     bool            `json:"to_delete" db:"to_delete"`
}

func (CDNItem) GetCDNLogApiRef

func (c CDNItem) GetCDNLogApiRef() (*CDNLogAPIRef, bool)

func (CDNItem) GetCDNRunResultApiRef

func (c CDNItem) GetCDNRunResultApiRef() (*CDNRunResultAPIRef, bool)

func (CDNItem) GetCDNWorkerCacheApiRef

func (c CDNItem) GetCDNWorkerCacheApiRef() (*CDNWorkerCacheAPIRef, bool)

func (CDNItem) MarshalJSON

func (c CDNItem) MarshalJSON() ([]byte, error)

func (*CDNItem) UnmarshalJSON

func (c *CDNItem) UnmarshalJSON(data []byte) error
type CDNItemLinks struct {
	CDNHttpURL string    `json:"cdn_http_url"`
	Items      []CDNItem `json:"items"`
}

type CDNItemResume

type CDNItemResume struct {
	CDNItem  CDNItem                `json:"item"` // Here we can't use nested struct because of the custom CDNItem marshaller
	Location map[string]CDNItemUnit `json:"item_units"`
}

type CDNItemType

type CDNItemType string
const (
	CDNTypeItemStepLog     CDNItemType = "step-log"
	CDNTypeItemServiceLog  CDNItemType = "service-log"
	CDNTypeItemRunResult   CDNItemType = "run-result"
	CDNTypeItemWorkerCache CDNItemType = "worker-cache"
	CDNStatusItemIncoming              = "Incoming"
	CDNStatusItemCompleted             = "Completed"
)

func (CDNItemType) IsLog

func (t CDNItemType) IsLog() bool

func (CDNItemType) Validate

func (t CDNItemType) Validate() error

type CDNItemUnit

type CDNItemUnit struct {
	ID           string      `json:"id" db:"id"`
	Type         CDNItemType `json:"type" db:"type"`
	ItemID       string      `json:"item_id" db:"item_id"`
	UnitID       string      `json:"unit_id" db:"unit_id"`
	LastModified time.Time   `json:"last_modified" db:"last_modified"`
	Locator      string      `json:"locator" db:"cipher_locator" gorpmapping:"encrypted,UnitID,ItemID"`
	HashLocator  string      `json:"hash_locator" db:"hash_locator"`
	Item         *CDNItem    `json:"-" db:"-"`
	ToDelete     bool        `json:"to_delete" db:"to_delete"`
}

type CDNLogAPIRef

type CDNLogAPIRef struct {
	ProjectKey     string `json:"project_key"`
	WorkflowName   string `json:"workflow_name"`
	WorkflowID     int64  `json:"workflow_id"`
	RunID          int64  `json:"run_id"`
	NodeRunID      int64  `json:"node_run_id"`
	NodeRunName    string `json:"node_run_name"`
	NodeRunJobID   int64  `json:"node_run_job_id"`
	NodeRunJobName string `json:"node_run_job_name"`

	// for workers
	StepOrder int64  `json:"step_order"`
	StepName  string `json:"step_name,omitempty"`

	// for hatcheries
	RequirementServiceID   int64  `json:"service_id,omitempty"`
	RequirementServiceName string `json:"service_name,omitempty"`
}

func (*CDNLogAPIRef) Scan

func (a *CDNLogAPIRef) Scan(src interface{}) error

Scan CDNLogAPIRef.

func (*CDNLogAPIRef) ToFilename

func (a *CDNLogAPIRef) ToFilename() string

func (*CDNLogAPIRef) ToHash

func (a *CDNLogAPIRef) ToHash() (string, error)

func (CDNLogAPIRef) Value

func (a CDNLogAPIRef) Value() (driver.Value, error)

Value returns driver.Value from CDNLogAPIRef.

type CDNLogLink struct {
	CDNURL   string      `json:"cdn_url,omitempty"`
	ItemType CDNItemType `json:"item_type"`
	APIRef   string      `json:"api_ref"`
}

type CDNLogLinkData

type CDNLogLinkData struct {
	APIRef    string `json:"api_ref"`
	StepOrder int64  `json:"step_order"`
}
type CDNLogLinks struct {
	CDNURL   string           `json:"cdn_url,omitempty"`
	ItemType CDNItemType      `json:"item_type"`
	Data     []CDNLogLinkData `json:"datas"`
}

type CDNLogsLines

type CDNLogsLines struct {
	APIRef     string `json:"api_ref"`
	LinesCount int64  `json:"lines_count"`
}

type CDNMarkDelete

type CDNMarkDelete struct {
	RunID int64 `json:"run_id,omitempty"`
}

type CDNReaderFormat

type CDNReaderFormat string
const (
	CDNReaderFormatJSON CDNReaderFormat = "json"
	CDNReaderFormatText CDNReaderFormat = "text"
)

type CDNRunResultAPIRef

type CDNRunResultAPIRef struct {
	ProjectKey    string                `json:"project_key"`
	WorkflowName  string                `json:"workflow_name"`
	WorkflowID    int64                 `json:"workflow_id"`
	RunID         int64                 `json:"run_id"`
	RunJobID      int64                 `json:"run_job_id"`
	RunJobName    string                `json:"run_job_name"`
	RunNodeID     int64                 `json:"run_node_id"`
	ArtifactName  string                `json:"artifact_name"`
	Perm          uint32                `json:"perm"`
	RunResultType WorkflowRunResultType `json:"type"`
}

func (*CDNRunResultAPIRef) ToFilename

func (a *CDNRunResultAPIRef) ToFilename() string

func (*CDNRunResultAPIRef) ToHash

func (a *CDNRunResultAPIRef) ToHash() (string, error)

type CDNStreamFilter

type CDNStreamFilter struct {
	JobRunID int64 `json:"job_run_id"`
}

func (CDNStreamFilter) Validate

func (f CDNStreamFilter) Validate() error

type CDNUnit

type CDNUnit struct {
	ID      string        `json:"id" db:"id"`
	Created time.Time     `json:"created" db:"created"`
	Name    string        `json:"name" db:"name"`
	Config  ServiceConfig `json:"config" db:"config"`
}

type CDNUnitHandlerRequest

type CDNUnitHandlerRequest struct {
	ID      string `json:"id" cli:"id"`
	Name    string `json:"name" cli:"name"`
	NbItems int64  `json:"nb_items" cli:"nb_items"`
}

type CDNWSEvent

type CDNWSEvent struct {
	ItemType   CDNItemType `json:"item_type"`
	JobRunID   int64       `json:"job_run_id"`
	ItemUnitID string      `json:"new_item_unit_id"`
}

type CDNWorkerCacheAPIRef

type CDNWorkerCacheAPIRef struct {
	ProjectKey string    `json:"project_key"`
	CacheTag   string    `json:"cache_tag"`
	ExpireAt   time.Time `json:"expire_at"`
}

func (*CDNWorkerCacheAPIRef) ToFilename

func (a *CDNWorkerCacheAPIRef) ToFilename() string

func (*CDNWorkerCacheAPIRef) ToHash

func (a *CDNWorkerCacheAPIRef) ToHash() (string, error)

type Cache

type Cache struct {
	ID              int64  `json:"id" cli:"id"`
	Project         string `json:"project"`
	Name            string `json:"name" cli:"name"`
	Tag             string `json:"tag"`
	TmpURL          string `json:"tmp_url"`
	SecretKey       string `json:"secret_key"`
	IntegrationName string `json:"integration_name"`

	Files            []string `json:"files"`
	WorkingDirectory string   `json:"working_directory"`
}

Cache define a file needed to be save for cache

func (*Cache) GetName

func (c *Cache) GetName() string

GetName returns the name the artifact

func (*Cache) GetPath

func (c *Cache) GetPath() string

GetPath returns the path of the artifact

type CanonicalFormUsage

type CanonicalFormUsage struct {
	Signer string `json:"signer" db:"signer"`
	Number int64  `json:"number" db:"number"`
	Latest bool   `json:"latest"`
}

type CanonicalFormUsageResume

type CanonicalFormUsageResume map[string][]CanonicalFormUsage

type CanonicalService

type CanonicalService struct {
	ID         int64         `json:"id" db:"id"`
	Name       string        `json:"name" db:"name" cli:"name,key"`
	ConsumerID *string       `json:"-" db:"auth_consumer_id"`
	Type       string        `json:"type" db:"type" cli:"type"`
	HTTPURL    string        `json:"http_url" db:"http_url" cli:"url"`
	Config     ServiceConfig `json:"config" db:"config" cli:"-"`
	PublicKey  []byte        `json:"public_key" db:"public_key"`
}

type CheckFunc

type CheckFunc func(string) bool

CheckFunc is a function to check key of a map for map merge

type ConfigUser

type ConfigUser struct {
	URLUI  string `json:"url.ui"`
	URLAPI string `json:"url.api"`
}

ConfigUser struct.

type DatabaseMigrationStatus

type DatabaseMigrationStatus struct {
	ID        string     `json:"id" db:"id" cli:"id,key"`
	Migrated  bool       `json:"migrated" db:"-" cli:"migrated"`
	AppliedAt *time.Time `json:"applied_at" db:"applied_at" cli:"applied_at"`
	// aggregates
	Database string `json:"database" db:"-" cli:"database"`
}

DatabaseMigrationStatus represents on migration script status

type DefaultValues

type DefaultValues struct {
	DefaultGroupName string
}

DefaultValues contains default user values for init DB

type DownloadableResource

type DownloadableResource struct {
	Name      string `json:"name"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	Variant   string `json:"variant,omitempty"`
	Filename  string `json:"filename,omitempty"`
	Available *bool  `json:"available,omitempty"`
}

func AllDownloadableResources

func AllDownloadableResources() []DownloadableResource

func AllDownloadableResourcesWithAvailability

func AllDownloadableResourcesWithAvailability(directoriesDownload string) []DownloadableResource

AllDownloadableResourcesWithAvailability set flag Available on downloads list

type EncryptFunc

type EncryptFunc func(context.Context, gorp.SqlExecutor, int64, string, string) (string, error)

EncryptFunc is a common type

type EntitiesPermissions

type EntitiesPermissions map[string]Permissions

func (EntitiesPermissions) Level

func (e EntitiesPermissions) Level(s string) int

func (EntitiesPermissions) Permissions

func (e EntitiesPermissions) Permissions(s string) Permissions

type Environment

type Environment struct {
	ID                   int64                 `json:"id" yaml:"-" db:"id"`
	Name                 string                `json:"name" yaml:"name" cli:"name,key" db:"name"`
	Variables            []EnvironmentVariable `json:"variables,omitempty" yaml:"variables"`
	ProjectID            int64                 `json:"-" yaml:"-" db:"project_id"`
	ProjectKey           string                `json:"project_key" yaml:"-"`
	Created              time.Time             `json:"created" db:"created"`
	LastModified         time.Time             `json:"last_modified" db:"last_modified"`
	Keys                 []EnvironmentKey      `json:"keys"`
	Usage                *Usage                `json:"usage,omitempty"`
	FromRepository       string                `json:"from_repository,omitempty" db:"from_repository"`
	WorkflowAscodeHolder *Workflow             `json:"workflow_ascode_holder,omitempty" cli:"-"`
}

Environment represent a deployment environment

func NewEnvironment

func NewEnvironment(name string) *Environment

NewEnvironment instantiate a new Environment

func (Environment) GetKey

func (e Environment) GetKey(kname string) *EnvironmentKey

GetKey return a key by name

func (Environment) GetSSHKey

func (e Environment) GetSSHKey(kname string) *EnvironmentKey

GetSSHKey return a key by name

func (Environment) PGPKeys

func (e Environment) PGPKeys() []EnvironmentKey

PGPKeys returns the slice of pgp key for an environment

func (Environment) SSHKeys

func (e Environment) SSHKeys() []EnvironmentKey

SSHKeys returns the slice of ssh key for an environment

func (*Environment) UnmarshalJSON

func (e *Environment) UnmarshalJSON(data []byte) error

UnmarshalJSON custom for last modified.

type EnvironmentKey

type EnvironmentKey struct {
	ID            int64   `json:"id" db:"id" cli:"-"`
	Name          string  `json:"name" db:"name" cli:"name"`
	Public        string  `json:"public" db:"public" cli:"publickey"`
	Private       string  `json:"private" db:"private" cli:"-" gorpmapping:"encrypted,ID,Name"`
	KeyID         string  `json:"key_id" db:"key_id" cli:"-"`
	Type          KeyType `json:"type" db:"type" cli:"type"`
	EnvironmentID int64   `json:"environment_id" db:"environment_id"`
}

EnvironmentKey represent a key attach to an environment

type EnvironmentTemplate

type EnvironmentTemplate struct {
	Value string `json:"value"`
}

EnvironmentTemplate struct.

func (*EnvironmentTemplate) IsValid

func (e *EnvironmentTemplate) IsValid() error

IsValid returns environment template validity.

type EnvironmentTemplates

type EnvironmentTemplates []EnvironmentTemplate

EnvironmentTemplates struct.

func (*EnvironmentTemplates) Scan

func (e *EnvironmentTemplates) Scan(src interface{}) error

Scan environment templates.

func (EnvironmentTemplates) Value

func (e EnvironmentTemplates) Value() (driver.Value, error)

Value returns driver.Value from workflow template applications.

type EnvironmentVariable

type EnvironmentVariable struct {
	ID            int64  `json:"id,omitempty" cli:"-"`
	Name          string `json:"name" cli:"name,key"`
	Value         string `json:"value" cli:"value"`
	Type          string `json:"type" cli:"type"`
	EnvironmentID int64  `json:"environment_id" cli:"-"`
}

type EnvironmentVariableAudit

type EnvironmentVariableAudit struct {
	ID             int64                `json:"id" yaml:"-" db:"id"`
	EnvironmentID  int64                `json:"environment_id" yaml:"-" db:"environment_id"`
	VariableID     int64                `json:"variable_id" yaml:"-" db:"variable_id"`
	Type           string               `json:"type" yaml:"-" db:"type"`
	VariableBefore *EnvironmentVariable `json:"variable_before,omitempty" yaml:"-" db:"-"`
	VariableAfter  EnvironmentVariable  `json:"variable_after,omitempty" yaml:"-" db:"-"`
	Versionned     time.Time            `json:"versionned" yaml:"-" db:"versionned"`
	Author         string               `json:"author" yaml:"-" db:"author"`
}

EnvironmentVariableAudit represents an audit on an environment variable

type Error

type Error struct {
	ID         int         `json:"id"`
	Status     int         `json:"-"`
	Message    string      `json:"message"`
	Data       interface{} `json:"data,omitempty"`
	RequestID  string      `json:"request_id,omitempty"`
	StackTrace string      `json:"stack_trace,omitempty"`
	From       string      `json:"from,omitempty"`
}

Error type.

func ExtractHTTPError

func ExtractHTTPError(source error) Error

ExtractHTTPError tries to recognize given error and return http error with message in a language matching Accepted-Language.

func (Error) Error

func (e Error) Error() string

func (Error) Translate

func (e Error) Translate() string

type Event

type Event struct {
	Timestamp           time.Time        `json:"timestamp"`
	Hostname            string           `json:"hostname"`
	CDSName             string           `json:"cdsname"`
	EventType           string           `json:"type_event"` // go type of payload
	Payload             json.RawMessage  `json:"payload"`
	Attempts            int              `json:"attempt"`
	Username            string           `json:"username,omitempty"`
	UserMail            string           `json:"user_mail,omitempty"`
	ProjectKey          string           `json:"project_key,omitempty"`
	ApplicationName     string           `json:"application_name,omitempty"`
	PipelineName        string           `json:"pipeline_name,omitempty"`
	EnvironmentName     string           `json:"environment_name,omitempty"`
	WorkflowName        string           `json:"workflow_name,omitempty"`
	WorkflowRunNum      int64            `json:"workflow_run_num,omitempty"`
	WorkflowRunNumSub   int64            `json:"workflow_run_num_sub,omitempty"`
	WorkflowNodeRunID   int64            `json:"workflow_node_run_id,omitempty"`
	OperationUUID       string           `json:"operation_uuid,omitempty"`
	Status              string           `json:"status,omitempty"`
	Tags                []WorkflowRunTag `json:"tag,omitempty"`
	EventIntegrationsID []int64          `json:"event_integrations_id"`
}

Event represents a event from API Event is "create", "update", "delete" Status is "Waiting" "Building" "Success" "Fail" "Unknown", optional DateEvent is a date (timestamp format)

type EventActionAdd

type EventActionAdd struct {
	Action Action
}

EventActionAdd represents the event when adding an action.

type EventActionUpdate

type EventActionUpdate struct {
	OldAction Action
	NewAction Action
}

EventActionUpdate represents the event when updating an action.

type EventApplicationAdd

type EventApplicationAdd struct {
	Application
}

EventApplicationAdd represents the event when adding an application

type EventApplicationDelete

type EventApplicationDelete struct {
}

EventApplicationDelete represents the event when deleting an application

type EventApplicationKeyAdd

type EventApplicationKeyAdd struct {
	Key ApplicationKey `json:"key"`
}

EventApplicationKeyAdd represents the event when adding an application key

type EventApplicationKeyDelete

type EventApplicationKeyDelete struct {
	Key ApplicationKey `json:"key"`
}

EventApplicationKeyDelete represents the event when deleting an application key

type EventApplicationPermissionAdd

type EventApplicationPermissionAdd struct {
	Permission GroupPermission `json:"group_permission"`
}

EventApplicationPermissionAdd represents the event when adding an application permission

type EventApplicationPermissionDelete

type EventApplicationPermissionDelete struct {
	Permission GroupPermission `json:"group_permission"`
}

EventApplicationPermissionDelete represents the event when deleting an application permission

type EventApplicationPermissionUpdate

type EventApplicationPermissionUpdate struct {
	OldPermission GroupPermission `json:"old_group_permission"`
	NewPermission GroupPermission `json:"new_group_permission"`
}

EventApplicationPermissionUpdate represents the event when updating an application permission

type EventApplicationRepositoryAdd

type EventApplicationRepositoryAdd struct {
	VCSServer  string `json:"vcs_server"`
	Repository string `json:"repository"`
}

EventApplicationRepositoryAdd represents the event when adding a repository to an application

type EventApplicationRepositoryDelete

type EventApplicationRepositoryDelete struct {
	VCSServer  string `json:"vcs_server"`
	Repository string `json:"repository"`
}

EventApplicationRepositoryDelete represents the event when deleting a repository to an application

type EventApplicationUpdate

type EventApplicationUpdate struct {
	OldName               string             `json:"old_name"`
	NewName               string             `json:"new_name"`
	OldMetadata           Metadata           `json:"old_metadata"`
	NewMetadata           Metadata           `json:"new_metadata"`
	OldRepositoryStrategy RepositoryStrategy `json:"old_vcs_strategy"`
	NewRepositoryStrategy RepositoryStrategy `json:"new_vcs_strategy"`
}

EventApplicationUpdate represents the event when updating an application

type EventApplicationVariableAdd

type EventApplicationVariableAdd struct {
	Variable ApplicationVariable `json:"variable"`
}

EventApplicationVariableAdd represents the event when adding an application variable

type EventApplicationVariableDelete

type EventApplicationVariableDelete struct {
	Variable ApplicationVariable `json:"variable"`
}

EventApplicationVariableDelete represents the event when deleting an application variable

type EventApplicationVariableUpdate

type EventApplicationVariableUpdate struct {
	OldVariable ApplicationVariable `json:"old_variable"`
	NewVariable ApplicationVariable `json:"new_variable"`
}

EventApplicationVariableUpdate represents the event when updating an application variable

type EventApplicationVulnerabilityUpdate

type EventApplicationVulnerabilityUpdate struct {
	OldVulnerability Vulnerability `json:"old_vulnerability"`
	NewVulnerability Vulnerability `json:"new_vulnerability"`
}

EventApplicationVulnerabilityUpdate represents the event when updating a vulnerability

type EventAsCodeEvent

type EventAsCodeEvent struct {
	Event AsCodeEvent `json:"as_code_event"`
}

EventAsCodeEvent represents the event when add/update a workflow event

type EventBroadcastAdd

type EventBroadcastAdd struct {
	Broadcast
}

EventBroadcastAdd represents the event when adding a broadcast

type EventBroadcastDelete

type EventBroadcastDelete struct {
	BroadcastID int64
}

EventBroadcastDelete represents the event when deleting a broadcast

type EventBroadcastUpdate

type EventBroadcastUpdate struct {
	OldBroadcast Broadcast
	NewBroadcast Broadcast
}

EventBroadcastUpdate represents the event when updating a broadcast

type EventEngine

type EventEngine struct {
	Message string `json:"message"`
}

EventEngine contains event data for engine

type EventEnvironmentAdd

type EventEnvironmentAdd struct {
	Environment
}

EventEnvironmentAdd represents the event when adding an environment

type EventEnvironmentDelete

type EventEnvironmentDelete struct {
}

EventEnvironmentDelete represents the event when deleting an environment

type EventEnvironmentKeyAdd

type EventEnvironmentKeyAdd struct {
	Key EnvironmentKey `json:"key"`
}

EventEnvironmentKeyAdd represents the event when adding an environment key

type EventEnvironmentKeyDelete

type EventEnvironmentKeyDelete struct {
	Key EnvironmentKey `json:"key"`
}

EventEnvironmentKeyDelete represents the event when deleting an environment key

type EventEnvironmentPermissionAdd

type EventEnvironmentPermissionAdd struct {
	Permission GroupPermission `json:"group_permission"`
}

EventEnvironmentPermissionAdd represents the event when adding an environment permission

type EventEnvironmentPermissionDelete

type EventEnvironmentPermissionDelete struct {
	Permission GroupPermission `json:"group_permission"`
}

EventEnvironmentPermissionDelete represents the event when deleting an environment permission

type EventEnvironmentPermissionUpdate

type EventEnvironmentPermissionUpdate struct {
	OldPermission GroupPermission `json:"old_group_permission"`
	NewPermission GroupPermission `json:"new_group_permission"`
}

EventEnvironmentPermissionUpdate represents the event when updating an environment permission

type EventEnvironmentUpdate

type EventEnvironmentUpdate struct {
	OldName string `json:"old_name"`
	NewName string `json:"new_name"`
}

EventEnvironmentUpdate represents the event when updating an environment

type EventEnvironmentVariableAdd

type EventEnvironmentVariableAdd struct {
	Variable EnvironmentVariable `json:"variable"`
}

EventEnvironmentVariableAdd represents the event when adding an environment variable

type EventEnvironmentVariableDelete

type EventEnvironmentVariableDelete struct {
	Variable EnvironmentVariable `json:"variable"`
}

EventEnvironmentVariableDelete represents the event when deleting an environment variable

type EventEnvironmentVariableUpdate

type EventEnvironmentVariableUpdate struct {
	OldVariable EnvironmentVariable `json:"old_variable"`
	NewVariable EnvironmentVariable `json:"new_variable"`
}

EventEnvironmentVariableUpdate represents the event when updating an environment variable

type EventFake

type EventFake struct {
	Data int64 `json:"data"`
}

EventFake is used for test purpose

type EventFilter

type EventFilter struct {
	CurrentItem int            `json:"current_item"`
	Filter      TimelineFilter `json:"filter"`
}

EventFilter represents filters when getting events

type EventMaintenance

type EventMaintenance struct {
	Enable bool `json:"enable"`
}

EventMaintenance contains event data for maintenance event

type EventNotif

type EventNotif struct {
	Recipients []string `json:"recipients"`
	Subject    string   `json:"subject,omitempty"`
	Body       string   `json:"body,omitempty"`
}

EventNotif contains event data for a job

type EventOperation

type EventOperation struct {
	Operation
}

type EventPipelineAdd

type EventPipelineAdd struct {
	Pipeline
}

EventPipelineAdd represents the event when adding a pipeline

type EventPipelineDelete

type EventPipelineDelete struct {
}

EventPipelineDelete represents the event when deleting a pipeline

type EventPipelineJobAdd

type EventPipelineJobAdd struct {
	StageID         int64  `json:"stage_id"`
	StageName       string `json:"stage_name"`
	StageBuildOrder int    `json:"stage_build_order"`
	Job             Job    `json:"job"`
}

EventPipelineJobAdd represents the event when adding a job

type EventPipelineJobDelete

type EventPipelineJobDelete struct {
	StageID         int64  `json:"stage_id"`
	StageName       string `json:"stage_name"`
	StageBuildOrder int    `json:"stage_build_order"`
	JobName         string `json:"job_name"`
}

EventPipelineJobDelete represents the event when deleting a job

type EventPipelineJobUpdate

type EventPipelineJobUpdate struct {
	StageID         int64  `json:"stage_id"`
	StageName       string `json:"stage_name"`
	StageBuildOrder int    `json:"stage_build_order"`
	OldJob          Job    `json:"old_job"`
	NewJob          Job    `json:"new_job"`
}

EventPipelineJobUpdate represents the event when updating a job

type EventPipelineParameterAdd

type EventPipelineParameterAdd struct {
	Parameter Parameter `json:"parameter"`
}

EventPipelineParameterAdd represents the event when adding a pipeline parameter

type EventPipelineParameterDelete

type EventPipelineParameterDelete struct {
	Parameter Parameter `json:"parameter"`
}

EventPipelineParameterDelete represents the event when deleting a pipeline parameter

type EventPipelineParameterUpdate

type EventPipelineParameterUpdate struct {
	OldParameter Parameter `json:"old_parameter"`
	NewParameter Parameter `json:"new_parameter"`
}

EventPipelineParameterUpdate represents the event when updating a pipeline parameter

type EventPipelinePermissionAdd

type EventPipelinePermissionAdd struct {
	Permission GroupPermission `json:"group_permission"`
}

EventPipelinePermissionAdd represents the event when adding a pipeline permission

type EventPipelinePermissionDelete

type EventPipelinePermissionDelete struct {
	Permission GroupPermission `json:"group_permission"`
}

EventPipelinePermissionDelete represents the event when deleting a pipeline permission

type EventPipelinePermissionUpdate

type EventPipelinePermissionUpdate struct {
	OldPermission GroupPermission `json:"old_group_permission"`
	NewPermission GroupPermission `json:"new_group_permission"`
}

EventPipelinePermissionUpdate represents the event when updating a pipeline permission

type EventPipelineStageAdd

type EventPipelineStageAdd struct {
	Name         string         `json:"name"`
	BuildOrder   int            `json:"build_order"`
	Enabled      bool           `json:"enabled"`
	Prerequisite []Prerequisite `json:"prerequisite"`
}

EventPipelineStageAdd represents the event when adding a stage

type EventPipelineStageDelete

type EventPipelineStageDelete struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	BuildOrder int    `json:"build_order"`
}

EventPipelineStageDelete represents the event when deleting a stage

type EventPipelineStageMove

type EventPipelineStageMove struct {
	StageName          string `json:"stage_name"`
	StageID            int64  `json:"stage_id"`
	OldStageBuildOrder int    `json:"old_build_order"`
	NewStageBuildOrder int    `json:"new_build_order"`
}

EventPipelineStageMove represent the event when moving a stage

type EventPipelineStageUpdate

type EventPipelineStageUpdate struct {
	NewName         string         `json:"name"`
	NewBuildOrder   int            `json:"build_order"`
	NewPrerequisite []Prerequisite `json:"prerequisite"`
	OldName         string         `json:"old_name"`
	OldBuildOrder   int            `json:"old_build_order"`
	OldPrerequisite []Prerequisite `json:"old_prerequisite"`
	NewEnabled      bool           `json:"enabled"`
	OldEnabled      bool           `json:"old_enabled"`
}

EventPipelineStageUpdate represents the event when updating a stage

type EventPipelineUpdate

type EventPipelineUpdate struct {
	OldName string `json:"old_name"`
	NewName string `json:"new_name"`
}

EventPipelineUpdate represents the event when updating a pipeline

type EventProjectAdd

type EventProjectAdd struct {
	Variables   []ProjectVariable `json:"variables"`
	Permissions []GroupPermission `json:"groups_permission"`
	Keys        []ProjectKey      `json:"keys"`
	Metadata    Metadata          `json:"metadata"`
}

EventProjectAdd represents the event when adding a project

type EventProjectDelete

type EventProjectDelete struct {
}

EventProjectDelete represents the event when deleting a project

type EventProjectIntegrationAdd

type EventProjectIntegrationAdd struct {
	Integration ProjectIntegration `json:"integration"`
}

EventProjectIntegrationAdd represents the event when adding a project integration

type EventProjectIntegrationDelete

type EventProjectIntegrationDelete struct {
	Integration ProjectIntegration `json:"integration"`
}

EventProjectIntegrationDelete represents the event when deleting a project integration

type EventProjectIntegrationUpdate

type EventProjectIntegrationUpdate struct {
	OldIntegration  ProjectIntegration `json:"old_integration"`
	NewsIntegration ProjectIntegration `json:"new_integration"`
}

EventProjectIntegrationUpdate represents the event when updating a project integration

type EventProjectKeyAdd

type EventProjectKeyAdd struct {
	Key ProjectKey `json:"key"`
}

EventProjectKeyAdd represents the event when adding a project key

type EventProjectKeyDelete

type EventProjectKeyDelete struct {
	Key ProjectKey `json:"key"`
}

EventProjectKeyDelete represents the event when deleting a project key

type EventProjectPermissionAdd

type EventProjectPermissionAdd struct {
	Permission GroupPermission `json:"group_permission"`
}

EventProjectPermissionAdd represents the event when adding a project permission

type EventProjectPermissionDelete

type EventProjectPermissionDelete struct {
	Permission GroupPermission `json:"group_permission"`
}

EventProjectPermissionDelete represents the event when deleting a project permission

type EventProjectPermissionUpdate

type EventProjectPermissionUpdate struct {
	OldPermission GroupPermission `json:"old_group_permission"`
	NewPermission GroupPermission `json:"new_group_permission"`
}

EventProjectPermissionUpdate represents the event when updating a project permission

type EventProjectUpdate

type EventProjectUpdate struct {
	OldName     string   `json:"old_name"`
	NewName     string   `json:"new_name"`
	OldMetadata Metadata `json:"old_metadata"`
	NewMetadata Metadata `json:"new_metadata"`
}

EventProjectUpdate represents the event when updating a project

type EventProjectVCSServerAdd

type EventProjectVCSServerAdd struct {
	VCSServerName string `json:"vcs_server"`
}

EventProjectVCSServerAdd represents the event when adding a project vcs server

type EventProjectVCSServerDelete

type EventProjectVCSServerDelete struct {
	VCSServerName string `json:"vcs_server"`
}

EventProjectVCSServerDelete represents the event when deleting a project vcs server

type EventProjectVariableAdd

type EventProjectVariableAdd struct {
	Variable ProjectVariable `json:"variable"`
}

EventProjectVariableAdd represents the event when adding a project variable

type EventProjectVariableDelete

type EventProjectVariableDelete struct {
	Variable ProjectVariable `json:"variable"`
}

EventProjectVariableDelete represents the event when deleting a project variable

type EventProjectVariableUpdate

type EventProjectVariableUpdate struct {
	OldVariable ProjectVariable `json:"old_variable"`
	NewVariable ProjectVariable `json:"new_variable"`
}

EventProjectVariableUpdate represents the event when updating a project variable

type EventRetentionWorkflowDryRun

type EventRetentionWorkflowDryRun struct {
	Runs         []WorkflowRunToKeep `json:"runs"`
	Status       string              `json:"status"`
	Error        string              `json:"error"`
	RunsAnalyzed int64               `json:"nb_runs_analyzed"`
}

EventRetentionWorkflowDryRun represents the vent when execution dry run on workflow retention

type EventRunWorkflow

type EventRunWorkflow struct {
	ID               int64            `json:"id"`
	Number           int64            `json:"num"`
	Status           string           `json:"status"`
	Start            int64            `json:"start"`
	LastExecution    int64            `json:"last_execution"`
	LastModified     int64            `json:"last_modified"`
	LastModifiedNano int64            `json:"last_modified_nano"`
	Tags             []WorkflowRunTag `json:"tags"`
	ToDelete         bool             `json:"to_delete"`
}

EventRunWorkflow contains event data for a workflow run

type EventRunWorkflowJob

type EventRunWorkflowJob struct {
	ID     int64  `json:"id,omitempty"`
	Status string `json:"status,omitempty"`
	Start  int64  `json:"start,omitempty"`
	Done   int64  `json:"done,omitempty"`
}

EventRunWorkflowJob contains event data for a workflow job node run

type EventRunWorkflowNode

type EventRunWorkflowNode struct {
	ID                    int64                     `json:"id,omitempty"`
	NodeID                int64                     `json:"node_id,omitempty"`
	RunID                 int64                     `json:"run_id,omitempty"`
	Number                int64                     `json:"num,omitempty"`
	SubNumber             int64                     `json:"subnum,omitempty"`
	Status                string                    `json:"status,omitempty"`
	Start                 int64                     `json:"start,omitempty"`
	Done                  int64                     `json:"done,omitempty"`
	Payload               interface{}               `json:"payload,omitempty"`
	HookEvent             *WorkflowNodeRunHookEvent `json:"hook_event"`
	Manual                *WorkflowNodeRunManual    `json:"manual"`
	SourceNodeRuns        []int64                   `json:"source_node_runs"`
	WorkflowRunID         int64                     `json:"workflow_run_id"`
	RepositoryManagerName string                    `json:"repository_manager_name"`
	RepositoryFullName    string                    `json:"repository_full_name"`
	Hash                  string                    `json:"hash"`
	Tag                   string                    `json:"tag"`
	BranchName            string                    `json:"branch_name"`
	NodeName              string                    `json:"node_name"`
	StagesSummary         []StageSummary            `json:"stages_summary"`
	HookUUID              string                    `json:"hook_uuid"`
	HookLog               string                    `json:"log,omitempty"`
	NodeType              string                    `json:"node_type,omitempty"`
	GerritChange          *GerritChangeEvent        `json:"gerrit_change,omitempty"`
	EventIntegrations     []int64                   `json:"event_integrations_id,omitempty"`
}

EventRunWorkflowNode contains event data for a workflow node run

type EventRunWorkflowOutgoingHook

type EventRunWorkflowOutgoingHook struct {
	HookID            int64  `json:"hook_id"`
	ID                string `json:"id"`
	Status            string `json:"status,omitempty"`
	Start             int64  `json:"start,omitempty"`
	Done              int64  `json:"done,omitempty"`
	Log               string `json:"log,omitempty"`
	WorkflowRunID     int64  `json:"workflow_run_id"`
	WorkflowRunNumber *int64 `json:"workflow_run_number,omitempty"`
}

EventRunWorkflowOutgoingHook contains event data for a workflow outgoing hook run

type EventSubscription

type EventSubscription struct {
	UUID         string `json:"uuid"`
	ProjectKey   string `json:"key"`
	WorkflowName string `json:"workflow_name"`
	WorkflowNum  int64  `json:"num"`
	WorkflowRuns bool   `json:"runs"`
	Overwrite    bool   `json:"overwrite"`
}

EventSubscription data send to api to subscribe to an event

type EventWarningAdd

type EventWarningAdd struct {
	Warning
}

EventWarningAdd represents the event when adding a warning

type EventWarningDelete

type EventWarningDelete struct {
	Type    string
	Element string
}

EventWarningDelete represents the event when deleting a warning

type EventWarningUpdate

type EventWarningUpdate struct {
	Warning
}

EventWarningUpdate represents the event when updating a warning

type EventWorkflowAdd

type EventWorkflowAdd struct {
	Workflow Workflow `json:"workflow"`
}

EventWorkflowAdd represents the event when adding a workflow

type EventWorkflowDelete

type EventWorkflowDelete struct {
	Workflow Workflow `json:"workflow"`
}

EventWorkflowDelete represents the event when deleting a workflow

type EventWorkflowPermissionAdd

type EventWorkflowPermissionAdd struct {
	WorkflowID int64           `json:"workflow_id"`
	Permission GroupPermission `json:"group_permission"`
}

EventWorkflowPermissionAdd represents the event when adding a workflow permission

type EventWorkflowPermissionDelete

type EventWorkflowPermissionDelete struct {
	WorkflowID int64           `json:"workflow_id"`
	Permission GroupPermission `json:"group_permission"`
}

EventWorkflowPermissionDelete represents the event when deleting a workflow permission

type EventWorkflowPermissionUpdate

type EventWorkflowPermissionUpdate struct {
	WorkflowID    int64           `json:"workflow_id"`
	OldPermission GroupPermission `json:"old_group_permission"`
	NewPermission GroupPermission `json:"new_group_permission"`
}

EventWorkflowPermissionUpdate represents the event when updating a workflow permission

type EventWorkflowTemplateAdd

type EventWorkflowTemplateAdd struct {
	WorkflowTemplate WorkflowTemplate `json:"workflow_template"`
}

EventWorkflowTemplateAdd represents the event when adding a workflow template.

type EventWorkflowTemplateInstanceAdd

type EventWorkflowTemplateInstanceAdd struct {
	WorkflowTemplateInstance WorkflowTemplateInstance `json:"workflow_template_instance"`
}

EventWorkflowTemplateInstanceAdd represents the event when adding a workflow template instance.

type EventWorkflowTemplateInstanceUpdate

type EventWorkflowTemplateInstanceUpdate struct {
	OldWorkflowTemplateInstance WorkflowTemplateInstance `json:"old_workflow_template_instance"`
	NewWorkflowTemplateInstance WorkflowTemplateInstance `json:"new_workflow_template_instance"`
}

EventWorkflowTemplateInstanceUpdate represents the event when updating a workflow template instance.

type EventWorkflowTemplateUpdate

type EventWorkflowTemplateUpdate struct {
	OldWorkflowTemplate WorkflowTemplate `json:"old_workflow_template"`
	NewWorkflowTemplate WorkflowTemplate `json:"new_workflow_template"`
	ChangeMessage       string           `json:"change_message"`
}

EventWorkflowTemplateUpdate represents the event when updating a workflow template.

type EventWorkflowUpdate

type EventWorkflowUpdate struct {
	NewWorkflow Workflow `json:"new_workflow"`
	OldWorkflow Workflow `json:"old_workflow"`
}

EventWorkflowUpdate represents the event when updating a workflow

type ExecutedJob

type ExecutedJob struct {
	Job
	StepStatus []StepStatus `json:"step_status" db:"-"`
	Reason     string       `json:"reason" db:"-"`
	WorkerName string       `json:"worker_name" db:"-"`
	WorkerID   string       `json:"worker_id" db:"-"`
}

ExecutedJob represents a running job

func (ExecutedJob) ToSummary

func (j ExecutedJob) ToSummary() ExecutedJobSummary

ToSummary transforms an ExecutedJob to an ExecutedJobSummary

type ExecutedJobSummary

type ExecutedJobSummary struct {
	StepStatusSummary []StepStatusSummary `json:"step_status"`
	Reason            string              `json:"reason"`
	WorkerName        string              `json:"worker_name"`
	WorkerID          string              `json:"worker_id"`
	JobName           string              `json:"job_name"`
	PipelineActionID  int64               `json:"pipeline_action_id"`
	PipelineStageID   int64               `json:"pipeline_stage_id"`
	Steps             []ActionSummary     `json:"steps"`
}

ExecutedJobSummary is a light representation of ExecutedJob for CDS event

type Expiration

type Expiration int

Expiration defines how worker key should expire

type Favorite

type Favorite struct {
	ProjectIDs  []int64 `json:"project_ids" yaml:"project_ids"`
	WorkflowIDs []int64 `json:"workflow_ids" yaml:"workflow_ids"`
}

Favorite represent the favorites workflow or project of the user

type FavoriteParams

type FavoriteParams struct {
	Type         string `json:"type"`
	ProjectKey   string `json:"project_key"`
	WorkflowName string `json:"workflow_name,omitempty"`
}

FavoriteParams represents a project or workflow user's bookmark

type Feature

type Feature struct {
	ID   int64       `json:"id" db:"id" cli:"-" yaml:"-"`
	Name FeatureName `json:"name" db:"name" cli:"name" yaml:"name"`
	Rule string      `json:"rule" db:"rule" cli:"-" yaml:"rule"`
}

type FeatureEnabledResponse

type FeatureEnabledResponse struct {
	Name    FeatureName `json:"name"`
	Enabled bool        `json:"enabled"`
	Exists  bool        `json:"exists"`
}

type FeatureName

type FeatureName string
const (
	FeatureCDNArtifact  FeatureName = "cdn-artifact"
	FeatureCDNJobLogs   FeatureName = "cdn-job-logs"
	FeatureMFARequired  FeatureName = "mfa_required"
	FeaturePurgeName    FeatureName = "workflow-retention-policy"
	FeaturePurgeMaxRuns FeatureName = "workflow-retention-maxruns"
	FeatureTracing      FeatureName = "tracing"
	FeatureWorkflowV3   FeatureName = "workflow-v3"
	FeatureRegion       FeatureName = "region"
)

type FileInfo

type FileInfo struct {
	Size int64
	Md5  string
	Type string
}

type GRPCPlugin

type GRPCPlugin struct {
	ID                 int64              `json:"id" yaml:"id" cli:"id" db:"id"`
	Name               string             `json:"name" yaml:"name" cli:"name,key" db:"name"`
	Type               string             `json:"type" yaml:"type" cli:"type" db:"type"`
	Author             string             `json:"author" yaml:"author" cli:"author" db:"author"`
	Description        string             `json:"description" yaml:"description" cli:"description" db:"description"`
	Parameters         []Parameter        `json:"parameters,omitempty" yaml:"parameters,omitempty" cli:"parameters" db:"-"`
	Binaries           GRPCPluginBinaries `json:"binaries" yaml:"binaries" cli:"-" db:"binaries"`
	IntegrationModelID *int64             `json:"-" db:"integration_model_id" yaml:"-" cli:"-"`
	Integration        string             `json:"integration" db:"-" yaml:"integration" cli:"integration"`
}

GRPCPlugin is the type representing a plugin over GRPC

func (GRPCPlugin) GetBinary

func (p GRPCPlugin) GetBinary(os, arch string) *GRPCPluginBinary

GetBinary returns the binary for a specific os and arch

func (*GRPCPlugin) Validate

func (p *GRPCPlugin) Validate() error

type GRPCPluginBinaries

type GRPCPluginBinaries []GRPCPluginBinary

func (*GRPCPluginBinaries) Scan

func (b *GRPCPluginBinaries) Scan(src interface{}) error

Scan plugin binaries.

func (GRPCPluginBinaries) Value

func (b GRPCPluginBinaries) Value() (driver.Value, error)

Value returns driver.Value from plugin binary slice.

type GRPCPluginBinary

type GRPCPluginBinary struct {
	OS               string          `json:"os,omitempty" yaml:"os"`
	Arch             string          `json:"arch,omitempty" yaml:"arch"`
	Name             string          `json:"name,omitempty" yaml:"-"`
	ObjectPath       string          `json:"object_path,omitempty" yaml:"-"`
	Size             int64           `json:"size,omitempty" yaml:"-"`
	Perm             uint32          `json:"perm,omitempty" yaml:"-"`
	MD5sum           string          `json:"md5sum,omitempty" yaml:"-"`
	SHA512sum        string          `json:"sha512sum,omitempty" yaml:"-"`
	TempURL          string          `json:"temp_url,omitempty" yaml:"-"`
	TempURLSecretKey string          `json:"-" yaml:"-"`
	Entrypoints      []string        `json:"entrypoints,omitempty" yaml:"entrypoints"`
	Cmd              string          `json:"cmd,omitempty" yaml:"cmd"`
	Args             []string        `json:"args,omitempty" yaml:"args"`
	Requirements     RequirementList `json:"requirements,omitempty" yaml:"requirements"`
	FileContent      []byte          `json:"file_content,omitempty" yaml:"-"` //only used for upload
	PluginName       string          `json:"plugin_name,omitempty" yaml:"-"`
}

GRPCPluginBinary represents a binary file (for a specific os and arch) serving a GRPCPlugin

func (GRPCPluginBinary) GetName

func (b GRPCPluginBinary) GetName() string

GetName is a part of the objectstore.Object interface implementation

func (GRPCPluginBinary) GetPath

func (b GRPCPluginBinary) GetPath() string

GetPath is a part of the objectstore.Object interface implementation

type GerritChangeEvent

type GerritChangeEvent struct {
	ID         string `json:"id,omitempty"`
	Project    string `json:"project,omitempty"`
	DestBranch string `json:"dest_branch,omitempty"`
	Revision   string `json:"revision,omitempty"`
	Report     string `json:"report,omitempty"`
	URL        string `json:"url,omitempty"`
}

GerritChangeEvent Gerrit information that are needed on event

type GerritEventExecution

type GerritEventExecution struct {
	Message []byte `json:"message"`
}

GerritEventExecution contains specific data for a gerrit event execution

type GoRoutine

type GoRoutine struct {
	Name    string
	Func    func(ctx context.Context)
	Restart bool
	Active  bool
	// contains filtered or unexported fields
}

type GoRoutines

type GoRoutines struct {
	// contains filtered or unexported fields
}

GoRoutines contains list of routines that have to stay up

func NewGoRoutines

func NewGoRoutines(ctx context.Context) *GoRoutines

NewGoRoutines instanciates a new GoRoutineManager

func (*GoRoutines) Exec

func (m *GoRoutines) Exec(c context.Context, name string, fn func(ctx context.Context))

Exec runs the function within a goroutine with a panic recovery

func (*GoRoutines) GetStatus

func (m *GoRoutines) GetStatus() []MonitoringStatusLine

GetStatus returns the monitoring status of goroutines that should be running

func (*GoRoutines) GoRoutine

func (m *GoRoutines) GoRoutine(name string) *GoRoutine

func (*GoRoutines) Run

func (m *GoRoutines) Run(c context.Context, name string, fn func(ctx context.Context))

Run runs the function within a goroutine with a panic recovery, and keep GoRoutine status.

func (*GoRoutines) RunWithRestart

func (m *GoRoutines) RunWithRestart(c context.Context, name string, fn func(ctx context.Context))

RunWithRestart runs the function within a goroutine with a panic recovery, and keep GoRoutine status. if the goroutine is stopped, it will ne restarted

type Group

type Group struct {
	ID   int64  `json:"id" yaml:"-" db:"id"`
	Name string `json:"name" yaml:"name" cli:"name,key" db:"name"`
	// aggregate
	Members      GroupMembers `json:"members,omitempty" yaml:"members,omitempty" db:"-"`
	Admin        bool         `json:"admin,omitempty" yaml:"admin,omitempty" db:"-"`
	Organization string       `json:"organization,omitempty" yaml:"organization,omitempty" cli:"organization" db:"-"`
}

Group represent a group of user.

func (Group) IsAdmin

func (g Group) IsAdmin(u AuthentifiedUser) bool

IsAdmin checks if given authentified user is admin for current group, group should have members aggregated and authentified user old user struct should be set.

func (Group) IsMember

func (g Group) IsMember(groupIDs []int64) bool

IsMember checks if given group memeber is part of current group.

func (Group) IsValid

func (g Group) IsValid() error

IsValid returns an error if given group is not valid.

type GroupMember

type GroupMember struct {
	ID           string `json:"id" yaml:"id" cli:"id,key"`
	Username     string `json:"username" yaml:"username" cli:"username"`
	Fullname     string `json:"fullname" yaml:"fullname,omitempty" cli:"fullname"`
	Admin        bool   `json:"admin,omitempty" yaml:"admin,omitempty" cli:"admin"`
	Organization string `json:"organization,omitempty" yaml:"organization,omitempty" cli:"organization"`
}

GroupMember struct.

type GroupMembers

type GroupMembers []GroupMember

func (GroupMembers) CheckAdminExists

func (m GroupMembers) CheckAdminExists() error

func (GroupMembers) ComputeOrganization

func (m GroupMembers) ComputeOrganization() (string, error)

func (GroupMembers) DiffUserIDs

func (m GroupMembers) DiffUserIDs(o GroupMembers) []string

func (GroupMembers) IsValid

func (m GroupMembers) IsValid() error

func (GroupMembers) UserIDs

func (m GroupMembers) UserIDs() []string

type GroupPermission

type GroupPermission struct {
	Group      Group `json:"group"`
	Permission int   `json:"permission"`
}

GroupPermission represent a group and his role in the project

func (GroupPermission) IsValid

func (g GroupPermission) IsValid() error

IsValid returns an error if group permission is not valid.

type GroupPermissions

type GroupPermissions []GroupPermission

func (GroupPermissions) ComputeOrganization

func (g GroupPermissions) ComputeOrganization() (string, error)

type Groups

type Groups []Group

Groups type provides useful func on group list.

func (Groups) HasOneOf

func (g Groups) HasOneOf(groupIDs ...int64) bool

HasOneOf returns true if one of the given ids is in groups list.

func (Groups) ToIDs

func (g Groups) ToIDs() []int64

ToIDs returns ids for groups.

func (Groups) ToMap

func (g Groups) ToMap() map[int64]Group

ToMap returns a map of groups by ids.

type IDName

type IDName struct {
	ID          int64   `json:"id" db:"id"`
	Name        string  `json:"name" db:"name"`
	Description string  `json:"description,omitempty" db:"description"`
	Icon        string  `json:"icon,omitempty" db:"icon"`
	Labels      []Label `json:"labels,omitempty" db:"-"`
}

IDName is generally used when you want to get basic informations from db

type IDNames

type IDNames []IDName

func (IDNames) IDs

func (idNames IDNames) IDs() []int64

func (IDNames) Names

func (idNames IDNames) Names() []string

type Identifiable

type Identifiable interface {
	GetUsername() string
	GetEmail() string
	GetFullname() string
}

type Int64Slice

type Int64Slice []int64

Int64Slice type used for database json storage.

func (*Int64Slice) Contains

func (s *Int64Slice) Contains(v int64) bool

Contains return true if given value is in the slice.

func (*Int64Slice) Remove

func (s *Int64Slice) Remove(v int64)

Remove all occurrences of given value from the slice.

func (*Int64Slice) Scan

func (s *Int64Slice) Scan(src interface{}) error

Scan int64 slice.

func (*Int64Slice) Unique

func (s *Int64Slice) Unique()

Remove duplicated value from slice.

func (Int64Slice) Value

func (s Int64Slice) Value() (driver.Value, error)

Value returns driver.Value from int64 slice.

type IntegrationConfig

type IntegrationConfig map[string]IntegrationConfigValue

IntegrationConfig represent the configuration of an integration

func (IntegrationConfig) Blur

func (config IntegrationConfig) Blur()

func (IntegrationConfig) Clone

func (config IntegrationConfig) Clone() IntegrationConfig

Clone return a copy of the config (with a copy of the underlying data structure)

func (IntegrationConfig) DecryptSecrets

func (config IntegrationConfig) DecryptSecrets(decryptFunc func(string) (string, error)) error

DecryptSecrets decrypt secrets given a cypher func

func (IntegrationConfig) EncryptSecrets

func (config IntegrationConfig) EncryptSecrets(encryptFunc func(string) (string, error)) error

EncryptSecrets encrypt secrets given a cypher func

func (*IntegrationConfig) HideSecrets

func (config *IntegrationConfig) HideSecrets()

HideSecrets replaces password with a placeholder

func (IntegrationConfig) MergeWith

func (config IntegrationConfig) MergeWith(cfg IntegrationConfig)

MergeWith set new values from new config and update existing values if not default.

func (*IntegrationConfig) Scan

func (config *IntegrationConfig) Scan(src interface{}) error

Scan IntegrationConfig.

func (IntegrationConfig) SetValue

func (config IntegrationConfig) SetValue(name string, value string)

Set value

func (IntegrationConfig) Value

func (config IntegrationConfig) Value() (driver.Value, error)

Value returns driver.Value from IntegrationConfig.

type IntegrationConfigMap

type IntegrationConfigMap map[string]IntegrationConfig

func (IntegrationConfigMap) Blur

func (config IntegrationConfigMap) Blur()

func (IntegrationConfigMap) Clone

func (*IntegrationConfigMap) Scan

func (config *IntegrationConfigMap) Scan(src interface{}) error

Scan IntegrationConfig.

func (IntegrationConfigMap) Value

func (config IntegrationConfigMap) Value() (driver.Value, error)

Value returns driver.Value from IntegrationConfig.

type IntegrationConfigValue

type IntegrationConfigValue struct {
	Value       string `json:"value" yaml:"value"`
	Type        string `json:"type" yaml:"type"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Static      bool   `json:"static,omitempty" yaml:"static,omitempty"`
}

IntegrationConfigValue represent a configuration value for a integration

type IntegrationModel

type IntegrationModel struct {
	ID                      int64                `json:"id" db:"id" yaml:"-" cli:"-"`
	Name                    string               `json:"name" db:"name" yaml:"name" cli:"name,key"`
	Author                  string               `json:"author" db:"author" yaml:"author" cli:"author"`
	Identifier              string               `json:"identifier" db:"identifier" yaml:"identifier,omitempty"`
	Icon                    string               `json:"icon" db:"icon" yaml:"icon"`
	DefaultConfig           IntegrationConfig    `json:"default_config" db:"default_config" yaml:"default_config"`
	AdditionalDefaultConfig IntegrationConfig    `json:"additional_default_config" db:"additional_default_config" yaml:"additional_default_config"`
	PublicConfigurations    IntegrationConfigMap `json:"public_configurations,omitempty" db:"cipher_public_configurations" yaml:"public_configurations"`
	Disabled                bool                 `json:"disabled" db:"disabled" yaml:"disabled"`
	Hook                    bool                 `json:"hook" db:"hook" yaml:"hook" cli:"hooks_supported"`
	Storage                 bool                 `json:"storage" db:"storage" yaml:"storage" cli:"storage supported"`
	Deployment              bool                 `json:"deployment" db:"deployment" yaml:"deployment" cli:"deployment_supported"`
	Compute                 bool                 `json:"compute" db:"compute" yaml:"compute" cli:"compute_supported"`
	Event                   bool                 `json:"event" db:"event" yaml:"event" cli:"event_supported"`
	ArtifactManager         bool                 `json:"artifact_manager" db:"artifact_manager" yaml:"artifact_manager" cli:"artifact_manager_supported"`
	Public                  bool                 `json:"public,omitempty" db:"public" yaml:"public,omitempty"`
}

IntegrationModel represent a integration model with its default configuration

func (*IntegrationModel) Blur

func (p *IntegrationModel) Blur()

func (IntegrationModel) IsBuiltin

func (p IntegrationModel) IsBuiltin() bool

IsBuiltin checks is the model is builtin or not

type IntegrationType

type IntegrationType string

IntegrationType represents all different type of integrations

type Job

type Job struct {
	PipelineActionID int64                  `json:"pipeline_action_id"`
	PipelineStageID  int64                  `json:"pipeline_stage_id"`
	Enabled          bool                   `json:"enabled"`
	LastModified     int64                  `json:"last_modified"`
	Action           Action                 `json:"action"`
	Warnings         []PipelineBuildWarning `json:"warnings"`
}

Job is the element of a stage

func (Job) IsValid

func (j Job) IsValid() error

IsValid returns job's validity.

type KafkaTaskExecution

type KafkaTaskExecution struct {
	Message []byte `json:"message"`
}

KafkaTaskExecution contains specific data for a kafka hook

type Key

type Key struct {
	ID      int64   `json:"id" db:"id" cli:"-"`
	Name    string  `json:"name" db:"name" cli:"name"`
	Public  string  `json:"public" db:"public" cli:"publickey"`
	Private string  `json:"private" db:"private" cli:"-"`
	KeyID   string  `json:"keyID" db:"key_id" cli:"-"`
	Type    KeyType `json:"type" db:"type" cli:"type"`
}

Key represent a key of type SSH or GPG.

type KeyType

type KeyType string
const (
	KeyTypeSSH KeyType = "ssh"
	KeyTypePGP KeyType = "pgp"
)

Those are types if key managed in CDS

func (KeyType) String

func (k KeyType) String() string

type KeyValues

type KeyValues struct {
	Key    string
	Values []string
}

type Label

type Label struct {
	ID         int64  `json:"id" db:"id"`
	Name       string `json:"name" db:"name" cli:"label,key"`
	Color      string `json:"color" db:"color"`
	ProjectID  int64  `json:"project_id" db:"project_id"`
	WorkflowID int64  `json:"workflow_id,omitempty" db:"-"`
}

Label represent a label linked to a workflow

func (*Label) IsValid

func (label *Label) IsValid() error

IsValid return an error or update label if it is not valid.

type Labels

type Labels []Label

Labels slice.

func (Labels) IsValid

func (l Labels) IsValid() error

IsValid returns an error if a label is not valid.

type LastModification

type LastModification struct {
	Key          string `json:"key,omitempty"`
	Name         string `json:"name"`
	Username     string `json:"username"`
	LastModified int64  `json:"last_modified"`
	Type         string `json:"type,omitempty"`
}

LastModification is stored in cache and used for ProjectLastUpdates computing

type MergeCommitProperty

type MergeCommitProperty struct {
	ID        string `json:"id"`
	DisplayID string `json:"