sdk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

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

Action type

View Source
const (
	ScriptAction = "Script"
	NotifAction  = "Notif"
	JUnitAction  = "JUnit"
)

Builtin Action

View Source
const (
	//BinaryRequirement refers to the need to a specific binary on host running the action
	BinaryRequirement = "binary"
	// NetworkAccessRequirement refers to the need of an opened network acces to given endpoint.
	NetworkAccessRequirement = "network"
	// 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"
)
View Source
const (
	ArtifactUpload   = "Artifact Upload"
	ArtifactDownload = "Artifact Download"
)

Builtin artifact manipulation actions

View Source
const (
	SDKAgent      Agent = "CDS/sdk"
	WorkerAgent         = "CDS/worker"
	HatcheryAgent       = "CDS/hatchery"
)

Different values of agent

View Source
const (
	Docker      = "docker"
	HostProcess = "host"
	Openstack   = "openstack"
)

Existing worker type

View Source
const (
	ArtifactFileName = "ARTIFACT-FILENAME"
)

Header name for artifact upload

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

NamePattern Pattern for project/application/pipeline/group name

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 UserEmailPattern = "(\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,3})"

UserEmailPattern pattern for user email address

View Source
const VERSION = "0.1.0"

VERSION of CDS SDK

Variables

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.StatusConflict}
	ErrProjectHasApplication                 = &Error{ID: 9, Status: http.StatusConflict}
	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.StatusConflict}
	ErrNoPipelineBuild                       = &Error{ID: 18, Status: http.StatusNotFound}
	ErrApplicationNotFound                   = &Error{ID: 19, Status: http.StatusNotFound}
	ErrGroupNotFound                         = &Error{ID: 20, 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.StatusConflict}
	ErrNoWorkerModel                         = &Error{ID: 29, Status: http.StatusNotFound}
	ErrNoProject                             = &Error{ID: 30, Status: http.StatusNotFound}
	ErrVariableExists                        = &Error{ID: 31, Status: http.StatusConflict}
	ErrInvalidGroupPattern                   = &Error{ID: 32, Status: http.StatusBadRequest}
	ErrGroupExists                           = &Error{ID: 33, Status: http.StatusConflict}
	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}
	ErrNoWorkerModelCapa                     = &Error{ID: 39, 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}
	ErrUnknownTemplate                       = &Error{ID: 51, Status: http.StatusNotFound}
	ErrNoPreviousSuccess                     = &Error{ID: 52, Status: http.StatusNotFound}
	ErrNoEnvExecution                        = &Error{ID: 53, Status: http.StatusForbidden}
	ErrSessionNotFound                       = &Error{ID: 54, Status: http.StatusUnauthorized}
	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}
	ErrConflict                              = &Error{ID: 67, Status: http.StatusConflict}
	ErrPipelineAlreadyAttached               = &Error{ID: 68, Status: http.StatusConflict}
	ErrApplicationExist                      = &Error{ID: 69, Status: http.StatusConflict}
	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.StatusConflict}
	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.StatusConflict}
	ErrNoHatchery                            = &Error{ID: 80, Status: http.StatusNotFound}
)

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

View Source
var (

	// Host defines the endpoint for all SDK requests
	Host string

	// AuthHeader is used as HTTP header
	AuthHeader = "X_AUTH_HEADER"
	// RequestedWithHeader is used as HTTP header
	RequestedWithHeader = "X-Requested-With"
	// RequestedWithValue is used as HTTP header
	RequestedWithValue = "X-CDS-SDK"
	//SessionTokenHeader is user as HTTP header
	SessionTokenHeader = "Session-Token"

	// CDSConfigFile is path to the default config file
	CDSConfigFile = path.Join(os.Getenv("HOME"), ".cds", "config.json")
)
View Source
var (
	// AvailableParameterType list all existing parameters type in CDS
	AvailableParameterType = []string{
		string(StringParameter),
		string(NumberParameter),
		string(TextParameter),
		string(EnvironmentParameter),
		string(BooleanParameter),
		string(ListParameter),
		string(PipelineParameter),
	}
)

AvailablePipelineType List of all pipeline type

View Source
var (
	// AvailableRequirementsType List of all requirements
	AvailableRequirementsType = []string{
		BinaryRequirement,
		NetworkAccessRequirement,
		ModelRequirement,
		HostnameRequirement,
		PluginRequirement,
		ServiceRequirement,
		MemoryRequirement,
	}
)
View Source
var (
	// AvailableVariableType list all exising variable type in CDS
	AvailableVariableType = []VariableType{
		SecretVariable,
		TextVariable,
		StringVariable,
		KeyVariable,
		BooleanVariable,
		NumberVariable,
	}
)
View Source
var (
	// AvailableWorkerModelType List of all worker model type
	AvailableWorkerModelType = []string{
		string(Docker),
		string(HostProcess),
		string(Openstack),
	}
)
View Source
var DefaultEnv = Environment{
	ID:   1,
	Name: "NoEnv",
}

DefaultEnv Default environment for pipeline build

View Source
var SupportedLanguages = []language.Tag{
	language.AmericanEnglish,
	language.French,
}

SupportedLanguages on API errors

Functions

func AddAction

func AddAction(name string, params []Parameter, requirements []Requirement) error

AddAction creates a new action available only to creator by default params are stringParameter only (for now), with no description

func AddActionStep

func AddActionStep(actionName string, child Action) error

AddActionStep add a new step of type Action to given action

func AddApplication

func AddApplication(key, appName string) error

AddApplication create an application in the given project

func AddApplicationFromReposManager

func AddApplicationFromReposManager(projectkey, rmname, repoFullname string) error

AddApplicationFromReposManager create the application from the repofullname

func AddApplicationPipeline

func AddApplicationPipeline(projectKey, appName, pipelineName string) error

AddApplicationPipeline add a pipeline in an application

func AddApplicationVariable

func AddApplicationVariable(projectKey, appName, varName, varValue string, varType VariableType) error

AddApplicationVariable add a variable in an application

func AddCapabilityToWorkerModel

func AddCapabilityToWorkerModel(modelID int64, name string, capaType string, value string) error

AddCapabilityToWorkerModel adds a capability to given model

func AddEnvironment

func AddEnvironment(key, envName string) error

AddEnvironment create an environment

func AddEnvironmentVariable

func AddEnvironmentVariable(projectKey, envName, varName, varValue string, varType VariableType) error

AddEnvironmentVariable add a variable in an environment

func AddGroup

func AddGroup(name string) error

AddGroup creates a new group

func AddGroupInApplication

func AddGroupInApplication(projectKey, appName, groupName string, permission int) error

AddGroupInApplication add a group in an application

func AddGroupInEnvironment

func AddGroupInEnvironment(projectKey, envName, groupName string, permission int) error

AddGroupInEnvironment add a group in an environment

func AddGroupInPipeline

func AddGroupInPipeline(projectKey, pipelineName, groupName string, permission int) error

AddGroupInPipeline add a group in a pipeline

func AddGroupInProject

func AddGroupInProject(projectKey, groupname string, permission int, recursive bool) error

AddGroupInProject add a group in a project

func AddHookOnRepositoriesManager

func AddHookOnRepositoriesManager(projectKey, appName, reposManager, repoFullname, pipelineName string) error

AddHookOnRepositoriesManager create hook on stash

func AddJoinedAction

func AddJoinedAction(projectKey, pipelineName string, stageID int64, a *Action) error

AddJoinedAction creates a joined action in given pipeline

func AddParameterInPipeline

func AddParameterInPipeline(projectKey, pipelineName, paramName, paramValue, paramType, paramDescription string) error

AddParameterInPipeline add a variable in a pipeline

func AddPipeline

func AddPipeline(name string, projectKey string, pipelineType PipelineType, params []Parameter) error

AddPipeline creates a new empty pipeline

func AddProject

func AddProject(name, key, groupName string) error

AddProject creates a new project available only to creator by default

func AddProjectVariable

func AddProjectVariable(key, name, val string, t VariableType) error

AddProjectVariable adds a project wide variable

func AddStage

func AddStage(projectKey, pipelineName, name string) error

AddStage creates a new stage

func AddTrigger

func AddTrigger(t *PipelineTrigger) error

AddTrigger adds a trigger between two pipelines

func AddUser

func AddUser(name, fname, email, callback string) error

AddUser creates a new user available only to creator by default

func AddUsersInGroup

func AddUsersInGroup(groupName string, users []string) error

AddUsersInGroup call API to add users in the group

func AddVariableInProject

func AddVariableInProject(projectKey, varName, varValue, varType string) error

AddVariableInProject add a variable in a project

func AttachApplicationToReposistoriesManager

func AttachApplicationToReposistoriesManager(projectKey, appName, reposManager, repoFullname string) error

AttachApplicationToReposistoriesManager attachs the application to the repo identified by its fullname in the reposManager

func AttachPipeline

func AttachPipeline(key, app, pip string) error

AttachPipeline allows pipeline to be used in application context

func Authorization

func Authorization(h string)

Authorization set authorization header for all next call

func ChangeStageState

func ChangeStageState(projectKey, pipelineName, pipelineStageID string, enabled bool) error

ChangeStageState Enabled/Disabled a stage

func ConnectReposManager

func ConnectReposManager(key, name string) (string, string, error)

ConnectReposManager add a new repositories manager in CDS for a project It returns accessToken and authorize URL

func ConnectReposManagerCallback

func ConnectReposManagerCallback(key, name, requestToken, verifier string) (string, string, error)

ConnectReposManagerCallback returns accessToken and accessTokenSecret

func DecodeError

func DecodeError(data []byte) error

DecodeError return an Error struct from json

func DeleteAction

func DeleteAction(name string) error

DeleteAction remove given action from CDS if action is not used in any pipeline

func DeleteApplication

func DeleteApplication(pk, name string) error

DeleteApplication delete an application from CDS

func DeleteEnvironment

func DeleteEnvironment(pk, name string) error

DeleteEnvironment delete an environment from CDS

func DeleteHook

func DeleteHook(project, application, pipeline string, id int64) error

DeleteHook remove a hook previously created

func DeleteHookOnRepositoriesManager

func DeleteHookOnRepositoriesManager(projectKey, appName, reposManager string, hookID int64) error

DeleteHookOnRepositoriesManager delete hook on stash

func DeletePipeline

func DeletePipeline(key, name string) error

DeletePipeline remove given pipeline from CDS

func DeletePipelineAction

func DeletePipelineAction(projectKey string, pipelineName string, actionPipelineID int64) error

DeletePipelineAction delete the given action from the given pipeline

func DeletePipelineScheduler

func DeletePipelineScheduler(projectKey, appName, pipelineName string, s *PipelineScheduler) error

DeletePipelineScheduler update a pipeline scheduler

func DeletePlugin

func DeletePlugin(name string) error

DeletePlugin delete plugin

func DeleteProject

func DeleteProject(key string) error

DeleteProject removes a project and all its pipeline from CDS

func DeleteStage

func DeleteStage(projectKey, pipelineName, pipelineStageID string) error

DeleteStage Call API to delete the given stage from the given pipeline

func DeleteTemplate

func DeleteTemplate(name string) error

DeleteTemplate delete Template

func DeleteTrigger

func DeleteTrigger(proj, app, pip string, id int64) error

DeleteTrigger removes a trigger between two pipelines

func DeleteUser

func DeleteUser(name string) error

DeleteUser Call API to delete the given user

func DeleteWorkerCapability

func DeleteWorkerCapability(workerModelID int64, capaName string) error

DeleteWorkerCapability removes a capability from given worker model

func DeleteWorkerModel

func DeleteWorkerModel(workerModelID int64) error

DeleteWorkerModel deletes a worker model and all its capabilities

func DetachApplicationToReposistoriesManager

func DetachApplicationToReposistoriesManager(projectKey, appName, reposManager string) error

DetachApplicationToReposistoriesManager attachs the application from any reposManager

func DisableWorker

func DisableWorker(workerID string) error

DisableWorker order the engine to disable given worker, not allowing it to take builds

func DisconnectReposManager

func DisconnectReposManager(key, name string) error

DisconnectReposManager removes access token for the project

func DisplayStream

func DisplayStream(buffer io.ReadCloser) error

DisplayStream decode each line from http buffer and print either message or error

func DownloadArtifact

func DownloadArtifact(project, app, pip, tag, destdir, env, filename string) error

DownloadArtifact downloads a single artifact from API

func DownloadArtifacts

func DownloadArtifacts(project string, application string, pipeline string, tag string, destdir string, env string) error

DownloadArtifacts retrieves and download artifacts related to given project-pipeline-tag and download them into destdir

func DownloadPlugin

func DownloadPlugin(name string, destdir string) error

DownloadPlugin download plugin from action

func Exit

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

Exit func display an error message on stderr and exit 1

func GenerateWorkerToken

func GenerateWorkerToken(group string, e Expiration) (string, error)

GenerateWorkerToken creates a key tied to calling user that allow registering workers

func GetStatus

func GetStatus() ([]string, error)

GetStatus retrieve generic health infos to CDS

func GetVersion

func GetVersion() (string, error)

GetVersion returns API version

func InitEndpoint

func InitEndpoint(en string)

InitEndpoint force sdk package request to given endpoint

func IsAdmin added in v0.4.0

func IsAdmin() (bool, error)

IsAdmin checks if user is admin

func IsInArray

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

IsInArray Check if the element is in the array

func MoveActionInPipeline

func MoveActionInPipeline(projectKey, pipelineName string, actionPipelineID int64, newOrder int) error

MoveActionInPipeline Move an action in a pipeline

func MoveStage

func MoveStage(projectKey, pipelineName string, pipelineStageID int64, buildOrder int) error

MoveStage Change stage buildOrder

func NeedPlaceholder

func NeedPlaceholder(t VariableType) bool

NeedPlaceholder returns true if variable type is either secret or key

func Options

func Options(h, u, p, t string)

Options set authentication data

func ProcessError

func ProcessError(target error, al string) (string, int)

ProcessError tries to recognize given error and return error message in a language matching Accepted-Language

func ReadConfig added in v0.4.0

func ReadConfig() error

ReadConfig read the specified config file

func RemoveApplicationPipeline

func RemoveApplicationPipeline(projectKey, appName, pipelineName string) error

RemoveApplicationPipeline remove a pipeline from an application

func RemoveApplicationVariable

func RemoveApplicationVariable(projectKey, appName, varName string) error

RemoveApplicationVariable remove a variable from an application

func RemoveEnvironmentVariable

func RemoveEnvironmentVariable(projectKey, envName, varName string) error

RemoveEnvironmentVariable remove a variable from an environment

func RemoveGroup

func RemoveGroup(name string) error

RemoveGroup remove group

func RemoveGroupFromApplication

func RemoveGroupFromApplication(projectKey, appName, groupName string) error

RemoveGroupFromApplication call api to remove a group from the given application

func RemoveGroupFromEnvironment

func RemoveGroupFromEnvironment(projectKey, envName, groupName string) error

RemoveGroupFromEnvironment call api to remove a group from the given environment

func RemoveGroupFromPipeline

func RemoveGroupFromPipeline(projectKey, pipelineName, groupName string) error

RemoveGroupFromPipeline call api to remove a group from the given pipeline

func RemoveGroupFromProject

func RemoveGroupFromProject(projectKey, groupname string) error

RemoveGroupFromProject call api to remove a group from the project

func RemoveParameterFromPipeline

func RemoveParameterFromPipeline(projectKey, pipelineName, paramName string) error

RemoveParameterFromPipeline remove a parameter from a pipeline

func RemoveProject

func RemoveProject(key string) error

RemoveProject call api to delete a project

func RemoveUserFromGroup

func RemoveUserFromGroup(groupName string, userName string) error

RemoveUserFromGroup call API to remove a user in the group

func RemoveVariableFromProject

func RemoveVariableFromProject(projectKey, varName string) error

RemoveVariableFromProject remove a variable from a project

func RenameApplication

func RenameApplication(pk, name, newName string) error

RenameApplication renames an application from CDS

func RenameGroup

func RenameGroup(oldName, newName string) error

RenameGroup Rename a group

func RenameProject

func RenameProject(key, newName string) error

RenameProject call API to update project

func RenameStage

func RenameStage(projectKey, pipelineName, pipelineStageID, newName string) error

RenameStage Rename a stage

func RenameUser

func RenameUser(name, fname string) error

RenameUser Rename given user

func Request

func Request(method string, path string, args []byte, mods ...RequestModifier) ([]byte, int, error)

Request executes an authentificated HTTP request on $path given $method and $args

func ResetUser

func ResetUser(name, email, callback string) error

ResetUser reset user password

func RestartPipeline

func RestartPipeline(key, app, pip, env string, bn int) (chan Log, error)

RestartPipeline will have two distinct behavior: - If the pipeline build result is failed, it will only restart failed actions - If the pipeline build result is success, it will restart all actions

func RunPipeline

func RunPipeline(key, appName, name, env string, stream bool, request RunRequest, followTriggers bool) (chan Log, error)

RunPipeline trigger a CDS pipeline

func SetAgent

func SetAgent(a Agent)

SetAgent set a agent value

func SetHTTPClient

func SetHTTPClient(c HTTPClient)

SetHTTPClient aims to change the default http client of the sdk

func SetRetry added in v0.4.0

func SetRetry(n int)

SetRetry initialize number of http retry

func SetUserGroupAdmin

func SetUserGroupAdmin(groupName string, userName string) error

SetUserGroupAdmin grants to given user privileges on given group

func SetWorkerStatus

func SetWorkerStatus(s Status) error

SetWorkerStatus update worker status

func Stream

func Stream(method string, path string, args []byte, mods ...RequestModifier) (io.ReadCloser, int, error)

Stream makes an authenticated http request and return io.ReadCloser

func StreamPipelineBuild

func StreamPipelineBuild(key, appName, pipelineName, env string, buildID int, followTrigger bool) (chan Log, error)

StreamPipelineBuild poll the api to fetch logs of building pipeline and push them in returned channel

func UnsetUserGroupAdmin

func UnsetUserGroupAdmin(groupName string, userName string) error

UnsetUserGroupAdmin removes user priviles on group

func UpdateAction

func UpdateAction(a Action) error

UpdateAction update given action

func UpdateApplicationPipeline

func UpdateApplicationPipeline(projectKey, appName, pipelineName string, params []Parameter) error

UpdateApplicationPipeline add a pipeline in an application

func UpdateApplicationVariable

func UpdateApplicationVariable(projectKey, appName, oldName, varName, varValue, varType string) error

UpdateApplicationVariable update a variable in an application

func UpdateCapabilityToWorkerModel

func UpdateCapabilityToWorkerModel(modelID int64, name string, capaType string, value string) error

UpdateCapabilityToWorkerModel updates a capability to given model

func UpdateEnvironment

func UpdateEnvironment(key, oldName, newName string) error

UpdateEnvironment create an environment

func UpdateEnvironmentVariable

func UpdateEnvironmentVariable(projectKey, envName, oldVarName, varName, varValue, varType string) error

UpdateEnvironmentVariable update a variable in an environment

func UpdateGroupInApplication

func UpdateGroupInApplication(projectKey, appName, groupName string, permission int) error

UpdateGroupInApplication call api to update group permission for the given application

func UpdateGroupInEnvironment

func UpdateGroupInEnvironment(projectKey, envName, groupName string, permission int) error

UpdateGroupInEnvironment call api to update group permission for the given environment

func UpdateGroupInPipeline

func UpdateGroupInPipeline(projectKey, pipelineName, groupName string, permission int) error

UpdateGroupInPipeline call api to update group permission on pipeline

func UpdateGroupInProject

func UpdateGroupInProject(projectKey, groupname string, permission int) error

UpdateGroupInProject call api to update group permission on project

func UpdateJoinedAction

func UpdateJoinedAction(projectKey, pipelineName string, stage int, a Action) error

UpdateJoinedAction update given joined action in given pipeline stage

func UpdateParameterInPipeline

func UpdateParameterInPipeline(projectKey, pipelineName, paramName, paramValue, paramType, paramDescription string) error

UpdateParameterInPipeline update a variable in a pipeline

func UpdateTrigger

func UpdateTrigger(t *PipelineTrigger) error

UpdateTrigger adds a trigger between two pipelines

func UpdateUserEmail

func UpdateUserEmail(name, email string) error

UpdateUserEmail Change user email address

func UpdateUsername

func UpdateUsername(oldUsername, newUsername string) error

UpdateUsername Change username

func UpdateVariableInProject

func UpdateVariableInProject(projectKey, oldName, varName, varValue, varType string) error

UpdateVariableInProject update a variable in a project

func UpdateWorkerModel

func UpdateWorkerModel(id int64, name string, t string, value string) error

UpdateWorkerModel updates all characteristics of a worker model

func Upload

func Upload(method string, path string, body io.ReadCloser, mods ...RequestModifier) ([]byte, int, error)

Upload upload content in given io.Reader to given HTTP endpoint

func UploadArtifact

func UploadArtifact(project string, pipeline string, application string, tag string, filePath string, buildNumber int, env string) error

UploadArtifact read file at filePath and upload it in projet-pipeline-tag starage directory

func UploadMultiPart

func UploadMultiPart(method string, path string, body *bytes.Buffer, mods ...RequestModifier) ([]byte, int, error)

UploadMultiPart upload multipart

func UploadPlugin

func UploadPlugin(filePath string, update bool) ([]byte, error)

UploadPlugin uploads binary file to perform a new action

func UploadTemplate

func UploadTemplate(filePath string, update bool, name string) ([]byte, error)

UploadTemplate uploads binary file to perform a new action

Types

type Action

type Action struct {
	ID               int64         `json:"id" yaml:"-"`
	Name             string        `json:"name"`
	Type             string        `json:"type" yaml:"-"` // Source - Build - Packaging - Deployment
	Description      string        `json:"description" yaml:"desc,omitempty"`
	Requirements     []Requirement `json:"requirements"`
	Parameters       []Parameter   `json:"parameters"`
	Actions          []Action      `json:"actions" yaml:"actions,omitempty"`
	Enabled          bool          `json:"enabled" yaml:"-"`
	PipelineStageID  int64         `json:"pipeline_stage_id" yaml:"-"`
	PipelineActionID int64         `json:"pipeline_action_id" yaml:"-"`
	Final            bool          `json:"final" yaml:"-"`
	LastModified     int64         `json:"last_modified"`
}

Action is the base element of CDS pipeline

func GetAction

func GetAction(name string) (Action, error)

GetAction retrieve action definition

func ImportAction

func ImportAction(action *Action) (*Action, error)

ImportAction imports an action on CDS

func ListActions

func ListActions() ([]Action, error)

ListActions returns all available actions to caller

func NewAction

func NewAction(name string) *Action

NewAction instanciate a new Action

func NewActionArtifactDownload

func NewActionArtifactDownload(path, tag string) Action

NewActionArtifactDownload creates a builtin action artifactDownload

func NewActionArtifactUpload

func NewActionArtifactUpload(path, tag string) Action

NewActionArtifactUpload creates a builtin action artifactUpload

func NewActionFromRemoteScript

func NewActionFromRemoteScript(url string, params []Parameter) (*Action, error)

NewActionFromRemoteScript creates an action from an URL giving an HCL file

func NewActionFromScript

func NewActionFromScript(btes []byte) (*Action, error)

NewActionFromScript creates an action from a HCL file as bytes

func NewActionJUnit

func NewActionJUnit(path string) Action

NewActionJUnit creates a builtin action junit

func NewActionPlugin

func NewActionPlugin(pluginname string, parameters []Parameter) Action

NewActionPlugin creates a plugin action

func NewActionScript

func NewActionScript(script string, requirements []Requirement) Action

NewActionScript creates a builtin action script

func NewJoinedAction

func NewJoinedAction(actionName string, parameters []Parameter) (*Action, error)

NewJoinedAction is a helper to build an action object acting as an joined action

func NewScriptAction

func NewScriptAction(content string) Action

NewScriptAction setup a new Action object with all attribute ok for script 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) FromJSON

func (a *Action) FromJSON(data []byte) (*Action, error)

FromJSON unmarshal given json data into Action object

func (*Action) JSON

func (a *Action) JSON() string

JSON return the marshalled string of Action object

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

type ActionAudit

type ActionAudit struct {
	ActionID   int64     `json:"action_id"`
	User       User      `json:"user"`
	Change     string    `json:"change"`
	Versionned time.Time `json:"versionned"`
	Action     Action    `json:"action"`
}

ActionAudit Audit on action

type ActionBuild

type ActionBuild struct {
	ID               int64         `json:"id"`
	BuildNumber      int           `json:"build_number"`
	PipelineBuildID  int64         `json:"pipeline_build_id"`
	PipelineID       int64         `json:"pipeline_id"`
	ActionName       string        `json:"action_name"`
	PipelineActionID int64         `json:"pipeline_action_id"`
	PipelineStageID  int64         `json:"-"`
	Args             []Parameter   `json:"args"`
	Status           Status        `json:"status"`
	Requirements     []Requirement `json:"requirements"`
	Queued           time.Time     `json:"queued,omitempty"`
	Start            time.Time     `json:"start,omitempty"`
	Done             time.Time     `json:"done,omitempty"`
	Logs             string        `json:"logs,omitempty"`
	Model            string        `json:"model,omitempty"`
}

ActionBuild represents an action to be run

func GetBuildQueue

func GetBuildQueue() ([]ActionBuild, error)

GetBuildQueue retrieves current CDS build in queue

type ActionPlugin

type ActionPlugin struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Author      string `json:"author"`
	Filename    string `json:"filename"`
	Path        string `json:"path"`

	Size       int64  `json:"size,omitempty"`
	Perm       uint32 `json:"perm,omitempty"`
	MD5sum     string `json:"md5sum,omitempty"`
	ObjectPath string `json:"object_path,omitempty"`
}

ActionPlugin is the Action Plugin representation from Engine side

func (*ActionPlugin) GetName

func (a *ActionPlugin) GetName() string

GetName returns the name the action plugin

func (*ActionPlugin) GetPath

func (a *ActionPlugin) GetPath() string

GetPath returns the storage path of the action plugin

type ActionScript

type ActionScript struct {
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	Requirements map[string]Requirement `json:"requirement,omitempty"`
	Parameters   map[string]Parameter   `json:"parameters,omitempty"`
	Steps        []struct {
		Enabled          *bool                        `json:"enabled"`
		Final            bool                         `json:"final"`
		ArtifactUpload   map[string]string            `json:"artifactUpload,omitempty"`
		ArtifactDownload map[string]string            `json:"artifactDownload,omitempty"`
		Script           string                       `json:"script,omitempty"`
		JUnitReport      string                       `json:"jUnitReport,omitempty"`
		Plugin           map[string]map[string]string `json:"plugin,omitempty"`
	} `json:"steps"`
}

ActionScript represents the structure of a HCL action file

type Agent

type Agent string

Agent describe the type of authentication method to use

type Application

type Application struct {
	ID                  int64                 `json:"id"`
	Name                string                `json:"name"`
	ProjectKey          string                `json:"project_key"`
	ApplicationGroups   []GroupPermission     `json:"groups,omitempty"`
	Variable            []Variable            `json:"variables,omitempty"`
	Pipelines           []ApplicationPipeline `json:"pipelines,omitempty"`
	PipelinesBuild      []PipelineBuild       `json:"pipelines_build,omitempty"`
	Permission          int                   `json:"permission"`
	Notifications       []UserNotification    `json:"notifications,omitempty"`
	LastModified        int64                 `json:"last_modified"`
	RepositoriesManager *RepositoriesManager  `json:"repositories_manager,omitempty"`
	RepositoryFullname  string                `json:"repository_fullname,omitempty"`
	RepositoryPollers   []RepositoryPoller    `json:"pollers,omitempty"`
	Hooks               []Hook                `json:"hooks,omitempty"`
	Workflows           []CDPipeline          `json:"workflows,omitempty"`
}

Application represent an application in a project

func ApplyApplicationTemplate

func ApplyApplicationTemplate(projectKey string, name string, build Template) (*Application, error)

ApplyApplicationTemplate creates given application and apply build template

func GetApplication

func GetApplication(pk, name string) (*Application, error)

GetApplication retrieve the given application from CDS

func ListApplications

func ListApplications(key string) ([]Application, error)

ListApplications returns all available application for the given project

func NewApplication

func NewApplication(name string) *Application

NewApplication instanciate a new NewApplication

type ApplicationGroup

type ApplicationGroup struct {
	Application Application `json:"application"`
	Permission  int         `json:"permission"`
}

ApplicationGroup represent a link with a pipeline

type ApplicationPipeline

type ApplicationPipeline struct {
	Pipeline     Pipeline          `json:"pipeline"`
	Parameters   []Parameter       `json:"parameters"`
	LastModified int64             `json:"last_modified"`
	Triggers     []PipelineTrigger `json:"triggers,omitempty"`
}

ApplicationPipeline Represent the link between an application and a pipeline

type ApplyTemplatesOptions

type ApplyTemplatesOptions struct {
	ApplicationName string          `json:"name"`
	TemplateName    string          `json:"template"`
	TemplateParams  []TemplateParam `json:"template_params"`
}

ApplyTemplatesOptions represents arguments to create an application and all its components from templates

type Artifact

type Artifact struct {
	ID          int64  `json:"id"`
	Project     string `json:"project"`
	Pipeline    string `json:"pipeline"`
	Application string `json:"application"`
	Environment string `json:"environment"`
	BuildNumber int    `json:"build_number"`
	Name        string `json:"name"`
	Tag         string `json:"tag"`

	DownloadHash string `json:"download_hash"`
	Size         int64  `json:"size,omitempty"`
	Perm         uint32 `json:"perm,omitempty"`
	MD5sum       string `json:"md5sum,omitempty"`
	ObjectPath   string `json:"object_path,omitempty"`
}

Artifact define a file needed to be save for future use

func ListArtifacts

func ListArtifacts(project string, application string, pipeline string, tag string, env string) ([]Artifact, error)

ListArtifacts retrieves the list of file stored as artifacts for given project-pipeline-tag

func (*Artifact) GetName

func (a *Artifact) GetName() string

GetName returns the name the artifact

func (*Artifact) GetPath

func (a *Artifact) GetPath() string

GetPath returns the path of the artifact

type Auth

type Auth struct {
	HashedPassword    string      `json:"hashedPassword"`
	HashedTokenVerify string      `json:"hashedTokenVerify"`
	EmailVerified     bool        `json:"emailVerified"`
	DateReset         int64       `json:"dateReset"`
	Tokens            []UserToken `json:"tokens,omitempty"`
}

Auth Authentifaction Struct for user

func NewAuth

func NewAuth(hashedToken string) *Auth

NewAuth instanciate a new Authentification struct

func (*Auth) FromJSON

func (a *Auth) FromJSON(data []byte) (*Auth, error)

FromJSON unmarshal given json data into Auth object

func (*Auth) JSON

func (a *Auth) JSON() string

JSON return the marshalled string of Auth object

type BuildState

type BuildState struct {
	Stages []Stage `json:"stages"`
	Logs   []Log   `json:"logs"`
	Status Status  `json:"status"`
}

BuildState define struct returned when looking for build state informations

func GetBuildActionLog

func GetBuildActionLog(projectKey, appName, pipelineName, buildID, pipelineActionID string) (BuildState, error)

GetBuildActionLog Get the log of the given action for the given build

type CDPipeline

type CDPipeline struct {
	Project      Project         `json:"project"`
	Application  Application     `json:"application"`
	Environment  Environment     `json:"environment"`
	Pipeline     Pipeline        `json:"pipeline"`
	SubPipelines []CDPipeline    `json:"subPipelines"`
	Trigger      PipelineTrigger `json:"trigger"`
}

CDPipeline Represent a pipeline in the CDTree

type Environment

type Environment struct {
	ID                int64             `json:"id" yaml:"-"`
	Name              string            `json:"name" yaml:"name"`
	EnvironmentGroups []GroupPermission `json:"groups,omitempty" yaml:"groups"`
	Variable          []Variable        `json:"variables,omitempty" yaml:"variables"`
	ProjectID         int64             `json:"-" yaml:"-"`
	ProjectKey        string            `json:"-" yaml:"-"`
	Permission        int               `json:"permission"`
	LastModified      int64             `json:"last_modified"`
}

Environment represent a deployment environment

func CloneEnvironment

func CloneEnvironment(pk, name, new string) (*Environment, error)

CloneEnvironment clone the given environment in CDS

func GetEnvironment

func GetEnvironment(pk, name string) (*Environment, error)

GetEnvironment retrieve the given environment from CDS

func ListEnvironments

func ListEnvironments(key string) ([]Environment, error)

ListEnvironments returns all available environments for the given project

func NewEnvironment

func NewEnvironment(name string) *Environment

NewEnvironment instanciate a new Environment

type EnvironmentGroup

type EnvironmentGroup struct {
	Environment Environment `json:"environment"`
	Permission  int         `json:"permission"`
}

EnvironmentGroup represent a link with a pipeline

type Error

type Error struct {
	ID      int    `json:"-"`
	Status  int    `json:"-"`
	Message string `json:"message"`
	Root    error  `json:"-"`
}

Error type

func NewError

func NewError(target *Error, root error) *Error

NewError just set an error with a root cause

func (Error) Error

func (e Error) Error() string

func (Error) String

func (e Error) String() string

type Event added in v0.4.0

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   map[string]interface{} `json:"payload"`
}

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 EventEngine added in v0.4.0

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

EventEngine contains event data for engine

type EventJob added in v0.4.0

type EventJob struct {
	Version         int64        `json:"version,omitempty"`
	JobName         string       `json:"jobName,omitempty"`
	Status          Status       `json:"status,omitempty"`
	Queued          int64        `json:"queued,omitempty"`
	Start           int64        `json:"start,omitempty"`
	Done            int64        `json:"done,omitempty"`
	ModelName       string       `json:"modelName,omitempty"`
	PipelineName    string       `json:"pipelineName,omitempty"`
	PipelineType    PipelineType `json:"type,omitempty"`
	ProjectKey      string       `json:"projectKey,omitempty"`
	ApplicationName string       `json:"applicationName,omitempty"`
	EnvironmentName string       `json:"environmentName,omitempty"`
	BranchName      string       `json:"branchName,omitempty"`
	Hash            string       `json:"hash,omitempty"`
}

EventJob contains event data for a job

type EventNotif added in v0.4.0

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 EventPipelineBuild added in v0.4.0

type EventPipelineBuild struct {
	Version               int64        `json:"version,omitempty"`
	BuildNumber           int64        `json:"buildNumber,omitempty"`
	Status                Status       `json:"status,omitempty"`
	Start                 int64        `json:"start,omitempty"`
	Done                  int64        `json:"done,omitempty"`
	PipelineName          string       `json:"pipelineName,omitempty"`
	PipelineType          PipelineType `json:"type,omitempty"`
	ProjectKey            string       `json:"projectKey,omitempty"`
	ApplicationName       string       `json:"applicationName,omitempty"`
	EnvironmentName       string       `json:"environmentName,omitempty"`
	BranchName            string       `json:"branchName,omitempty"`
	Hash                  string       `json:"hash,omitempty"`
	RepositoryManagerName string       `json:"repositoryManagerName,omitempty"`
	RepositoryFullname    string       `json:"repositoryFullname,omitempty"`
}

EventPipelineBuild contains event data for a pipeline build

type Expiration

type Expiration int

Expiration defines how worker key should expire

const (
	Session Expiration
	Daily
	Persistent
)

Worker key expiry options

func ExpirationFromString

func ExpirationFromString(s string) (Expiration, error)

ExpirationFromString returns a typed Expiration from a string

func (Expiration) String

func (e Expiration) String() string

type Group

type Group struct {
	ID                int64              `json:"id" yaml:"-"`
	Name              string             `json:"name" yaml:"name"`
	Admins            []User             `json:"admins,omitempty" yaml:"admin,omitempty"`
	Users             []User             `json:"users,omitempty" yaml:"users,omitempty"`
	ProjectGroups     []ProjectGroup     `json:"projects,omitempty" yaml:"-"`
	PipelineGroups    []PipelineGroup    `json:"pipelines,omitempty" yaml:"-"`
	ApplicationGroups []ApplicationGroup `json:"applications,omitempty" yaml:"-"`
	EnvironmentGroups []EnvironmentGroup `json:"environments,omitempty" yaml:"-"`
}

Group represent a group of user.

func GetGroup

func GetGroup(groupName string) (Group, error)

GetGroup call API to get Group information

func ListGroups

func ListGroups() ([]Group, error)

ListGroups returns all available group to caller

func (*Group) FromJSON

func (p *Group) FromJSON(data []byte) (*Group, error)

FromJSON unmarshal given json data into Group object

type GroupPermission

type GroupPermission struct {
	Group      Group `json:"group"`
	Permission int   `json:"permission"`
	Recursive  bool  `json:"recursive,omitempty" yaml:"-"`
}

GroupPermission represent a group and his role in the project

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is a interface for HTTPClient mock

type Hatchery

type Hatchery struct {
	ID       int64     `json:"id"`
	UID      string    `json:"uid"`
	Name     string    `json:"name"`
	Status   string    `json:"status"`
	GroupID  int64     `json:"group_id"`
	LastBeat time.Time `json:"-"`
	Model    Model     `json:"model"`
}

Hatchery registration model

type Hook

type Hook struct {
	ID            int64    `json:"id"`
	UID           string   `json:"uid"`
	Pipeline      Pipeline `json:"pipeline"`
	ApplicationID int64    `json:"application_id"`
	Kind          string   `json:"kind"`
	Host          string   `json:"host"`
	Project       string   `json:"project"`
	Repository    string   `json:"repository"`
	Enabled       bool     `json:"enabled"`
	Link          string   `json:"link"`
}

Hook used to link a git repository to a given pipeline

func AddHook

func AddHook(a *Application, p *Pipeline, host string, project string, repository string) (*Hook, error)

AddHook creates a new hook between a pipeline and a repository

func GetHooks

func GetHooks(project, application, pipeline string) ([]Hook, error)

GetHooks lists all hooks related to a pipeline

type JabberEmailUserNotificationSettings

type JabberEmailUserNotificationSettings struct {
	OnSuccess    UserNotificationEventType `json:"on_success"`
	OnFailure    UserNotificationEventType `json:"on_failure"`
	OnStart      bool                      `json:"on_start"`
	SendToGroups bool                      `json:"send_to_groups"`
	SendToAuthor bool                      `json:"send_to_author"`
	Recipients   []string                  `json:"recipients"`
	Template     UserNotificationTemplate  `json:"template"`
}

JabberEmailUserNotificationSettings are jabber or email settings

func (*JabberEmailUserNotificationSettings) Failure

Failure returns always/never/change

func (*JabberEmailUserNotificationSettings) Start

Start returns always/never/change

func (*JabberEmailUserNotificationSettings) Success

Success returns always/never/change

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"`
}

Job is the element of a stage

type Log

type Log struct {
	ID            int64     `json:"id"`
	ActionBuildID int64     `json:"action_build_id"`
	Timestamp     time.Time `json:"timestamp"`
	Step          string    `json:"step"`
	Value         string    `json:"value"`
}

Log struct holds a single line of build log

func GetBuildLogs

func GetBuildLogs(key, pipelineName, env string, buildID int) ([]Log, error)

GetBuildLogs retrieve all output from given build

func NewLog

func NewLog(buildid int64, step string, value string) *Log

NewLog returns a log struct

type Mod

type Mod func(s string) string

Mod is the functional parameter type of sdk function to alter their behavior

func WithApplicationHistory

func WithApplicationHistory(length int) Mod

WithApplicationHistory is a functional parameter of GetProject

func WithApplicationStatus

func WithApplicationStatus() Mod

WithApplicationStatus is a func parameter of ListProject

func WithEnvironments

func WithEnvironments() Mod

WithEnvironments is a func parameter of ListProject

func WithEverything

func WithEverything() Mod

WithEverything is a func parameter of ListProject

func WithPipelines

func WithPipelines() Mod

WithPipelines is a func parameter of ListProject

type Model

type Model struct {
	ID           int64         `json:"id" db:"id"`
	Name         string        `json:"name"  db:"name"`
	Type         string        `json:"type"  db:"type"`
	Image        string        `json:"image" db:"image"`
	Capabilities []Requirement `json:"capabilities" db:"-"`
	CreatedBy    User          `json:"created_by" db:"-"`
	OwnerID      int64         `json:"owner_id" db:"owner_id"` //DEPRECATED
	GroupID      int64         `json:"group_id" db:"group_id"`
}

Model represents a worker model (ex: Go 1.5.1 Docker Images) with specified capabilities (ex: go, golint and go2xunit binaries)

func AddWorkerModel

func AddWorkerModel(name string, t string, img string, groupID int64) (*Model, error)

AddWorkerModel registers a new worker model available

func GetWorkerModel

func GetWorkerModel(name string) (*Model, error)

GetWorkerModel retrieves a specific worker model

func GetWorkerModels

func GetWorkerModels() ([]Model, error)

GetWorkerModels retrieves all worker models avaialbe to user

type ModelStatus

type ModelStatus struct {
	ModelID       int64         `json:"model_id" yaml:"-"`
	ModelName     string        `json:"model_name" yaml:"name"`
	ModelGroupID  int64         `json:"model_group_id" yaml:"model_group_id"`
	CurrentCount  int64         `json:"current_count" yaml:"current"`
	WantedCount   int64         `json:"wanted_count" yaml:"wanted"`
	BuildingCount int64         `json:"building_count" yaml:"building"`
	Requirements  []Requirement `json:"requirements"`
}

ModelStatus sums up the number of worker deployed and wanted for a given model

func GetWorkerModelStatus

func GetWorkerModelStatus() ([]ModelStatus, error)

GetWorkerModelStatus retrieves from engine all worker model and their status

type OpenstackModelData

type OpenstackModelData struct {
	Image    string `json:"os"`
	Flavor   string `json:"flavor"`
	UserData string `json:"user_data"`
}

OpenstackModelData type details the "Image" field of Openstack type model

type Parameter

type Parameter struct {
	ID          int64         `json:"id" yaml:"-"`
	Name        string        `json:"name"`
	Type        ParameterType `json:"type"`
	Value       string        `json:"value"`
	Description string        `json:"description" yaml:"desc,omitempty"`
}

Parameter can be a String/Date/Script/URL...

func NewStringParameter

func NewStringParameter(s string) (Parameter, error)

NewStringParameter creates a Parameter from a string with <name>=<value> format

func ShowParameterInPipeline

func ShowParameterInPipeline(projectKey, pipelineName string) ([]Parameter, error)

ShowParameterInPipeline show parameters for a pipeline

type ParameterType

type ParameterType string

ParameterType defines the types of parameter of a pipeline or a action

const (
	EnvironmentParameter ParameterType = "env"
	PipelineParameter    ParameterType = "pipeline"
	ListParameter        ParameterType = "list"
	NumberParameter      ParameterType = "number"
	StringParameter      ParameterType = "string"
	TextParameter        ParameterType = "text"
	BooleanParameter     ParameterType = "boolean"
)

Different type of Parameter

func ParameterTypeFromString

func ParameterTypeFromString(in string) ParameterType

ParameterTypeFromString returns a parameter Type from a given string

func (ParameterType) String

func (t ParameterType) String() string

type Pipeline

type Pipeline struct {
	ID                  int64             `json:"id" yaml:"-"`
	Name                string            `json:"name"`
	Type                PipelineType      `json:"type"`
	ProjectKey          string            `json:"projectKey"`
	ProjectID           int64             `json:"-"`
	LastPipelineBuild   *PipelineBuild    `json:"last_pipeline_build"`
	Stages              []Stage           `json:"stages"`
	GroupPermission     []GroupPermission `json:"groups,omitempty"`
	Parameter           []Parameter       `json:"parameters,omitempty"`
	AttachedApplication []Application     `json:"attached_application,omitempty"`
	Permission          int               `json:"permission"`
	LastModified        int64             `json:"last_modified"`
}

Pipeline represents the complete behavior of CDS for each projects

func GetPipeline

func GetPipeline(key, name string) (*Pipeline, error)

GetPipeline retrieves pipeline definition from CDS

func ListApplicationPipeline

func ListApplicationPipeline(projectKey, appName string) ([]Pipeline, error)

ListApplicationPipeline list all pipelines attached to the application

func ListPipelines

func ListPipelines(projectKey string) ([]Pipeline, error)

ListPipelines retrieves all available pipelines to called

type PipelineAction

type PipelineAction struct {
	ActionName      string      `json:"actionName"`
	Args            []Parameter `json:"args"`
	PipelineStageID int64       `json:"pipeline_stage_id"`
}

PipelineAction represents an action in a pipeline

type PipelineBuild

type PipelineBuild struct {
	ID          int64       `json:"id"`
	BuildNumber int64       `json:"build_number"`
	Version     int64       `json:"version"`
	Parameters  []Parameter `json:"parameters"`
	Status      Status      `json:"status"`
	Start       time.Time   `json:"start,omitempty"`
	Done        time.Time   `json:"done,omitempty"`
	Stages      []Stage     `json:"stages"`

	Pipeline    Pipeline    `json:"pipeline"`
	Application Application `json:"application"`
	Environment Environment `json:"environment"`

	Artifacts             []Artifact           `json:"artifacts,omitempty"`
	Tests                 *Tests               `json:"tests,omitempty"`
	Commits               []VCSCommit          `json:"commits,omitempty"`
	Trigger               PipelineBuildTrigger `json:"trigger"`
	PreviousPipelineBuild *PipelineBuild       `json:"previous_pipeline_build"`
}

PipelineBuild Struct for history table

func GetBuildState

func GetBuildState(projectKey, appName, pipelineName, env, buildID string) (PipelineBuild, error)

GetBuildState Get the state of given build

func GetBuildingPipelineByHash

func GetBuildingPipelineByHash(hash string) ([]PipelineBuild, error)

GetBuildingPipelineByHash retrieves pipeline building a specific commit hash

func GetBuildingPipelines

func GetBuildingPipelines() ([]PipelineBuild, error)

GetBuildingPipelines retrieves all building pipelines

func GetPipelineBuildHistory

func GetPipelineBuildHistory(key, appName, name, env string) ([]PipelineBuild, error)

GetPipelineBuildHistory retrieves recent build history for given pipeline

func GetPipelineBuildStatus

func GetPipelineBuildStatus(proj, app, pip, env string, buildNumber int64) (PipelineBuild, error)

GetPipelineBuildStatus retrieves current build information. With buildNumber at 0, fetch last build

type PipelineBuildTrigger

type PipelineBuildTrigger struct {
	ScheduledTrigger    bool           `json:"scheduled_trigger"`
	ManualTrigger       bool           `json:"manual_trigger"`
	TriggeredBy         *User          `json:"triggered_by"`
	ParentPipelineBuild *PipelineBuild `json:"parent_pipeline_build"`
	VCSChangesBranch    string         `json:"vcs_branch"`
	VCSChangesHash      string         `json:"vcs_hash"`
	VCSChangesAuthor    string         `json:"vcs_author"`
}

PipelineBuildTrigger Struct for history table

type PipelineGroup

type PipelineGroup struct {
	Pipeline   Pipeline `json:"pipeline"`
	Permission int      `json:"permission"`
}

PipelineGroup represent a link with a pipeline

type PipelineScheduler

type PipelineScheduler struct {
	ID              int64                       `json:"id" db:"id"`
	ApplicationID   int64                       `json:"-" db:"application_id"`
	PipelineID      int64                       `json:"-" db:"pipeline_id"`
	EnvironmentID   int64                       `json:"-" db:"environment_id"`
	EnvironmentName string                      `json:"environment_name" db:"-"`
	Args            []Parameter                 `json:"args,omitempty" db:"-"`
	Crontab         string                      `json:"crontab,omitempty" db:"crontab"`
	Disabled        bool                        `json:"disable" db:"disable"`
	LastExecution   *PipelineSchedulerExecution `json:"last_execution" db:"-"`
	NextExecution   *PipelineSchedulerExecution `json:"next_execution" db:"-"`
}

PipelineScheduler is a cron scheduler

func AddPipelineScheduler

func AddPipelineScheduler(projectKey, appName, pipelineName, cronExpr, envName string, params []Parameter) (*PipelineScheduler, error)

AddPipelineScheduler add a pipeline scheduler

func GetPipelineScheduler

func GetPipelineScheduler(projectKey, appName, pipelineName string) ([]PipelineScheduler, error)

GetPipelineScheduler returns all pipeline scheduler

func UpdatePipelineScheduler

func UpdatePipelineScheduler(projectKey, appName, pipelineName string, s *PipelineScheduler) (*PipelineScheduler, error)

UpdatePipelineScheduler update a pipeline scheduler

type PipelineSchedulerExecution

type PipelineSchedulerExecution struct {
	ID                   int64      `json:"id" db:"id"`
	PipelineSchedulerID  int64      `json:"-" db:"pipeline_scheduler_id"`
	ExecutionPlannedDate time.Time  `json:"execution_planned_date,omitempty" db:"execution_planned_date"`
	ExecutionDate        *time.Time `json:"execution_date" db:"execution_date"`
	Executed             bool       `json:"executed" db:"executed"`
	PipelineBuildVersion int64      `json:"pipeline_build_version" db:"pipeline_build_version"`
}

PipelineSchedulerExecution is a cron scheduler execution

type PipelineTrigger

type PipelineTrigger struct {
	ID int64 `json:"id"`

	SrcProject     Project     `json:"src_project" yaml:"-"`
	SrcApplication Application `json:"src_application" yaml:"-"`
	SrcPipeline    Pipeline    `json:"src_pipeline" yaml:"-"`
	SrcEnvironment Environment `json:"src_environment" yaml:"-"`

	DestProject     Project     `json:"dest_project" yaml:"-"`
	DestApplication Application `json:"dest_application" yaml:"-"`
	DestPipeline    Pipeline    `json:"dest_pipeline" yaml:"-"`
	DestEnvironment Environment `json:"dest_environment" yaml:"-"`

	Manual        bool           `json:"manual"`
	Parameters    []Parameter    `json:"parameters"`
	Prerequisites []Prerequisite `json:"prerequisites"`
	LastModified  int64          `json:"last_modified"`
}

PipelineTrigger represent a pipeline trigger

func GetTrigger

func GetTrigger(proj, app, pip string, id int64) (*PipelineTrigger, error)

GetTrigger gets an existing trigger

func GetTriggers

func GetTriggers(project, app, pipeline, env string) ([]PipelineTrigger, error)

GetTriggers retrieves all ouput triggers of a pipeline

func GetTriggersAsSource

func GetTriggersAsSource(project, app, pipeline, env string) ([]PipelineTrigger, error)

GetTriggersAsSource retrieves all ouput triggers of a pipeline

type PipelineType

type PipelineType string

PipelineType defines the purpose of a given pipeline

const (
	BuildPipeline      PipelineType = "build"
	DeploymentPipeline PipelineType = "deployment"
	TestingPipeline    PipelineType = "testing"
)

Different types of Pipeline

func PipelineTypeFromString

func PipelineTypeFromString(in string) PipelineType

PipelineTypeFromString returns the proper PipelineType

type Prerequisite

type Prerequisite struct {
	Parameter     string `json:"parameter"`
	ExpectedValue string `json:"expected_value"`
}

Prerequisite defines a expected value to one triggering pipeline parameter

func NewPrerequisite

func NewPrerequisite(s string) (Prerequisite, error)

NewPrerequisite creates a Prerequisite from a string with <name>=<expectedValue> format

type Project

type Project struct {
	ID            int64                 `json:"-" yaml:"-"`
	Key           string                `json:"key" yaml:"key"`
	Name          string                `json:"name" yaml:"name"`
	Pipelines     []Pipeline            `json:"pipelines,omitempty" yaml:"pipelines,omitempty"`
	Applications  []Application         `json:"applications,omitempty" yaml:"applications,omitempty"`
	ProjectGroups []GroupPermission     `json:"groups,omitempty" yaml:"permissions,omitempty"`
	Variable      []Variable            `json:"variables,omitempty" yaml:"variables,omitempty"`
	Environments  []Environment         `json:"environments,omitempty"  yaml:"environments,omitempty"`
	Permission    int                   `json:"permission"  yaml:"-"`
	LastModified  int64                 `json:"last_modified"  yaml:"-"`
	ReposManager  []RepositoriesManager `json:"repositories_manager"  yaml:"-"`
}

Project represent a team with group of users and pipelines

func GetProject

func GetProject(key string, mods ...Mod) (Project, error)

GetProject retrieves project informations from CDS

func ListProject

func ListProject(mods ...Mod) ([]Project, error)

ListProject returns all available project to caller

func NewProject

func NewProject(key string) *Project

NewProject instanciate a new NewProject

type ProjectGroup

type ProjectGroup struct {
	Project    Project `json:"project"`
	Permission int     `json:"permission"`
}

ProjectGroup represent a link with a project

type ProjectLastUpdates

type ProjectLastUpdates struct {
	Key          string `json:"key"`
	LastModified int64  `json:"last_modified"`
	Applications []struct {
		Name         string `json:"name"`
		LastModified int64  `json:"last_modified"`
	} `json:"applications"`
	Pipelines []struct {
		Name         string `json:"name"`
		LastModified int64  `json:"last_modified"`
	} `json:"pipelines"`
}

ProjectLastUpdates update times of project, application and pipelines

type RepositoriesManager

type RepositoriesManager struct {
	ID               int64                     `json:"id"`
	Consumer         RepositoriesManagerDriver `json:"-"`
	Type             RepositoriesManagerType   `json:"type"`
	Name             string                    `json:"name"`
	URL              string                    `json:"url"`
	HooksSupported   bool                      `json:"hooks_supported"`
	PollingSupported bool                      `json:"polling_supported"`
}

RepositoriesManager is the struct for every repositories manager. It can be stored in CDS DB in repositories_manager table

func AddReposManager

func AddReposManager(args map[string]string) (*RepositoriesManager, error)

AddReposManager add a new repositories manager in CDS

func GetProjectReposManager

func GetProjectReposManager(k string) ([]RepositoriesManager, error)

GetProjectReposManager returns connected repository manager for a specific project

func GetReposManager

func GetReposManager() ([]RepositoriesManager, error)

GetReposManager calls API to get list of repositories manager

type RepositoriesManagerClient

type RepositoriesManagerClient interface {
	//Repos
	Repos() ([]VCSRepo, error)
	RepoByFullname(fullname string) (VCSRepo, error)

	//Branches
	Branches(string) ([]VCSBranch, error)
	Branch(string, string) (VCSBranch, error)

	//Commits
	Commits(repo, branch, since, until string) ([]VCSCommit, error)
	Commit(repo, hash string) (VCSCommit, error)

	//Hooks
	CreateHook(repo, url string) error
	DeleteHook(repo, url string) error

	//Events
	PushEvents(repo string, dateRef time.Time) ([]VCSPushEvent, time.Duration, error)

	// Set build status on repository
	SetStatus(event Event) error
}

RepositoriesManagerClient is the client interface

type RepositoriesManagerDriver

type RepositoriesManagerDriver interface {
	AuthorizeRedirect() (string, string, error)
	AuthorizeToken(string, string) (string, string, error)
	GetAuthorized(string, string) (RepositoriesManagerClient, error)
	Data() string
	HooksSupported() bool
	PollingSupported() bool
}

RepositoriesManagerDriver is the consumer interface

type RepositoriesManagerType

type RepositoriesManagerType string

RepositoriesManagerType lists the different repositories manager currently planned to be supported

const (
	//Stash is valued to "STASH"
	Stash RepositoriesManagerType = "STASH"
	//Github is valued to "GITHUB"
	Github RepositoriesManagerType = "GITHUB"
)

type Repository

type Repository struct {
	URL  string
	Hook bool
}

Repository structs contains all needed information about a single repository

type RepositoryPoller

type RepositoryPoller struct {
	Name         string      `json:"name"`
	Application  Application `json:"application"`
	Pipeline     Pipeline    `json:"pipeline"`
	Enabled      bool        `json:"enabled"`
	DateCreation time.Time   `json:"date_creation"`
}

RepositoryPoller is an alternative to hooks

type RequestModifier

type RequestModifier func(req *http.Request)

RequestModifier is used to modify behavior of Request and Steam functions

func SetHeader

func SetHeader(key, value string) RequestModifier

SetHeader modify headers of http.Request

type Requirement

type Requirement struct {
	Name  string `json:"name"`
	Type  string `json:"type" yaml:"-"`
	Value string `json:"value" yaml:"-"`
}

Requirement can be : - a binary "which /usr/bin/docker" - a network access "telnet google.com 443"

func GetRequirements

func GetRequirements() ([]Requirement, error)

GetRequirements returns the list of all used requirements

type Result

type Result struct {
	ID      int64  `json:"id" yaml:"-"`
	BuildID int64  `json:"build_id" yaml:"build"`
	Status  Status `json:"status"`
	Version int64  `json:"version"`
}

Result refers to an build result after completion

type RunRequest

type RunRequest struct {
	Params              []Parameter `json:"parameters,omitempty"`
	Env                 Environment `json:"env,omitempty"`
	ParentBuildNumber   int64       `json:"parent_build_number,omitempty"`
	ParentPipelineID    int64       `json:"parent_pipeline_id,omitempty"`
	ParentEnvironmentID int64       `json:"parent_environment_id,omitempty"`
	ParentApplicationID int64       `json:"parent_application_id,omitempty"`
}

RunRequest Request to run a pipeline

type Stage

type Stage struct {
	ID            int64          `json:"id" yaml:"pipeline_stage_id"`
	Name          string         `json:"name"`
	PipelineID    int64          `json:"-" yaml:"-"`
	BuildOrder    int            `json:"build_order"`
	Enabled       bool           `json:"enabled"`
	Actions       []Action       `json:"actions"` // WIP: refacto to delete Actions and use Jobs
	ActionBuilds  []ActionBuild  `json:"builds"`
	Prerequisites []Prerequisite `json:"prerequisites"`
	LastModified  int64          `json:"last_modified"`
	Jobs          []Job          `json:"jobs"`
}

Stage Pipeline step that parallelize actions by order

func GetStage

func GetStage(projectKey, pipelineName, pipelineStageID string) (*Stage, error)

GetStage Get stage by ID

func NewStage

func NewStage(name string) *Stage

NewStage instanciate a new Stage

func (*Stage) FromJSON

func (s *Stage) FromJSON(data []byte) (*Stage, error)

FromJSON unmarshal given json data into Stage object

func (*Stage) JSON

func (s *Stage) JSON() string

JSON return the marshalled string of Stage object

type Stats

type Stats struct {
	History []Week
}

Stats aggregates all CDS stats

type Status

type Status string

Status reprensents a Build Action or Build Pipeline Status

const (
	StatusWaiting    Status = "Waiting"
	StatusChecking   Status = "Checking"
	StatusBuilding   Status = "Building"
	StatusSuccess    Status = "Success"
	StatusFail       Status = "Fail"
	StatusDisabled   Status = "Disabled"
	StatusNeverBuilt Status = "Never Built"
	StatusUnknown    Status = "Unknown"
	StatusSkipped    Status = "Skipped"
)

Action status in queue

func StatusFromString

func StatusFromString(in string) Status

StatusFromString returns a Status from a given string

func (Status) String

func (t Status) String() string

type Template

type Template struct {
	ID          int64           `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Params      []TemplateParam `json:"params"`
	Hook        bool            `json:"hook"`
}

Template definition to help users bootstrap their pipelines

func GetBuildTemplate

func GetBuildTemplate(name string) (*Template, error)

GetBuildTemplate Get the build template corresponding to the given name

func GetBuildTemplates

func GetBuildTemplates() ([]Template, error)

GetBuildTemplates retrieves all existing build template from API

func GetDeploymentTemplates

func GetDeploymentTemplates() ([]Template, error)

GetDeploymentTemplates retrieves all existing deployment template from API

type TemplateExtension

type TemplateExtension struct {
	ID          int64           `json:"id" db:"id"`
	Name        string          `json:"name" db:"name"`
	Type        string          `json:"type" db:"type"`
	Author      string          `json:"author" db:"author"`
	Description string          `json:"description" db:"description"`
	Identifier  string          `json:"identifier" db:"identifier"`
	Size        int64           `json:"-" db:"size"`
	Perm        uint32          `json:"-" db:"perm"`
	MD5Sum      string          `json:"md5sum" db:"md5sum"`
	ObjectPath  string          `json:"-" db:"object_path"`
	Filename    string          `json:"-" db:"-"`
	Path        string          `json:"-" db:"-"`
	Params      []TemplateParam `json:"params" db:"-"`
	Actions     []string        `json:"actions" db:"-"`
}

TemplateExtension represents a template store as a binary extension

func ListTemplates

func ListTemplates() ([]TemplateExtension, error)

ListTemplates returns all templates

func (*TemplateExtension) GetName

func (a *TemplateExtension) GetName() string

GetName returns the name of the template extension

func (*TemplateExtension) GetPath

func (a *TemplateExtension) GetPath() string

GetPath returns the storage path of the template extension

type TemplateParam

type TemplateParam struct {
	ID          int64        `json:"id" yaml:"-"`
	Name        string       `json:"name"`
	Type        VariableType `json:"type"`
	Value       string       `json:"value"`
	Description string       `json:"description" yaml:"desc,omitempty"`
}

TemplateParam can be a String/Date/Script/URL...

type Test

type Test struct {
	Name    string  `xml:"name,attr" json:"name"`
	Time    string  `xml:"time,attr" json:"time"`
	Failure string  `xml:"failure" json:"failure"`
	Error   string  `xml:"error" json:"error"`
	Skip    *string `xml:"skipped" json:"skipped"`
}

Test define a single test

type TestSuite

type TestSuite struct {
	Name     string `xml:"name,attr" json:"name"`
	Total    int    `xml:"tests,attr" json:"total"`
	Failures int    `xml:"failures,attr" json:"failures"`
	Errors   int    `xml:"errors,attr" json:"errors"`
	Skip     int    `xml:"skip,attr" json:"skipped"`
	Tests    []Test `xml:"testcase" json:"tests"`
}

TestSuite defines the result of a group of tests

type Tests

type Tests struct {
	PipelineBuildID int64       `json:"pipeline_build_id"`
	Total           int         `json:"total"`
	TotalOK         int         `json:"ok"`
	TotalKO         int         `json:"ko"`
	TotalSkipped    int         `json:"skipped"`
	TestSuites      []TestSuite `xml:"testsuite" json:"test_suites"`
}

Tests contains all informations about tests in a pipeline build

func GetTestResults

func GetTestResults(proj, app, pip, env string, bn int) (Tests, error)

GetTestResults retrieves tests results for a specific build

type User

type User struct {
	ID       int64   `json:"id" yaml:"-"`
	Username string  `json:"username" yaml:"username"`
	Fullname string  `json:"fullname" yaml:"fullname,omitempty"`
	Email    string  `json:"email" yaml:"email,omitempty"`
	Admin    bool    `json:"admin" yaml:"admin,omitempty"`
	Auth     Auth    `json:"-" yaml:"-"`
	Groups   []Group `json:"groups" yaml:"-"`
	Origin   string  `json:"origin" yaml:"origin,omitempty"`
}

User represent a CDS user.

func GetUser

func GetUser(username string) (*User, error)

GetUser return the given user

func ListUsers

func ListUsers() ([]User, error)

ListUsers returns all available user to caller

func Me added in v0.4.0

func Me() (*User, error)

Me returns user instance for connected user

func NewUser

func NewUser(username string) *User

NewUser instanciate a new User

func (*User) FromJSON

func (u *User) FromJSON(data []byte) (*User, error)

FromJSON unmarshal given json data into User object

func (*User) JSON

func (u *User) JSON() string

JSON return the marshalled string of User object

type UserAPIRequest

type UserAPIRequest struct {
	User     User   `json:"user"`
	Callback string `json:"callback"`
}

UserAPIRequest request for rest API

type UserAPIResponse

type UserAPIResponse struct {
	User     User   `json:"user"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
}

UserAPIResponse response from rest API

func LoginUser

func LoginUser(username, password string) (bool, *UserAPIResponse, error)

LoginUser call the /login handler

func VerifyUser

func VerifyUser(name, token string) (UserAPIResponse, error)

VerifyUser verify the token received by mail

type UserLoginRequest

type UserLoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

UserLoginRequest login request

type UserNotification

type UserNotification struct {
	ApplicationPipelineID int64                                                     `json:"application_pipeline_id"`
	Pipeline              Pipeline                                                  `json:"pipeline"`
	Environment           Environment                                               `json:"environment"`
	Notifications         map[UserNotificationSettingsType]UserNotificationSettings `json:"notifications"`
}

UserNotification is a settings on application_pipeline/env to trigger notification on pipeline event

type UserNotificationEventType

type UserNotificationEventType string

UserNotificationEventType always/never/change

const (
	UserNotificationAlways UserNotificationEventType = "always"
	UserNotificationNever  UserNotificationEventType = "never"
	UserNotificationChange UserNotificationEventType = "change"
)

const

type UserNotificationSettings

type UserNotificationSettings interface {
	Success() UserNotificationEventType
	Failure() UserNotificationEventType
	Start() bool
}

UserNotificationSettings are common settings

type UserNotificationSettingsType

type UserNotificationSettingsType string

UserNotificationSettingsType of notification

const (
	EmailUserNotification  UserNotificationSettingsType = "email"
	JabberUserNotification UserNotificationSettingsType = "jabber"
)

const

type UserNotificationTemplate

type UserNotificationTemplate struct {
	Subject string `json:"subject,omitempty"`
	Body    string `json:"body,omitempty"`
}

UserNotificationTemplate is the notification content

type UserToken

type UserToken struct {
	Token     string `json:"token"`
	Timestamp int64  `json:"timestamp"`
	Comment   string `json:"comment"`
}

UserToken for user persistent session

type VCSAuthor

type VCSAuthor struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Email       string `json:"emailAddress"`
	Avatar      string `json:"avatar"`
}

VCSAuthor represents the auhor for every commit

type VCSBranch

type VCSBranch struct {
	ID           string `json:"id"`
	DisplayID    string `json:"display_id"`
	LatestCommit string `json:"latest_commit"`
	Default      bool   `json:"default"`
}

VCSBranch reprensents branches known by the repositories manager

type VCSCommit

type VCSCommit struct {
	Hash      string    `json:"id"`
	Author    VCSAuthor `json:"author"`
	Timestamp int64     `json:"authorTimestamp"`
	Message   string    `json:"message"`
	URL       string    `json:"url"`
}

VCSCommit represents the commit in the repository

func GetPipelineCommits

func GetPipelineCommits(key, app, pip, env string, bn int) ([]VCSCommit, error)

GetPipelineCommits returns list of commit between this build and the previous one the same branch. If previous build is not available, it returns only the last commit for the branch

type VCSPushEvent

type VCSPushEvent struct {
	Branch VCSBranch `json:"branch"`
	Commit VCSCommit `json:"commit"`
}

VCSPushEvent represents a push events for polling

type VCSRepo

type VCSRepo struct {
	ID           string `json:"id"`
	Name         string `json:"name"`     //On Github: Name = Slug
	Slug         string `json:"slug"`     //On Github: Slug = Name
	Fullname     string `json:"fullname"` //On Stash : projectkey/slug, on Github : owner/slug
	URL          string `json:"url"`      //Web URL
	HTTPCloneURL string `json:"http_url"` //Git clone URL  "https://<baseURL>/scm/PRJ/my-repo.git"
	SSHCloneURL  string `json:"ssh_url"`  //Git clone URL  "ssh://git@<baseURL>/PRJ/my-repo.git"
}

VCSRepo represents data about repository even on stash, or github, etc...

func GetProjectReposFromReposManager

func GetProjectReposFromReposManager(k, n string) ([]VCSRepo, error)

GetProjectReposFromReposManager returns the repositories

type Variable

type Variable struct {
	ID    int64        `json:"id"`
	Name  string       `json:"name"`
	Value string       `json:"value"`
	Type  VariableType `json:"type"`
}

Variable represent a variable for a project or pipeline

func GetEnvironmentVariable

func GetEnvironmentVariable(projectKey, envName, varName string) (*Variable, error)

GetEnvironmentVariable Get a specific variable from the given environment

func GetVariableInApplication

func GetVariableInApplication(projectKey, appName, name string) (*Variable, error)

GetVariableInApplication Get a variable in the given application

func GetVariableInProject

func GetVariableInProject(projectKey, name string) (*Variable, error)

GetVariableInProject Get a variable by her name in the given project

func ShowApplicationVariable

func ShowApplicationVariable(projectKey, appName string) ([]Variable, error)

ShowApplicationVariable show variables for an application

func ShowEnvironmentVariable

func ShowEnvironmentVariable(projectKey, envName string) ([]Variable, error)

ShowEnvironmentVariable show variables for an environment

func ShowVariableInProject

func ShowVariableInProject(projectKey string) ([]Variable, error)

ShowVariableInProject show variables for a project

type VariableAudit

type VariableAudit struct {
	ID         int        `json:"id"`
	Variables  []Variable `json:"variables"`
	Versionned time.Time  `json:"versionned"`
	Author     string     `json:"author"`
}

VariableAudit represent audit for a variable

type VariableType

type VariableType string

VariableType defines the types of project, application and environment variable

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

Different type of Variable

func VariableTypeFromString

func VariableTypeFromString(in string) VariableType

VariableTypeFromString return a valid VariableType from a string Defaults to String

type Warning

type Warning struct {
	ID           int64             `json:"id"`
	Message      string            `json:"message"`
	MessageParam map[string]string `json:"message_param"`

	Action      Action      `json:"action"`
	StageID     int64       `json:"stage_id"`
	Project     Project     `json:"project"`
	Application Application `json:"application"`
	Pipeline    Pipeline    `json:"pipeline"`
	Environment Environment `json:"environment"`
}

Warning contains information about user action configuration

func GetWarnings

func GetWarnings() ([]Warning, error)

GetWarnings retrieves warnings related to Action accessible to caller

type Week

type Week struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`

	Builds               int64 `json:"builds_completed"`
	UnitTests            int64 `json:"unit_tests"`
	MaxBuildingWorkers   int64 `json:"max_building_worker"`
	MaxBuildingPipelines int64 `json:"max_building_pipeline"`

	Users    int64 `json:"period_total_users"`
	NewUsers int64 `json:"new_users"`

	Projects    int64 `json:"period_total_projects"`
	NewProjects int64 `json:"new_projects"`

	Applications    int64 `json:"period_total_applications"`
	NewApplications int64 `json:"new_applications"`

	Pipelines struct {
		Build   int64 `json:"build"`
		Testing int64 `json:"testing"`
		Deploy  int64 `json:"deploy"`
	} `json:"period_total_pipelines"`
	NewPipelines int64 `json:"new_pipelines"`

	RunnedPipelines struct {
		Build   int64 `json:"build"`
		Testing int64 `json:"testing"`
		Deploy  int64 `json:"deploy"`
	} `json:"runned_pipelines"`
}

Week exposes what happened in a week timeframe

type Worker

type Worker struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	LastBeat   time.Time `json:"-"`
	GroupID    int64     `json:"group_id"`
	Model      int64     `json:"model"`
	HatcheryID int64     `json:"hatchery_id"`
	Status     Status    `json:"status"` // Waiting, Building, Disabled, Unknown
}

Worker represents instances of CDS workers living to serve.

func GetWorkers

func GetWorkers(models ...string) ([]Worker, error)

GetWorkers retrieves from engine all worker the user has access to

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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