Documentation ¶
Index ¶
- type Dependencies
- type Hook
- type Payload
- type PipelineProvider
- func (pp *PipelineProvider) CreatePipeline(c echo.Context) error
- func (pp *PipelineProvider) CreatePipelineGetAll(c echo.Context) error
- func (pp *PipelineProvider) GetJobLogs(c echo.Context) error
- func (pp *PipelineProvider) GitWebHook(c echo.Context) error
- func (pp *PipelineProvider) PipelineCheckPeriodicSchedules(c echo.Context) error
- func (pp *PipelineProvider) PipelineDelete(c echo.Context) error
- func (pp *PipelineProvider) PipelineGet(c echo.Context) error
- func (pp *PipelineProvider) PipelineGetAll(c echo.Context) error
- func (pp *PipelineProvider) PipelineGetAllRuns(c echo.Context) error
- func (pp *PipelineProvider) PipelineGetAllWithLatestRun(c echo.Context) error
- func (pp *PipelineProvider) PipelineGetLatestRun(c echo.Context) error
- func (pp *PipelineProvider) PipelineGitLSRemote(c echo.Context) error
- func (pp *PipelineProvider) PipelineNameAvailable(c echo.Context) error
- func (pp *PipelineProvider) PipelinePull(c echo.Context) error
- func (pp *PipelineProvider) PipelineResetToken(c echo.Context) error
- func (pp *PipelineProvider) PipelineRunGet(c echo.Context) error
- func (pp *PipelineProvider) PipelineStart(c echo.Context) error
- func (pp *PipelineProvider) PipelineStop(c echo.Context) error
- func (pp *PipelineProvider) PipelineTrigger(c echo.Context) error
- func (pp *PipelineProvider) PipelineTriggerAuth(c echo.Context) error
- func (pp *PipelineProvider) PipelineUpdate(c echo.Context) error
- func (pp *PipelineProvider) SettingsPollGet(c echo.Context) error
- func (pp *PipelineProvider) SettingsPollOff(c echo.Context) error
- func (pp *PipelineProvider) SettingsPollOn(c echo.Context) error
- type PipelineProviderer
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct { Scheduler service.GaiaScheduler PipelineService pipeline.Servicer SettingsStore store.SettingsStore }
Dependencies define providers and services which this service needs.
type Payload ¶
type Payload struct {
Repo Repository `json:"repository"`
}
Payload contains information about the event like, user, commit id and so on. All we care about for the sake of identification is the repository.
type PipelineProvider ¶
type PipelineProvider struct {
// contains filtered or unexported fields
}
PipelineProvider is a provider for all pipeline related operations.
func NewPipelineProvider ¶
func NewPipelineProvider(deps Dependencies) *PipelineProvider
NewPipelineProvider creates a new provider with the needed dependencies.
func (*PipelineProvider) CreatePipeline ¶
func (pp *PipelineProvider) CreatePipeline(c echo.Context) error
CreatePipeline accepts all data needed to create a pipeline. It then starts the create pipeline execution process async. @Summary Create pipeline. @Description Starts creating a pipeline given all the data asynchronously. @Tags pipelines @Accept json @Produce plain @Security ApiKeyAuth @Param CreatePipelineRequest body gaia.CreatePipeline true "Create pipeline details" @Success 200 @Failure 400 {string} string "Failed to bind, validation error and invalid details" @Failure 500 {string} string "Internal error while saving create pipeline run" @Router /pipeline [post]
func (*PipelineProvider) CreatePipelineGetAll ¶
func (pp *PipelineProvider) CreatePipelineGetAll(c echo.Context) error
CreatePipelineGetAll returns a json array of all pipelines which are about to get compiled and all pipelines which have been compiled. @Summary Get all create pipelines. @Description Get a list of all pipelines which are about to be compiled and which have been compiled. @Tags pipelines @Produce json @Security ApiKeyAuth @Success 200 {array} gaia.CreatePipeline @Failure 500 {string} string "Internal error while retrieving create pipeline data." @Router /pipeline/created [get]
func (*PipelineProvider) GetJobLogs ¶
func (pp *PipelineProvider) GetJobLogs(c echo.Context) error
GetJobLogs returns logs from a pipeline run.
Required parameters: pipelineid - Related pipeline id pipelinerunid - Related pipeline run id @Summary Get logs for pipeline run. @Description Returns logs from a pipeline run. @Tags pipelinerun @Accept plain @Produce json @Security ApiKeyAuth @Param pipelineid query string true "ID of the pipeline" @Param runid query string true "ID of the run" @Success 200 {object} jobLogs "logs" @Failure 400 {string} string "Invalid pipeline id or run id or pipeline not found" @Failure 500 {string} string "cannot read pipeline run log file" @Router /pipelinerun/{pipelineid}/{runid}/log [get]
func (*PipelineProvider) GitWebHook ¶
func (pp *PipelineProvider) GitWebHook(c echo.Context) error
GitWebHook handles callbacks from GitHub's webhook system. @Summary Handle github webhook callbacks. @Description This is the global endpoint which will handle all github webhook callbacks. @Tags pipelines @Accept json @Produce plain @Param payload body Payload true "A github webhook payload" @Success 200 {string} string "successfully processed event" @Failure 400 {string} string "Bind error and schedule errors" @Failure 500 {string} string "Various internal errors running and triggering and rebuilding pipelines. Please check the logs for more information." @Router /pipeline/githook [post]
func (*PipelineProvider) PipelineCheckPeriodicSchedules ¶
func (pp *PipelineProvider) PipelineCheckPeriodicSchedules(c echo.Context) error
PipelineCheckPeriodicSchedules validates the added periodic schedules. @Summary Returns the latest run. @Description Returns the latest of all registered pipelines included with the latest run. @Tags pipelines @Accept json @Produce json @Security ApiKeyAuth @Param schedules body []string true "A list of valid cronjob specs" @Success 200 @Failure 400 {string} string "Bind error and schedule errors" @Router /pipeline/periodicschedules [post]
func (*PipelineProvider) PipelineDelete ¶
func (pp *PipelineProvider) PipelineDelete(c echo.Context) error
PipelineDelete accepts a pipeline id and deletes it from the store. It also removes the binary inside the pipeline folder. @Summary Delete a pipeline. @Description Accepts a pipeline id and deletes it from the store. It also removes the binary inside the pipeline folder. @Tags pipelines @Accept plain @Produce plain @Security ApiKeyAuth @Param pipelineid query string true "The ID of the pipeline." @Success 200 {string} string "Pipeline has been deleted" @Failure 400 {string} string "Error while deleting the pipeline" @Failure 404 {string} string "The pipeline with the given ID was not found" @Failure 500 {string} string "Internal error while deleting and removing the pipeline from store and disk" @Router /pipeline/{pipelineid} [delete]
func (*PipelineProvider) PipelineGet ¶
func (pp *PipelineProvider) PipelineGet(c echo.Context) error
PipelineGet accepts a pipeline id and returns the pipeline object. @Summary Get pipeline information. @Description Get pipeline information based on ID. @Tags pipelines @Accept plain @Produce json @Security ApiKeyAuth @Param pipelineid query string true "The ID of the pipeline" @Success 200 {object} gaia.Pipeline @Failure 400 {string} string "The given pipeline id is not valid" @Failure 404 {string} string "Pipeline not found with the given id" @Router /pipeline/{pipelineid} [get]
func (*PipelineProvider) PipelineGetAll ¶
func (pp *PipelineProvider) PipelineGetAll(c echo.Context) error
PipelineGetAll returns all registered pipelines. @Summary Returns all registered pipelines. @Description Returns all registered pipelines. @Tags pipelines @Produce json @Security ApiKeyAuth @Success 200 {array} gaia.Pipeline @Router /pipeline/name [get]
func (*PipelineProvider) PipelineGetAllRuns ¶
func (pp *PipelineProvider) PipelineGetAllRuns(c echo.Context) error
PipelineGetAllRuns returns all runs about the given pipeline. @Summary Get all pipeline runs. @Description Returns all runs about the given pipeline. @Tags pipelinerun @Accept plain @Produce json @Security ApiKeyAuth @Param pipelineid query string true "ID of the pipeline" @Success 200 {array} gaia.PipelineRun "a list of pipeline runes" @Failure 400 {string} string "Invalid pipeline id" @Failure 500 {string} string "Error retrieving all pipeline runs." @Router /pipelinerun/{pipelineid} [get]
func (*PipelineProvider) PipelineGetAllWithLatestRun ¶
func (pp *PipelineProvider) PipelineGetAllWithLatestRun(c echo.Context) error
PipelineGetAllWithLatestRun returns the latest of all registered pipelines included with the latest run. @Summary Returns the latest run. @Description Returns the latest of all registered pipelines included with the latest run. @Tags pipelines @Produce json @Security ApiKeyAuth @Success 200 {object} getAllWithLatestRun @Failure 500 {string} string "Internal error while getting latest run" @Router /pipeline/latest [get]
func (*PipelineProvider) PipelineGetLatestRun ¶
func (pp *PipelineProvider) PipelineGetLatestRun(c echo.Context) error
PipelineGetLatestRun returns the latest run of a pipeline, given by id. @Summary Get latest pipeline runs. @Description Returns the latest run of a pipeline, given by id. @Tags pipelinerun @Accept plain @Produce json @Security ApiKeyAuth @Param pipelineid query string true "ID of the pipeline" @Success 200 {object} gaia.PipelineRun "the latest pipeline run" @Failure 400 {string} string "Invalid pipeline id" @Failure 500 {string} string "error getting latest run or cannot read pipeline run log file" @Router /pipelinerun/{pipelineid}/latest [get]
func (*PipelineProvider) PipelineGitLSRemote ¶
func (pp *PipelineProvider) PipelineGitLSRemote(c echo.Context) error
PipelineGitLSRemote checks for available git remote branches. This is the perfect way to check if we have access to a given repo. @Summary Check for repository access. @Description Checks for available git remote branches which in turn verifies repository access. @Tags pipelines @Accept json @Produce json @Security ApiKeyAuth @Param PipelineGitLSRemoteRequest body gaia.GitRepo true "The repository details" @Success 200 {array} string "Available branches" @Failure 400 {string} string "Failed to bind body" @Failure 403 {string} string "No access" @Router /pipeline/gitlsremote [post]
func (*PipelineProvider) PipelineNameAvailable ¶
func (pp *PipelineProvider) PipelineNameAvailable(c echo.Context) error
PipelineNameAvailable looks up if the given pipeline name is available and valid. @Summary Pipeline name validation. @Description Looks up if the given pipeline name is available and valid. @Tags pipelines @Accept plain @Produce json @Security ApiKeyAuth @Param name query string true "The name of the pipeline to validate" @Success 200 @Failure 400 {string} string "Pipeline name validation errors" @Router /pipeline/name [get]
func (*PipelineProvider) PipelinePull ¶
func (pp *PipelineProvider) PipelinePull(c echo.Context) error
PipelinePull does a pull on the remote repository which contains the code for this pipeline. This is so the user won't have to wait for polling or a hook. @Summary Update the underlying repository of the pipeline. @Description Pull new code using the repository of the pipeline. @Tags pipelines @Accept plain @Produce plain @Security ApiKeyAuth @Param pipelineid query string true "The ID of the pipeline." @Success 200 @Failure 400 {string} string @Router /pipeline/{pipelineid}/pull [post]
func (*PipelineProvider) PipelineResetToken ¶
func (pp *PipelineProvider) PipelineResetToken(c echo.Context) error
PipelineResetToken generates a new remote trigger token for a given pipeline. @Summary Reset trigger token. @Description Generates a new remote trigger token for a given pipeline. @Tags pipelines @Accept plain @Produce plain @Security ApiKeyAuth @Param pipelineid query string true "The ID of the pipeline." @Success 200 {string} string "Trigger successful for pipeline: {pipelinename}" @Failure 400 {string} string "Invalid pipeline id" @Failure 404 {string} string "Pipeline not found" @Failure 500 {string} string "Internal storage error" @Router /pipeline/{pipelineid}/reset-trigger-token [put]
func (*PipelineProvider) PipelineRunGet ¶
func (pp *PipelineProvider) PipelineRunGet(c echo.Context) error
PipelineRunGet returns details about a specific pipeline run. Required parameters are pipelineid and runid. @Summary Get Pipeline run. @Description Returns details about a specific pipeline run. @Tags pipelinerun @Accept plain @Produce json @Security ApiKeyAuth @Param pipelineid query string true "ID of the pipeline" @Param runid query string true "ID of the pipeline run" @Success 200 {object} gaia.PipelineRun @Failure 400 {string} string "Invalid pipeline or pipeline not found." @Failure 404 {string} string "Pipeline Run not found." @Failure 500 {string} string "Something went wrong while getting pipeline run." @Router /pipelinerun/{pipelineid}/{runid} [get]
func (*PipelineProvider) PipelineStart ¶
func (pp *PipelineProvider) PipelineStart(c echo.Context) error
PipelineStart starts a pipeline by the given id. It accepts arguments for the given pipeline. Afterwards it returns the created/scheduled pipeline run. @Summary Start a pipeline. @Description Starts a pipeline with a given ID and arguments for that pipeline and returns created/scheduled status. @Tags pipelines @Accept json @Produce json @Security ApiKeyAuth @Param pipelineid query string true "The ID of the pipeline." @Param args body gaia.Argument false "Optional arguments of the pipeline." @Success 200 {object} gaia.PipelineRun @Failure 400 {string} string "Various failures regarding starting the pipeline like: invalid id, invalid docker value and schedule errors" @Failure 404 {string} string "Pipeline not found" @Router /pipeline/{pipelineid}/start [post]
func (*PipelineProvider) PipelineStop ¶
func (pp *PipelineProvider) PipelineStop(c echo.Context) error
PipelineStop stops a running pipeline. @Summary Stop a pipeline run. @Description Stops a pipeline run. @Tags pipelinerun @Accept plain @Produce plain @Security ApiKeyAuth @Param pipelineid query string true "ID of the pipeline" @Param runid query string true "ID of the pipeline run" @Success 200 {string} string "pipeline successfully stopped" @Failure 400 {string} string "Invalid pipeline id or run id" @Failure 404 {string} string "Pipeline Run not found." @Router /pipelinerun/{pipelineid}/{runid}/stop [post]
func (*PipelineProvider) PipelineTrigger ¶
func (pp *PipelineProvider) PipelineTrigger(c echo.Context) error
PipelineTrigger allows for a remote running of a pipeline. This endpoint does not require authentication. It will use a TOKEN that is specific to a pipeline. It can only be used by the `auto` user. @Summary Trigger a pipeline. @Description Using a trigger token, start a pipeline run. This endpoint does not require authentication. @Tags pipelines @Accept plain @Produce plain @Param pipelineid query string true "The ID of the pipeline." @Param pipelinetoken query string true "The trigger token for this pipeline." @Success 200 {string} string "Trigger successful for pipeline: {pipelinename}" @Failure 400 {string} string "Error while triggering pipeline" @Failure 403 {string} string "Invalid trigger token" @Router /pipeline/{pipelineid}/{pipelinetoken}/trigger [post]
func (*PipelineProvider) PipelineTriggerAuth ¶
func (pp *PipelineProvider) PipelineTriggerAuth(c echo.Context) error
PipelineTriggerAuth is a barrier before remote trigger which checks if the user is `auto`.
func (*PipelineProvider) PipelineUpdate ¶
func (pp *PipelineProvider) PipelineUpdate(c echo.Context) error
PipelineUpdate updates the given pipeline. @Summary Update pipeline. @Description Update a pipeline by its ID. @Tags pipelines @Accept json @Produce json @Security ApiKeyAuth @Param PipelineUpdateRequest body gaia.Pipeline true "PipelineUpdate request" @Success 200 {string} string "Pipeline has been updated" @Failure 400 {string} string "Error while updating the pipeline" @Failure 404 {string} string "The pipeline with the given ID was not found" @Failure 500 {string} string "Internal error while updating and building the new pipeline information" @Router /pipeline/{pipelineid} [put]
func (*PipelineProvider) SettingsPollGet ¶
func (pp *PipelineProvider) SettingsPollGet(c echo.Context) error
SettingsPollGet get status of polling functionality. @Summary Get the status of the poll setting. @Description Gets the status of the poll setting. @Tags settings @Produce json @Security ApiKeyAuth @Success 200 {object} pollStatus "Poll status" @Failure 500 {string} string "Internal server error while getting setting." @Router /settings/poll [get]
func (*PipelineProvider) SettingsPollOff ¶
func (pp *PipelineProvider) SettingsPollOff(c echo.Context) error
SettingsPollOff turn off polling functionality. @Summary Turn off polling functionality. @Description Turns off the polling functionality for Gaia which periodically checks if there is new code to deploy for all pipelines. @Tags settings @Produce plain @Security ApiKeyAuth @Success 200 {string} string "Polling is turned off." @Failure 400 {string} string "Error while toggling poll setting." @Failure 500 {string} string "Internal server error while getting setting." @Router /settings/poll/off [post]
func (*PipelineProvider) SettingsPollOn ¶
func (pp *PipelineProvider) SettingsPollOn(c echo.Context) error
SettingsPollOn turn on polling functionality @Summary Turn on polling functionality. @Description Turns on the polling functionality for Gaia which periodically checks if there is new code to deploy for all pipelines. @Tags settings @Produce plain @Security ApiKeyAuth @Success 200 {string} string "Polling is turned on." @Failure 400 {string} string "Error while toggling poll setting." @Failure 500 {string} string "Internal server error while getting setting." @Router /settings/poll/on [post]
type PipelineProviderer ¶
type PipelineProviderer interface { PipelineGitLSRemote(c echo.Context) error CreatePipeline(c echo.Context) error CreatePipelineGetAll(c echo.Context) error PipelineNameAvailable(c echo.Context) error PipelineGet(c echo.Context) error PipelineGetAll(c echo.Context) error PipelineUpdate(c echo.Context) error PipelinePull(c echo.Context) error PipelineDelete(c echo.Context) error PipelineTrigger(c echo.Context) error PipelineResetToken(c echo.Context) error PipelineTriggerAuth(c echo.Context) error PipelineStart(c echo.Context) error PipelineGetAllWithLatestRun(c echo.Context) error PipelineCheckPeriodicSchedules(c echo.Context) error PipelineStop(c echo.Context) error PipelineRunGet(c echo.Context) error PipelineGetAllRuns(c echo.Context) error PipelineGetLatestRun(c echo.Context) error GetJobLogs(c echo.Context) error GitWebHook(c echo.Context) error SettingsPollOn(c echo.Context) error SettingsPollOff(c echo.Context) error SettingsPollGet(c echo.Context) error }
PipelineProviderer defines functionality which this provider provides. These are used by the handler service.
type Repository ¶
type Repository struct { GitURL string `json:"git_url"` SSHURL string `json:"ssh_url"` HTMLURL string `json:"html_url"` }
Repository contains information about the repository. All we care about here are the possible urls for identification.