hooks

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 52 Imported by: 1

README

CDS Hooks µService

Introduction

CDS Hooks µService is the component designed to run all workflow hooks.

Following hooks are supported:

  • Webhook
  • Scheduler

Following will be supported:

  • Kafka Listener
  • GitHub, GitLab, Bitbucket Poller

Design

All hooks are considered as task. Tasks are synchronized on startup with workflow hooks from CDS API, and added on the fly when CDS API call this µService.

When a hook is invocated or have to be invocated, we talk about task execution.

Task execution are managed by an internal scheduler Service.runScheduler(context.Context). The scheduler is design in three parts:

  • the task execution processor Service.dequeueTaskExecutions(context.Context): To feed it, we have to push a task execution key in the queue hooks:scheduler:queue.
  • the task execution retry Service.retryTaskExecutionsRoutine(context.Context): Which checks all executions to push in the queue hooks:scheduler:queue the not processed task execution
  • the task execution cleaner Service.deleteTaskExecutionsRoutine(context.Context): Which removes old task executions.

Storage

Task list and definitions are stored in the Cache (Redis or local). The key hooks:tasks is a Sorted Set containing tasks UUID sorted by timestamp creation. Each task is stored as JSON in a key hooks:tasks:<UUID>.

When a task is or have to be invocated, the task execution of the task is listed in a Sorted Set (sorted by timestamp of task execution): hooks:tasks:executions:<type>:<UUID>; this set contains the list of all timestamp on task execution. The detail of an task execution is stored as JSON in. The task execution key is hooks:tasks:executions:<type>:<UUID>:<timestamp>

API

Following routes are available:

  • GET|POST|PUT|DELETE /webhook/{uuid}: Routes available for the webhooks. No authentication.

  • POST /task: Create a new task from a CDS sdk.WorkflowNodeHook. Authentication: Header X_AUTH_HEADER: <Service Hash> in base64

  • GET|PUT|DELETE /task/{uuid}: Get, Update or Delete a task. Authentication: Header X_AUTH_HEADER: <Service Hash> in base64

  • GET /task/{uuid}/execution: Get all task execution. Authentication: Header X_AUTH_HEADER: <Service Hash> in base64

Authentication

The µService is run with a shared.infra token and register on CDS API; on registration, CDS API gives in response a hash (service hash) which must be used to make every call to CDS API. Every 30 seconds, it heartbeats on CDS API.

How to implement a new type of hook?

All the specific code for each type of hook (task) is in the tasks.go file.

  1. Declare a new const for the type
  2. Update hookToTask function which convert a CDS sdk.WorkflowNodeHook to a task
  3. Update startTask function if you have some thing special to do to start or prepare the next task execution
  4. Update stopTask function if you have some thing special to do to stop a task
  5. Update doTask function and create a do<your-stuff>Execution function with your business

Documentation

Index

Constants

View Source
const (
	MaintenanceHookKey   = "cds_maintenance_hook"
	MaintenanceHookQueue = "cds_maintenance_queue_hook"
)
View Source
const (
	TypeRepoManagerWebHook = "RepoWebHook"
	TypeWebHook            = "Webhook"
	TypeScheduler          = "Scheduler"
	TypeRepoPoller         = "RepoPoller"
	TypeKafka              = "Kafka"
	TypeGerrit             = "Gerrit"
	TypeRabbitMQ           = "RabbitMQ"
	TypeWorkflowHook       = "Workflow"
	TypeOutgoingWebHook    = "OutgoingWebhook"
	TypeOutgoingWorkflow   = "OutgoingWorkflow"

	GithubHeader         = "X-Github-Event"
	GitlabHeader         = "X-Gitlab-Event"
	BitbucketHeader      = "X-Event-Key"
	BitbucketCloudHeader = "X-Event-Key_Cloud" // Fake header, do not use to fetch header, just to return custom header
	GiteaHeader          = "X-Gitea-Event"

	ConfigNumber    = "Number"
	ConfigSubNumber = "SubNumber"
	ConfigHookID    = "HookID"
	ConfigHookRunID = "HookRunID"
)

This are all the types

View Source
const (
	GerritChangeStatusNew       = "NEW"
	GerritChangeStatusMerged    = "MERGED"
	GerritChangeStatusAbandoned = "ABANDONED"

	GerritPatchSetKindRework                 = "REWORK"
	GerritPatchSetKindTrivialRebase          = "TRIVIAL_REBASE"
	GerritPatchSetKindMergeFirstParentUpdate = "MERGE_FIRST_PARENT_UPDATE"
	GerritPatchSetKindNoCodeChange           = "NO_CODE_CHANGE"
	GerritPatchSetKindNoChange               = "NO_CHANGE"

	GerritFileTypeAdded    = "ADDED"
	GerritFileTypeModified = "MODIFIED"
	GerritFileTypeDeleted  = "DELETED"
	GerritFileTypeRenamed  = "RENAMED"
	GerritFileTypeCopied   = "COPIED"
	GerritFileTypeRewrite  = "REWRITE"

	GerritSubmitRecordStatusOk        = "OK"
	GerritSubmitRecordStatusNotReady  = "NOT_READY"
	GerritSubmitRecordStatusRuleError = "RULE_ERROR"

	GerritLabelStatusOk         = "OK"
	GerritLabelStatusReject     = "REJECT"
	GerritLabelStatusNeed       = "NEED"
	GerritLabelStatusMay        = "MAY"
	GerritLabelStatusImpossible = "IMPOSSIBLE"

	GerritEmptyRef = "0000000000000000000000000000000000000000"

	GerritEventTypeAssignedChanged     = "assignee-changed"
	GerritEventTypeChangeAbandoned     = "change-abandoned"
	GerritEventTypeChangeDeleted       = "change-deleted"
	GerritEventTypeChangeMerged        = "change-merged"
	GerritEventTypeChangeRestored      = "change-restored"
	GerritEventTypeCommentAdded        = "comment-added"
	GerritEventTypeDrafPublished       = "draft-published"
	GerritEventTypeDroppedOutput       = "dropped-output"
	GerritEventTypeHashTagsChanged     = "hashtags-changed"
	GerritEventTypeProjectCreated      = "project-created"
	GerritEventTypePatchsetCreated     = "patchset-created"
	GerritEventTypeRefUpdated          = "ref-updated"
	GerritEventTypeReviewerAdded       = "reviewer-added"
	GerritEventTypeReviewerDelete      = "reviewer-deleted"
	GerritEventTypeTopicChanged        = "topic-changed"
	GerritEventTypeWIPStateChanged     = "wip-state-changed"
	GerritEventTypePrivateStateChanged = "private-state-changed"
	GerritEventTypeVoteDeleted         = "vote-deleted"
)
View Source
const (
	TaskExecutionEnqueued  = "ENQUEUED"
	TaskExecutionDoing     = "DOING"
	TaskExecutionDone      = "DONE"
	TaskExecutionScheduled = "SCHEDULED"
)

Task execution status

View Source
const (
	PR_ID              = "git.pr.id"
	PR_TITLE           = "git.pr.title"
	PR_STATE           = "git.pr.state"
	PR_PREVIOUS_TITLE  = "git.pr.previous.title"
	PR_PREVIOUS_BRANCH = "git.pr.previous.branch"
	PR_PREVIOUS_HASH   = "git.pr.previous.hash"
	PR_PREVIOUS_STATE  = "git.pr.previous.state"

	PR_REVIEWER        = "git.pr.reviewer"
	PR_REVIEWER_EMAIL  = "git.pr.reviewer.email"
	PR_REVIEWER_STATUS = "git.pr.reviewer.status"
	PR_REVIEWER_ROLE   = "git.pr.reviewer.role"

	PR_COMMENT_TEXT          = "git.pr.comment"
	PR_COMMENT_TEXT_PREVIOUS = "git.pr.comment.before"
	PR_COMMENT_AUTHOR        = "git.pr.comment.author"
	PR_COMMENT_AUTHOR_EMAIL  = "git.pr.comment.author.email"

	GIT_AUTHOR            = "git.author"
	GIT_AUTHOR_EMAIL      = "git.author.email"
	GIT_BRANCH            = "git.branch"
	GIT_BRANCH_BEFORE     = "git.branch.before"
	GIT_BRANCH_DEST       = "git.branch.dest"
	GIT_TAG               = "git.tag"
	GIT_HASH_BEFORE       = "git.hash.before"
	GIT_HASH              = "git.hash"
	GIT_HASH_DEST         = "git.hash.dest"
	GIT_HASH_SHORT        = "git.hash.short"
	GIT_REPOSITORY        = "git.repository"
	GIT_REPOSITORY_BEFORE = "git.repository.before"
	GIT_REPOSITORY_DEST   = "git.repository.dest"
	GIT_EVENT             = "git.hook"
	GIT_MESSAGE           = "git.message"

	CDS_TRIGGERED_BY_USERNAME = "cds.triggered_by.username"
	CDS_TRIGGERED_BY_FULLNAME = "cds.triggered_by.fullname"
	CDS_TRIGGERED_BY_EMAIL    = "cds.triggered_by.email"

	PAYLOAD = "payload"
)
View Source
const (
	RetryDelayMilli = 120000
)

Variables

This section is empty.

Functions

func CheckWebhookRequestSignatureMiddleware added in v0.52.0

func CheckWebhookRequestSignatureMiddleware(pubKey *rsa.PublicKey) service.Middleware

func ListenGerritStreamEvent

func ListenGerritStreamEvent(ctx context.Context, store cache.Store, goRoutines *sdk.GoRoutines, vcsGerritConfig sdk.VCSGerritConfiguration, gerritEventChan chan<- GerritEvent) error

ListenGerritStreamEvent listen the gerrit event stream

Types

type BitbucketCloudActor

type BitbucketCloudActor struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	UUID        string `json:"uuid"`
	Links       struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
	} `json:"links"`
	Nickname  string `json:"nickname"`
	Type      string `json:"type"`
	AccountID string `json:"account_id"`
}

type BitbucketCloudChange

type BitbucketCloudChange struct {
	Forced bool `json:"forced"`
	Old    struct {
		Name  string `json:"name"`
		Links struct {
			Commits struct {
				Href string `json:"href"`
			} `json:"commits"`
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
		DefaultMergeStrategy string   `json:"default_merge_strategy"`
		MergeStrategies      []string `json:"merge_strategies"`
		Type                 string   `json:"type"`
		Target               struct {
			Rendered struct {
			} `json:"rendered"`
			Hash  string `json:"hash"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Author struct {
				Raw  string `json:"raw"`
				Type string `json:"type"`
				User struct {
					Username    string `json:"username"`
					DisplayName string `json:"display_name"`
					UUID        string `json:"uuid"`
					Links       struct {
						Self struct {
							Href string `json:"href"`
						} `json:"self"`
						HTML struct {
							Href string `json:"href"`
						} `json:"html"`
						Avatar struct {
							Href string `json:"href"`
						} `json:"avatar"`
					} `json:"links"`
					Nickname  string `json:"nickname"`
					Type      string `json:"type"`
					AccountID string `json:"account_id"`
				} `json:"user"`
			} `json:"author"`
			Summary struct {
				Raw    string `json:"raw"`
				Markup string `json:"markup"`
				HTML   string `json:"html"`
				Type   string `json:"type"`
			} `json:"summary"`
			Parents []struct {
				Hash  string `json:"hash"`
				Type  string `json:"type"`
				Links struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
				} `json:"links"`
			} `json:"parents"`
			Date       time.Time `json:"date"`
			Message    string    `json:"message"`
			Type       string    `json:"type"`
			Properties struct {
			} `json:"properties"`
		} `json:"target"`
	} `json:"old"`
	Links struct {
		Commits struct {
			Href string `json:"href"`
		} `json:"commits"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Diff struct {
			Href string `json:"href"`
		} `json:"diff"`
	} `json:"links"`
	Created bool `json:"created"`
	Commits []struct {
		Rendered struct {
		} `json:"rendered"`
		Hash  string `json:"hash"`
		Links struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			Comments struct {
				Href string `json:"href"`
			} `json:"comments"`
			Patch struct {
				Href string `json:"href"`
			} `json:"patch"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
			Diff struct {
				Href string `json:"href"`
			} `json:"diff"`
			Approve struct {
				Href string `json:"href"`
			} `json:"approve"`
			Statuses struct {
				Href string `json:"href"`
			} `json:"statuses"`
		} `json:"links"`
		Author struct {
			Raw  string `json:"raw"`
			Type string `json:"type"`
			User struct {
				Username    string `json:"username"`
				DisplayName string `json:"display_name"`
				UUID        string `json:"uuid"`
				Links       struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
					Avatar struct {
						Href string `json:"href"`
					} `json:"avatar"`
				} `json:"links"`
				Nickname  string `json:"nickname"`
				Type      string `json:"type"`
				AccountID string `json:"account_id"`
			} `json:"user"`
		} `json:"author"`
		Summary struct {
			Raw    string `json:"raw"`
			Markup string `json:"markup"`
			HTML   string `json:"html"`
			Type   string `json:"type"`
		} `json:"summary"`
		Parents []struct {
			Hash  string `json:"hash"`
			Type  string `json:"type"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"parents"`
		Date       time.Time `json:"date"`
		Message    string    `json:"message"`
		Type       string    `json:"type"`
		Properties struct {
		} `json:"properties"`
	} `json:"commits"`
	Truncated bool `json:"truncated"`
	Closed    bool `json:"closed"`
	New       struct {
		Name  string `json:"name"`
		Links struct {
			Commits struct {
				Href string `json:"href"`
			} `json:"commits"`
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
		DefaultMergeStrategy string   `json:"default_merge_strategy"`
		MergeStrategies      []string `json:"merge_strategies"`
		Type                 string   `json:"type"`
		Target               struct {
			Rendered struct {
			} `json:"rendered"`
			Hash  string `json:"hash"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Author struct {
				Raw  string `json:"raw"`
				Type string `json:"type"`
				User struct {
					Username    string `json:"username"`
					DisplayName string `json:"display_name"`
					UUID        string `json:"uuid"`
					Links       struct {
						Self struct {
							Href string `json:"href"`
						} `json:"self"`
						HTML struct {
							Href string `json:"href"`
						} `json:"html"`
						Avatar struct {
							Href string `json:"href"`
						} `json:"avatar"`
					} `json:"links"`
					Nickname  string `json:"nickname"`
					Type      string `json:"type"`
					AccountID string `json:"account_id"`
				} `json:"user"`
			} `json:"author"`
			Summary struct {
				Raw    string `json:"raw"`
				Markup string `json:"markup"`
				HTML   string `json:"html"`
				Type   string `json:"type"`
			} `json:"summary"`
			Parents []struct {
				Hash  string `json:"hash"`
				Type  string `json:"type"`
				Links struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
				} `json:"links"`
			} `json:"parents"`
			Date       time.Time `json:"date"`
			Message    string    `json:"message"`
			Type       string    `json:"type"`
			Properties struct {
			} `json:"properties"`
		} `json:"target"`
	} `json:"new"`
}
type BitbucketCloudLink struct {
	Self struct {
		Href string `json:"href"`
	} `json:"self"`
	HTML struct {
		Href string `json:"href"`
	} `json:"html"`
	Avatar struct {
		Href string `json:"href"`
	} `json:"avatar"`
}

type BitbucketCloudRepository

type BitbucketCloudRepository struct {
	Scm       string              `json:"scm"`
	Website   string              `json:"website"`
	Name      string              `json:"name"`
	Links     BitbucketCloudLink  `json:"links"`
	FullName  string              `json:"full_name"`
	Owner     BitbucketCloudActor `json:"owner"`
	Type      string              `json:"type"`
	IsPrivate bool                `json:"is_private"`
	UUID      string              `json:"uuid"`
}

type BitbucketCloudWebHookEvent

type BitbucketCloudWebHookEvent struct {
	Push struct {
		Changes []BitbucketCloudChange `json:"changes,omitempty"`
	} `json:"push"`
	Actor      *BitbucketCloudActor      `json:"actor,omitempty"`
	Repository *BitbucketCloudRepository `json:"repository,omitempty"`
}

BitbucketServerPushEvent represents payload send by bitbucket cloud on a push event

type Configuration

type Configuration struct {
	Name                     string                          `toml:"name" comment:"Name of this CDS Hooks Service\n Enter a name to enable this service" json:"name"`
	HTTP                     service.HTTPRouterConfiguration `toml:"http" comment:"######################\n CDS Hooks HTTP Configuration \n######################" json:"http"`
	URL                      string                          `toml:"url" default:"http://localhost:8083" json:"url"`
	URLPublic                string                          `toml:"urlPublic" default:"http://localhost:8080/cdshooks" comment:"Public url for external call (webhook)" json:"urlPublic"`
	RetryDelay               int64                           `toml:"retryDelay" default:"120" comment:"Execution retry delay in seconds" json:"retryDelay"`
	RetryError               int64                           `toml:"retryError" default:"3" comment:"Retry execution while this number of error is not reached" json:"retryError"`
	ExecutionHistory         int                             `toml:"executionHistory" default:"10" comment:"Number of execution to keep" json:"executionHistory"`
	RepositoryEventRetention int                             `toml:"repositoryEventRetention" default:"30" comment:"Number of repository event to keep" json:"repositoryEventRetention"`
	Disable                  bool                            `toml:"disable" default:"false" comment:"Disable all hooks executions" json:"disable"`
	API                      service.APIServiceConfiguration `toml:"api" comment:"######################\n CDS API Settings \n######################" json:"api"`
	Cache                    struct {
		TTL   int `toml:"ttl" default:"60" json:"ttl"`
		Redis struct {
			Host     string `` /* 192-byte string literal not displayed */
			Password string `toml:"password" json:"-"`
			DbIndex  int    `toml:"dbindex" default:"0" json:"dbindex"`
		} `` /* 134-byte string literal not displayed */
	} `toml:"cache" comment:"######################\n CDS Hooks Cache Settings \n######################" json:"cache"`
	WebhooksPublicKeySign string `toml:"webhooksPublicKeySign" comment:"Public key to check call signature on handler /v2/webhook/repository"`
	RepositoryWebHookKey  string `toml:"repositoryWebHookKey" comment:"Secret key used to generate repository webhook secret"`
}

Configuration is the hooks configuration structure

type GerritAccount

type GerritAccount struct {
	Name     string `json:"name,omitempty"`
	Email    string `json:"email,omitempty"`
	Username string `json:"username,omitempty"`
}

GerritAccount https://gerrit-review.googlesource.com/Documentation/json.html#account

type GerritApproval

type GerritApproval struct {
	Type        string         `json:"type,omitempty"`
	Description string         `json:"description,omitempty"`
	Value       string         `json:"value,omitempty"`
	OldValue    string         `json:"oldValue,omitempty"`
	GrantedOn   int            `json:"grantedOn,omitempty"`
	By          *GerritAccount `json:"by,omitempty"`
}

GerritApproval https://gerrit-review.googlesource.com/Documentation/json.html#approval

type GerritChange

type GerritChange struct {
	Project         string               `json:"project,omitempty"` // repository name
	Branch          string               `json:"branch,omitempty"`  // master
	Topic           string               `json:"topic,omitempty"`
	ID              string               `json:"id,omitempty"`
	Subject         string               `json:"subject,omitempty"`
	Owner           *GerritAccount       `json:"owner,omitempty"`
	URL             string               `json:"url,omitempty"`
	CommitMessage   string               `json:"commitMessage,omitempty"`
	HashTags        []string             `json:"hashtags,omitempty"`
	CreatedOn       int64                `json:"createdOn,omitempty"`
	LastUpdated     int64                `json:"lastUpdated,omitempty"`
	Open            bool                 `json:"open,omitempty"`
	Status          string               `json:"status,omitempty"`
	Private         bool                 `json:"private,omitempty"`
	Wip             bool                 `json:"wip,omitempty"`
	Comments        []GerritMessage      `json:"comments,omitempty"`
	TrackingIDs     []GerritTrackingID   `json:"trackingIds,omitempty"`
	CurrentPatchSet *GerritPatchSet      `json:"currentPatchSet,omitempty"`
	PatchSets       []GerritPatchSet     `json:"patchSets,omitempty"`
	DependsOn       []GerritDependency   `json:"dependsOn,omitempty"`
	NeededBy        []GerritDependency   `json:"neededBy,omitempty"`
	SubmitRecords   []GerritSubmitRecord `json:"submitRecords,omitempty"`
	AllReviewers    []GerritAccount      `json:"allReviewers,omitempty"`
}

GerritChange represents a gerrit change https://gerrit-review.googlesource.com/Documentation/json.html#change

type GerritDependency

type GerritDependency struct {
	ID                string `json:"id,omitempty"`
	Number            string `json:"number,omitempty"`
	Revision          string `json:"revision,omitempty"`
	Ref               string `json:"ref,omitempty"`
	IsCurrentPatchSet bool   `json:"isCurrentPatchSet,omitempty"`
}

GerritDependency https://gerrit-review.googlesource.com/Documentation/json.html#dependency

type GerritEvent

type GerritEvent struct {
	Type           string           `json:"type,omitempty"`
	Change         *GerritChange    `json:"change,omitempty"`
	Changer        *GerritAccount   `json:"changer,omitempty"`
	OldAssignee    string           `json:"oldAssignee,omitempty"`
	EventCreatedOn int64            `json:"eventCreatedOn,omitempty"`
	PatchSet       *GerritPatchSet  `json:"patchSet,omitempty"`
	Abandoner      *GerritAccount   `json:"abandoner,omitempty"`
	Reason         string           `json:"reason,omitempty"`
	Deleter        *GerritAccount   `json:"deleter,omitempty"`
	Submitter      *GerritAccount   `json:"submitter,omitempty"`
	NewRev         string           `json:"newRev,omitempty"`
	Restorer       string           `json:"restorer,omitempty"`
	Author         *GerritAccount   `json:"author,omitempty"`
	Approvals      []GerritApproval `json:"approvals,omitempty"`
	Comment        string           `json:"comment,omitempty"`
	Editor         *GerritAccount   `json:"editor,omitempty"`
	Added          []string         `json:"added,omitempty"`
	Removed        []string         `json:"removed,omitempty"`
	HashTags       []string         `json:"hashtags,omitempty"`
	ProjectName    string           `json:"projectName,omitempty"`
	ProjectHead    string           `json:"projectHead,omitempty"`
	Uploader       *GerritAccount   `json:"uploader,omitempty"`
	RefUpdate      *GerritRefUpdate `json:"refUpdate,omitempty"`
	Reviewer       *GerritAccount   `json:"reviewer,omitempty"`
	Remover        *GerritAccount   `json:"remover,omitempty"`
	OldTopic       string           `json:"oldTopic,omitempty"`
}

GerritEvent rerpesents the events send by gerrit https://gerrit-review.googlesource.com/Documentation/cmd-stream-events.html

type GerritFile

type GerritFile struct {
	File       string `json:"file,omitempty"`
	FileOld    string `json:"fileOld,omitempty"`
	Type       string `json:"type,omitempty"`
	Insertions int    `json:"insertions,omitempty"`
	Deletions  int    `json:"deletions,omitempty"`
}

GerritFile https://gerrit-review.googlesource.com/Documentation/json.html#file

type GerritLabel

type GerritLabel struct {
	Label  string         `json:"label,omitempty"`
	Status string         `json:"status,omitempty"`
	By     *GerritAccount `json:"by,omitempty"`
}

GerritLabel https://gerrit-review.googlesource.com/Documentation/json.html#label

type GerritMessage

type GerritMessage struct {
	Timestamp int64          `json:"timestamp,omitempty"`
	Reviewer  *GerritAccount `json:"reviewer,omitempty"`
	Message   string         `json:"message,omitempty"`
}

GerritMessage https://gerrit-review.googlesource.com/Documentation/json.html#message

type GerritPatchSet

type GerritPatchSet struct {
	Number         int64                   `json:"number,omitempty"`
	Revision       string                  `json:"revision,omitempty"`
	Parents        []string                `json:"parents,omitempty"`
	Ref            string                  `json:"ref,omitempty"`
	Uploader       *GerritAccount          `json:"uploader,omitempty"`
	Author         *GerritAccount          `json:"author,omitempty"`
	CreatedOn      int                     `json:"createdOn,omitempty"`
	IsDraft        bool                    `json:"isDraft,omitempty"`
	Kind           string                  `json:"kind,omitempty"`
	Approvals      []GerritApproval        `json:"approvals,omitempty"`
	Comments       []GerritPatchSetComment `json:"comments,omitempty"`
	Files          []GerritFile            `json:"files,omitempty"`
	SizeInsertions int                     `json:"sizeInsertions,omitempty"`
	SizeDeletions  int                     `json:"sizeDeletions,omitempty"`
}

GerritPatchSet https://gerrit-review.googlesource.com/Documentation/json.html#patchSet

type GerritPatchSetComment

type GerritPatchSetComment struct {
	File     string         `json:"file,omitempty"`
	Line     int            `json:"line,omitempty"`
	Reviewer *GerritAccount `json:"reviewer,omitempty"`
	Message  string         `json:"message,omitempty"`
}

GerritPatchSetComment https://gerrit-review.googlesource.com/Documentation/json.html#patchsetcomment

type GerritRefUpdate

type GerritRefUpdate struct {
	OldRev  string `json:"oldRev,omitempty"`
	NewRev  string `json:"newRev,omitempty"`
	RefName string `json:"refName,omitempty"`
	Project string `json:"project,omitempty"`
}

GerritRefUpdate https://gerrit-review.googlesource.com/Documentation/json.html#refUpdate

type GerritRequirement

type GerritRequirement struct {
	FallbackText string `json:"fallbackText,omitempty"`
	Type         string `json:"type,omitempty"`
	Data         string `json:"data,omitempty"`
}

GerritRequirement https://gerrit-review.googlesource.com/Documentation/json.html#requirement

type GerritSubmitRecord

type GerritSubmitRecord struct {
	Status       string              `json:"status,omitempty"`
	Labels       []GerritLabel       `json:"labels,omitempty"`
	Requirements []GerritRequirement `json:"requirements,omitempty"`
}

GerritSubmitRecord https://gerrit-review.googlesource.com/Documentation/json.html#submitRecord

type GerritTrackingID

type GerritTrackingID struct {
	System string `json:"system,omitempty"`
	ID     string `json:"id,omitempty"`
}

GerritTrackingID https://gerrit-review.googlesource.com/Documentation/json.html#trackingid

type GiteaEventPayload added in v0.52.0

type GiteaEventPayload struct {
	Action     string `json:"action"`
	Secret     string `json:"secret"`
	Ref        string `json:"ref"`    // refs/heads/branch_name
	Before     string `json:"before"` // commit before
	After      string `json:"after"`  // commit aster
	CompareUrl string `json:"compare_url"`
	Commits    []struct {
		Id      string `json:"id"`
		Message string `json:"message"`
		Url     string `json:"url"`
		Author  struct {
			Name     string `json:"name"`
			Email    string `json:"email"`
			Username string `json:"username"`
		} `json:"author"`
		Committer struct {
			Name     string `json:"name"`
			Email    string `json:"email"`
			Username string `json:"username"`
		} `json:"committer"`
		Timestamp time.Time `json:"timestamp"`
		Added     []string  `json:"added"`
		Removed   []string  `json:"removed"`
		Modified  []string  `json:"modified"`
	} `json:"commits"`
	PullRequest struct {
		ID     int    `json:"id"`
		URL    string `json:"url"`
		Number int    `json:"number"`
		User   struct {
			ID                int       `json:"id"`
			Login             string    `json:"login"`
			LoginName         string    `json:"login_name"`
			FullName          string    `json:"full_name"`
			Email             string    `json:"email"`
			AvatarURL         string    `json:"avatar_url"`
			Language          string    `json:"language"`
			IsAdmin           bool      `json:"is_admin"`
			LastLogin         time.Time `json:"last_login"`
			Created           time.Time `json:"created"`
			Restricted        bool      `json:"restricted"`
			Active            bool      `json:"active"`
			ProhibitLogin     bool      `json:"prohibit_login"`
			Location          string    `json:"location"`
			Website           string    `json:"website"`
			Description       string    `json:"description"`
			Visibility        string    `json:"visibility"`
			FollowersCount    int       `json:"followers_count"`
			FollowingCount    int       `json:"following_count"`
			StarredReposCount int       `json:"starred_repos_count"`
			Username          string    `json:"username"`
		} `json:"user"`
		Title               string `json:"title"`
		Body                string `json:"body"`
		Labels              []any  `json:"labels"`
		Milestone           any    `json:"milestone"`
		Assignee            any    `json:"assignee"`
		Assignees           any    `json:"assignees"`
		RequestedReviewers  any    `json:"requested_reviewers"`
		State               string `json:"state"`
		IsLocked            bool   `json:"is_locked"`
		Comments            int    `json:"comments"`
		HTMLURL             string `json:"html_url"`
		DiffURL             string `json:"diff_url"`
		PatchURL            string `json:"patch_url"`
		Mergeable           bool   `json:"mergeable"`
		Merged              bool   `json:"merged"`
		MergedAt            any    `json:"merged_at"`
		MergeCommitSha      any    `json:"merge_commit_sha"`
		MergedBy            any    `json:"merged_by"`
		AllowMaintainerEdit bool   `json:"allow_maintainer_edit"`
		Base                struct {
			Label  string `json:"label"`
			Ref    string `json:"ref"`
			Sha    string `json:"sha"`
			RepoID int    `json:"repo_id"`
			Repo   struct {
				ID    int `json:"id"`
				Owner struct {
					ID                int       `json:"id"`
					Login             string    `json:"login"`
					LoginName         string    `json:"login_name"`
					FullName          string    `json:"full_name"`
					Email             string    `json:"email"`
					AvatarURL         string    `json:"avatar_url"`
					Language          string    `json:"language"`
					IsAdmin           bool      `json:"is_admin"`
					LastLogin         time.Time `json:"last_login"`
					Created           time.Time `json:"created"`
					Restricted        bool      `json:"restricted"`
					Active            bool      `json:"active"`
					ProhibitLogin     bool      `json:"prohibit_login"`
					Location          string    `json:"location"`
					Website           string    `json:"website"`
					Description       string    `json:"description"`
					Visibility        string    `json:"visibility"`
					FollowersCount    int       `json:"followers_count"`
					FollowingCount    int       `json:"following_count"`
					StarredReposCount int       `json:"starred_repos_count"`
					Username          string    `json:"username"`
				} `json:"owner"`
				Name            string    `json:"name"`
				FullName        string    `json:"full_name"`
				Description     string    `json:"description"`
				Empty           bool      `json:"empty"`
				Private         bool      `json:"private"`
				Fork            bool      `json:"fork"`
				Template        bool      `json:"template"`
				Parent          any       `json:"parent"`
				Mirror          bool      `json:"mirror"`
				Size            int       `json:"size"`
				Language        string    `json:"language"`
				LanguagesURL    string    `json:"languages_url"`
				HTMLURL         string    `json:"html_url"`
				URL             string    `json:"url"`
				Link            string    `json:"link"`
				SSHURL          string    `json:"ssh_url"`
				CloneURL        string    `json:"clone_url"`
				OriginalURL     string    `json:"original_url"`
				Website         string    `json:"website"`
				StarsCount      int       `json:"stars_count"`
				ForksCount      int       `json:"forks_count"`
				WatchersCount   int       `json:"watchers_count"`
				OpenIssuesCount int       `json:"open_issues_count"`
				OpenPrCounter   int       `json:"open_pr_counter"`
				ReleaseCounter  int       `json:"release_counter"`
				DefaultBranch   string    `json:"default_branch"`
				Archived        bool      `json:"archived"`
				CreatedAt       time.Time `json:"created_at"`
				UpdatedAt       time.Time `json:"updated_at"`
				ArchivedAt      time.Time `json:"archived_at"`
				Permissions     struct {
					Admin bool `json:"admin"`
					Push  bool `json:"push"`
					Pull  bool `json:"pull"`
				} `json:"permissions"`
				HasIssues       bool `json:"has_issues"`
				InternalTracker struct {
					EnableTimeTracker                bool `json:"enable_time_tracker"`
					AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
					EnableIssueDependencies          bool `json:"enable_issue_dependencies"`
				} `json:"internal_tracker"`
				HasWiki                       bool      `json:"has_wiki"`
				HasPullRequests               bool      `json:"has_pull_requests"`
				HasProjects                   bool      `json:"has_projects"`
				HasReleases                   bool      `json:"has_releases"`
				HasPackages                   bool      `json:"has_packages"`
				HasActions                    bool      `json:"has_actions"`
				IgnoreWhitespaceConflicts     bool      `json:"ignore_whitespace_conflicts"`
				AllowMergeCommits             bool      `json:"allow_merge_commits"`
				AllowRebase                   bool      `json:"allow_rebase"`
				AllowRebaseExplicit           bool      `json:"allow_rebase_explicit"`
				AllowSquashMerge              bool      `json:"allow_squash_merge"`
				AllowRebaseUpdate             bool      `json:"allow_rebase_update"`
				DefaultDeleteBranchAfterMerge bool      `json:"default_delete_branch_after_merge"`
				DefaultMergeStyle             string    `json:"default_merge_style"`
				DefaultAllowMaintainerEdit    bool      `json:"default_allow_maintainer_edit"`
				AvatarURL                     string    `json:"avatar_url"`
				Internal                      bool      `json:"internal"`
				MirrorInterval                string    `json:"mirror_interval"`
				MirrorUpdated                 time.Time `json:"mirror_updated"`
				RepoTransfer                  any       `json:"repo_transfer"`
			} `json:"repo"`
		} `json:"base"`
		Head struct {
			Label  string `json:"label"`
			Ref    string `json:"ref"`
			Sha    string `json:"sha"`
			RepoID int    `json:"repo_id"`
			Repo   struct {
				ID    int `json:"id"`
				Owner struct {
					ID                int       `json:"id"`
					Login             string    `json:"login"`
					LoginName         string    `json:"login_name"`
					FullName          string    `json:"full_name"`
					Email             string    `json:"email"`
					AvatarURL         string    `json:"avatar_url"`
					Language          string    `json:"language"`
					IsAdmin           bool      `json:"is_admin"`
					LastLogin         time.Time `json:"last_login"`
					Created           time.Time `json:"created"`
					Restricted        bool      `json:"restricted"`
					Active            bool      `json:"active"`
					ProhibitLogin     bool      `json:"prohibit_login"`
					Location          string    `json:"location"`
					Website           string    `json:"website"`
					Description       string    `json:"description"`
					Visibility        string    `json:"visibility"`
					FollowersCount    int       `json:"followers_count"`
					FollowingCount    int       `json:"following_count"`
					StarredReposCount int       `json:"starred_repos_count"`
					Username          string    `json:"username"`
				} `json:"owner"`
				Name            string    `json:"name"`
				FullName        string    `json:"full_name"`
				Description     string    `json:"description"`
				Empty           bool      `json:"empty"`
				Private         bool      `json:"private"`
				Fork            bool      `json:"fork"`
				Template        bool      `json:"template"`
				Parent          any       `json:"parent"`
				Mirror          bool      `json:"mirror"`
				Size            int       `json:"size"`
				Language        string    `json:"language"`
				LanguagesURL    string    `json:"languages_url"`
				HTMLURL         string    `json:"html_url"`
				URL             string    `json:"url"`
				Link            string    `json:"link"`
				SSHURL          string    `json:"ssh_url"`
				CloneURL        string    `json:"clone_url"`
				OriginalURL     string    `json:"original_url"`
				Website         string    `json:"website"`
				StarsCount      int       `json:"stars_count"`
				ForksCount      int       `json:"forks_count"`
				WatchersCount   int       `json:"watchers_count"`
				OpenIssuesCount int       `json:"open_issues_count"`
				OpenPrCounter   int       `json:"open_pr_counter"`
				ReleaseCounter  int       `json:"release_counter"`
				DefaultBranch   string    `json:"default_branch"`
				Archived        bool      `json:"archived"`
				CreatedAt       time.Time `json:"created_at"`
				UpdatedAt       time.Time `json:"updated_at"`
				ArchivedAt      time.Time `json:"archived_at"`
				Permissions     struct {
					Admin bool `json:"admin"`
					Push  bool `json:"push"`
					Pull  bool `json:"pull"`
				} `json:"permissions"`
				HasIssues       bool `json:"has_issues"`
				InternalTracker struct {
					EnableTimeTracker                bool `json:"enable_time_tracker"`
					AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
					EnableIssueDependencies          bool `json:"enable_issue_dependencies"`
				} `json:"internal_tracker"`
				HasWiki                       bool      `json:"has_wiki"`
				HasPullRequests               bool      `json:"has_pull_requests"`
				HasProjects                   bool      `json:"has_projects"`
				HasReleases                   bool      `json:"has_releases"`
				HasPackages                   bool      `json:"has_packages"`
				HasActions                    bool      `json:"has_actions"`
				IgnoreWhitespaceConflicts     bool      `json:"ignore_whitespace_conflicts"`
				AllowMergeCommits             bool      `json:"allow_merge_commits"`
				AllowRebase                   bool      `json:"allow_rebase"`
				AllowRebaseExplicit           bool      `json:"allow_rebase_explicit"`
				AllowSquashMerge              bool      `json:"allow_squash_merge"`
				AllowRebaseUpdate             bool      `json:"allow_rebase_update"`
				DefaultDeleteBranchAfterMerge bool      `json:"default_delete_branch_after_merge"`
				DefaultMergeStyle             string    `json:"default_merge_style"`
				DefaultAllowMaintainerEdit    bool      `json:"default_allow_maintainer_edit"`
				AvatarURL                     string    `json:"avatar_url"`
				Internal                      bool      `json:"internal"`
				MirrorInterval                string    `json:"mirror_interval"`
				MirrorUpdated                 time.Time `json:"mirror_updated"`
				RepoTransfer                  any       `json:"repo_transfer"`
			} `json:"repo"`
		} `json:"head"`
		MergeBase string    `json:"merge_base"`
		DueDate   any       `json:"due_date"`
		CreatedAt time.Time `json:"created_at"`
		UpdatedAt time.Time `json:"updated_at"`
		ClosedAt  any       `json:"closed_at"`
		PinOrder  int       `json:"pin_order"`
	} `json:"pull_request"`
	Repository struct {
		ID    int `json:"id"`
		Owner struct {
			ID                int       `json:"id"`
			Login             string    `json:"login"`
			LoginName         string    `json:"login_name"`
			FullName          string    `json:"full_name"`
			Email             string    `json:"email"`
			AvatarURL         string    `json:"avatar_url"`
			Language          string    `json:"language"`
			IsAdmin           bool      `json:"is_admin"`
			LastLogin         time.Time `json:"last_login"`
			Created           time.Time `json:"created"`
			Restricted        bool      `json:"restricted"`
			Active            bool      `json:"active"`
			ProhibitLogin     bool      `json:"prohibit_login"`
			Location          string    `json:"location"`
			Website           string    `json:"website"`
			Description       string    `json:"description"`
			Visibility        string    `json:"visibility"`
			FollowersCount    int       `json:"followers_count"`
			FollowingCount    int       `json:"following_count"`
			StarredReposCount int       `json:"starred_repos_count"`
			Username          string    `json:"username"`
		} `json:"owner"`
		Name            string    `json:"name"`
		FullName        string    `json:"full_name"`
		Description     string    `json:"description"`
		Empty           bool      `json:"empty"`
		Private         bool      `json:"private"`
		Fork            bool      `json:"fork"`
		Template        bool      `json:"template"`
		Parent          any       `json:"parent"`
		Mirror          bool      `json:"mirror"`
		Size            int       `json:"size"`
		Language        string    `json:"language"`
		LanguagesURL    string    `json:"languages_url"`
		HTMLURL         string    `json:"html_url"`
		URL             string    `json:"url"`
		Link            string    `json:"link"`
		SSHURL          string    `json:"ssh_url"`
		CloneURL        string    `json:"clone_url"`
		OriginalURL     string    `json:"original_url"`
		Website         string    `json:"website"`
		StarsCount      int       `json:"stars_count"`
		ForksCount      int       `json:"forks_count"`
		WatchersCount   int       `json:"watchers_count"`
		OpenIssuesCount int       `json:"open_issues_count"`
		OpenPrCounter   int       `json:"open_pr_counter"`
		ReleaseCounter  int       `json:"release_counter"`
		DefaultBranch   string    `json:"default_branch"`
		Archived        bool      `json:"archived"`
		CreatedAt       time.Time `json:"created_at"`
		UpdatedAt       time.Time `json:"updated_at"`
		ArchivedAt      time.Time `json:"archived_at"`
		Permissions     struct {
			Admin bool `json:"admin"`
			Push  bool `json:"push"`
			Pull  bool `json:"pull"`
		} `json:"permissions"`
		HasIssues       bool `json:"has_issues"`
		InternalTracker struct {
			EnableTimeTracker                bool `json:"enable_time_tracker"`
			AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
			EnableIssueDependencies          bool `json:"enable_issue_dependencies"`
		} `json:"internal_tracker"`
		HasWiki                       bool      `json:"has_wiki"`
		HasPullRequests               bool      `json:"has_pull_requests"`
		HasProjects                   bool      `json:"has_projects"`
		HasReleases                   bool      `json:"has_releases"`
		HasPackages                   bool      `json:"has_packages"`
		HasActions                    bool      `json:"has_actions"`
		IgnoreWhitespaceConflicts     bool      `json:"ignore_whitespace_conflicts"`
		AllowMergeCommits             bool      `json:"allow_merge_commits"`
		AllowRebase                   bool      `json:"allow_rebase"`
		AllowRebaseExplicit           bool      `json:"allow_rebase_explicit"`
		AllowSquashMerge              bool      `json:"allow_squash_merge"`
		AllowRebaseUpdate             bool      `json:"allow_rebase_update"`
		DefaultDeleteBranchAfterMerge bool      `json:"default_delete_branch_after_merge"`
		DefaultMergeStyle             string    `json:"default_merge_style"`
		DefaultAllowMaintainerEdit    bool      `json:"default_allow_maintainer_edit"`
		AvatarURL                     string    `json:"avatar_url"`
		Internal                      bool      `json:"internal"`
		MirrorInterval                string    `json:"mirror_interval"`
		MirrorUpdated                 time.Time `json:"mirror_updated"`
		RepoTransfer                  any       `json:"repo_transfer"`
	} `json:"repository"`
	Pusher struct {
		Id        int    `json:"id"`
		Login     string `json:"login"`
		FullName  string `json:"full_name"`
		Email     string `json:"email"`
		AvatarUrl string `json:"avatar_url"`
		Username  string `json:"username"`
	} `json:"pusher"`
	Sender struct {
		ID                int       `json:"id"`
		Login             string    `json:"login"`
		LoginName         string    `json:"login_name"`
		FullName          string    `json:"full_name"`
		Email             string    `json:"email"`
		AvatarURL         string    `json:"avatar_url"`
		Language          string    `json:"language"`
		IsAdmin           bool      `json:"is_admin"`
		LastLogin         time.Time `json:"last_login"`
		Created           time.Time `json:"created"`
		Restricted        bool      `json:"restricted"`
		Active            bool      `json:"active"`
		ProhibitLogin     bool      `json:"prohibit_login"`
		Location          string    `json:"location"`
		Website           string    `json:"website"`
		Description       string    `json:"description"`
		Visibility        string    `json:"visibility"`
		FollowersCount    int       `json:"followers_count"`
		FollowingCount    int       `json:"following_count"`
		StarredReposCount int       `json:"starred_repos_count"`
		Username          string    `json:"username"`
	} `json:"sender"`
}

type GithubAuthor

type GithubAuthor struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username"`
}

type GithubCommit

type GithubCommit struct {
	ID        string       `json:"id"`
	TreeID    string       `json:"tree_id"`
	Distinct  bool         `json:"distinct"`
	Message   string       `json:"message"`
	Timestamp time.Time    `json:"timestamp"`
	URL       string       `json:"url"`
	Author    GithubAuthor `json:"author"`
	Committer GithubAuthor `json:"committer"`
	Added     []string     `json:"added"`
	Removed   []string     `json:"removed"`
	Modified  []string     `json:"modified"`
}

type GithubDate

type GithubDate time.Time

func (*GithubDate) UnmarshalJSON

func (g *GithubDate) UnmarshalJSON(data []byte) error

type GithubOwner

type GithubOwner struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type GithubRepository

type GithubRepository struct {
	ID               int         `json:"id"`
	Name             string      `json:"name"`
	FullName         string      `json:"full_name"`
	Owner            GithubOwner `json:"owner"`
	Private          bool        `json:"private"`
	HTMLURL          string      `json:"html_url"`
	Description      string      `json:"description"`
	Fork             bool        `json:"fork"`
	URL              string      `json:"url"`
	ForksURL         string      `json:"forks_url"`
	KeysURL          string      `json:"keys_url"`
	CollaboratorsURL string      `json:"collaborators_url"`
	TeamsURL         string      `json:"teams_url"`
	HooksURL         string      `json:"hooks_url"`
	IssueEventsURL   string      `json:"issue_events_url"`
	EventsURL        string      `json:"events_url"`
	AssigneesURL     string      `json:"assignees_url"`
	BranchesURL      string      `json:"branches_url"`
	TagsURL          string      `json:"tags_url"`
	BlobsURL         string      `json:"blobs_url"`
	GitTagsURL       string      `json:"git_tags_url"`
	GitRefsURL       string      `json:"git_refs_url"`
	TreesURL         string      `json:"trees_url"`
	StatusesURL      string      `json:"statuses_url"`
	LanguagesURL     string      `json:"languages_url"`
	StargazersURL    string      `json:"stargazers_url"`
	ContributorsURL  string      `json:"contributors_url"`
	SubscribersURL   string      `json:"subscribers_url"`
	SubscriptionURL  string      `json:"subscription_url"`
	CommitsURL       string      `json:"commits_url"`
	GitCommitsURL    string      `json:"git_commits_url"`
	CommentsURL      string      `json:"comments_url"`
	IssueCommentURL  string      `json:"issue_comment_url"`
	ContentsURL      string      `json:"contents_url"`
	CompareURL       string      `json:"compare_url"`
	MergesURL        string      `json:"merges_url"`
	ArchiveURL       string      `json:"archive_url"`
	DownloadsURL     string      `json:"downloads_url"`
	IssuesURL        string      `json:"issues_url"`
	PullsURL         string      `json:"pulls_url"`
	MilestonesURL    string      `json:"milestones_url"`
	NotificationsURL string      `json:"notifications_url"`
	LabelsURL        string      `json:"labels_url"`
	ReleasesURL      string      `json:"releases_url"`
	CreateAt         GithubDate  `json:"created_at"`
	UpdatedAt        time.Time   `json:"updated_at"`
	PushedAt         GithubDate  `json:"pushed_at"`
	GitURL           string      `json:"git_url"`
	SSHURL           string      `json:"ssh_url"`
	CloneURL         string      `json:"clone_url"`
	SvnURL           string      `json:"svn_url"`
	Homepage         interface{} `json:"homepage"`
	Size             int         `json:"size"`
	StargazersCount  int         `json:"stargazers_count"`
	WatchersCount    int         `json:"watchers_count"`
	Language         interface{} `json:"language"`
	HasIssues        bool        `json:"has_issues"`
	HasDownloads     bool        `json:"has_downloads"`
	HasWiki          bool        `json:"has_wiki"`
	HasPages         bool        `json:"has_pages"`
	ForksCount       int         `json:"forks_count"`
	MirrorURL        interface{} `json:"mirror_url"`
	OpenIssuesCount  int         `json:"open_issues_count"`
	Forks            int         `json:"forks"`
	OpenIssues       int         `json:"open_issues"`
	Watchers         int         `json:"watchers"`
	DefaultBranch    string      `json:"default_branch"`
	Stargazers       int         `json:"stargazers"`
	MasterBranch     string      `json:"master_branch"`
}

type GithubSender

type GithubSender struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

type GithubWebHookEvent

type GithubWebHookEvent struct {
	Action     string            `json:"action,omitempty"` // used by pull_request event
	Ref        string            `json:"ref"`
	Before     string            `json:"before"`
	After      string            `json:"after"`
	Created    bool              `json:"created"`
	Deleted    bool              `json:"deleted"`
	Forced     bool              `json:"forced"`
	BaseRef    interface{}       `json:"base_ref"`
	Compare    string            `json:"compare"`
	Commits    []GithubCommit    `json:"commits"`
	HeadCommit *GithubCommit     `json:"head_commit"`
	Repository *GithubRepository `json:"repository"`
	Pusher     GithubOwner       `json:"pusher"`
	Sender     GithubSender      `json:"sender"`
}

GithubWebHookEvent represents payload send by github on a push event

func (*GithubWebHookEvent) GetCommits

func (g *GithubWebHookEvent) GetCommits() []sdk.VCSCommit

type GitlabAuthor

type GitlabAuthor struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type GitlabCommit

type GitlabCommit struct {
	ID        string       `json:"id"`
	Message   string       `json:"message"`
	Timestamp time.Time    `json:"timestamp"`
	URL       string       `json:"url"`
	Author    GitlabAuthor `json:"author"`
	Added     []string     `json:"added"`
	Modified  []string     `json:"modified"`
	Removed   []string     `json:"removed"`
}

type GitlabEvent

type GitlabEvent struct {
	ObjectKind        string            `json:"object_kind"`
	Before            string            `json:"before"`
	After             string            `json:"after"`
	Ref               string            `json:"ref"`
	CheckoutSha       string            `json:"checkout_sha"`
	UserID            int               `json:"user_id"`
	UserName          string            `json:"user_name"`
	UserUsername      string            `json:"user_username"`
	UserEmail         string            `json:"user_email"`
	UserAvatar        string            `json:"user_avatar"`
	ProjectID         int               `json:"project_id"`
	Project           *GitlabProject    `json:"project"`
	Repository        *GitlabRepository `json:"repository"`
	Commits           []GitlabCommit    `json:"commits"`
	TotalCommitsCount int               `json:"total_commits_count"`
}

GitlabEvent represents payload send by gitlab on a push event

func (*GitlabEvent) GetCommits

func (g *GitlabEvent) GetCommits() []sdk.VCSCommit

type GitlabProject

type GitlabProject struct {
	ID                int         `json:"id"`
	Name              string      `json:"name"`
	Description       string      `json:"description"`
	WebURL            string      `json:"web_url"`
	AvatarURL         interface{} `json:"avatar_url"`
	GitSSHURL         string      `json:"git_ssh_url"`
	GitHTTPURL        string      `json:"git_http_url"`
	Namespace         string      `json:"namespace"`
	VisibilityLevel   int         `json:"visibility_level"`
	PathWithNamespace string      `json:"path_with_namespace"`
	DefaultBranch     string      `json:"default_branch"`
	Homepage          string      `json:"homepage"`
	URL               string      `json:"url"`
	SSHURL            string      `json:"ssh_url"`
	HTTPURL           string      `json:"http_url"`
}

type GitlabRepository

type GitlabRepository struct {
	Name            string `json:"name"`
	URL             string `json:"url"`
	Description     string `json:"description"`
	Homepage        string `json:"homepage"`
	GitHTTPURL      string `json:"git_http_url"`
	GitSSHURL       string `json:"git_ssh_url"`
	VisibilityLevel int    `json:"visibility_level"`
}

type Service

type Service struct {
	service.Common
	Cfg                     Configuration
	Router                  *api.Router
	Cache                   cache.Store
	Dao                     dao
	Maintenance             bool
	WebHooksParsedPublicKey *rsa.PublicKey
}

Service is the stuct representing a hooks µService

func New

func New() *Service

New returns a new service

func (*Service) ApplyConfiguration

func (s *Service) ApplyConfiguration(config interface{}) error

ApplyConfiguration apply an object of type hooks.Configuration after checking it

func (*Service) CheckConfiguration

func (s *Service) CheckConfiguration(config interface{}) error

CheckConfiguration checks the validity of the configuration object

func (*Service) CheckHmac256Signature added in v0.52.0

func (s *Service) CheckHmac256Signature(headerName string) service.Middleware

func (*Service) ComputeGerritStreamEvent

func (s *Service) ComputeGerritStreamEvent(ctx context.Context, vcsServer string, gerritEventChan <-chan GerritEvent)

func (*Service) Init

func (s *Service) Init(config interface{}) (cdsclient.ServiceConfig, error)

func (*Service) Serve

func (s *Service) Serve(c context.Context) error

Serve will start the http api server

func (*Service) Status

func (s *Service) Status(ctx context.Context) *sdk.MonitoringStatus

Status returns sdk.MonitoringStatus, implements interface service.Service

Jump to

Keyboard shortcuts

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