jenkins

package
v0.0.0-...-b175f30 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Jenkins represents the name of data source
	Jenkins = "jenkins"
	// Depth is the attribute to be passed onto the /api/json
	Depth = 1
	// BuildCategory is the default category for jenkins build
	BuildCategory = "build"
	// DefaultDateTime is the default time used when no time is provided
	DefaultDateTime = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
	// ListView represents the classname of the jenkins jobs that are views
	ListView = "hudson.model.ListView"
	// UndefinedCategory is used for jobs without categories
	UndefinedCategory = "UNDEFINED_CATEGORY"
)
View Source
var DefaultTime = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)

DefaultTime represents the default time used when the time is not given and index does not exist

View Source
var JenkinsRawMapping = []byte(`{"mappings":{"dynamic":"true","dynamic_templates":[{"notanalyzed":{"match":"*","match_mapping_type":"string","mapping":{"type":"keyword"}}},{"formatdate":{"match":"*","match_mapping_type":"date","mapping":{"format":"strict_date_optional_time||epoch_millis","type":"date"}}}],"properties":{"backend_name":{"type":"keyword"},"backend_version":{"type":"keyword"},"installer":{"type":"keyword"},"category":{"type":"keyword"},"data":{"properties":{"_class":{"type":"keyword"},"actions":{"type":"object","dynamic":"false"},"artifacts":{"properties":{"displayPath":{"type":"keyword"},"fileName":{"type":"keyword"},"relativePath":{"type":"keyword"}}},"attachments":{"type":"object","dynamic":"false"},"blocks":{"type":"object","dynamic":"false"},"building":{"type":"boolean"},"builtOn":{"type":"keyword"},"changeSet":{"properties":{"_class":{"type":"keyword"},"items":{"properties":{"_class":{"type":"keyword"},"affectedPaths":{"type":"keyword"},"author":{"properties":{"absoluteUrl":{"type":"keyword"},"fullName":{"type":"keyword"}}},"authorEmail":{"type":"keyword"},"comment":{"type":"text"},"commitId":{"type":"keyword"},"date":{"type":"keyword"},"id":{"type":"keyword"},"msg":{"type":"keyword"},"paths":{"properties":{"editType":{"type":"keyword"},"file":{"type":"keyword"}}},"timestamp":{"type":"long"}}},"kind":{"type":"keyword"}}},"changeSets":{"properties":{"_class":{"type":"keyword"},"items":{"properties":{"_class":{"type":"keyword"},"affectedPaths":{"type":"keyword"},"author":{"properties":{"absoluteUrl":{"type":"keyword"},"fullName":{"type":"keyword"}}},"authorEmail":{"type":"keyword"},"comment":{"type":"keyword"},"commitId":{"type":"keyword"},"date":{"type":"keyword"},"id":{"type":"keyword"},"msg":{"type":"keyword"},"paths":{"properties":{"editType":{"type":"keyword"},"file":{"type":"keyword"}}},"timestamp":{"type":"long"}}},"kind":{"type":"keyword"}}},"channel_info":{"properties":{"created":{"type":"long"},"creator":{"type":"keyword"},"id":{"type":"keyword"},"is_archived":{"type":"boolean"},"is_channel":{"type":"boolean"},"is_general":{"type":"boolean"},"is_member":{"type":"boolean"},"is_mpim":{"type":"boolean"},"is_org_shared":{"type":"boolean"},"is_private":{"type":"boolean"},"is_shared":{"type":"boolean"},"last_read":{"type":"keyword"},"latest":{"type":"object","dynamic":"false"},"members":{"type":"keyword"},"name":{"type":"keyword"},"name_normalized":{"type":"keyword"},"num_members":{"type":"long"},"purpose":{"properties":{"creator":{"type":"keyword"},"last_set":{"type":"long"},"value":{"type":"keyword"}}},"topic":{"properties":{"creator":{"type":"keyword"},"last_set":{"type":"long"},"value":{"type":"keyword"}}},"unlinked":{"type":"long"},"unread_count":{"type":"long"},"unread_count_display":{"type":"long"}}},"client_msg_id":{"type":"keyword"},"culprits":{"properties":{"absoluteUrl":{"type":"keyword"},"fullName":{"type":"keyword"}}},"description":{"type":"keyword"},"displayName":{"type":"keyword"},"display_as_bot":{"type":"boolean"},"duration":{"type":"long"},"edited":{"properties":{"ts":{"type":"keyword"},"user":{"type":"keyword"}}},"estimatedDuration":{"type":"long"},"executor":{"properties":{"_class":{"type":"keyword"}}},"files":{"properties":{"created":{"type":"long"},"display_as_bot":{"type":"boolean"},"editable":{"type":"boolean"},"external_type":{"type":"keyword"},"filetype":{"type":"keyword"},"has_rich_preview":{"type":"boolean"},"id":{"type":"keyword"},"image_exif_rotation":{"type":"long"},"is_external":{"type":"boolean"},"is_public":{"type":"boolean"},"is_starred":{"type":"boolean"},"mimetype":{"type":"keyword"},"mode":{"type":"keyword"},"name":{"type":"keyword"},"original_h":{"type":"long"},"original_w":{"type":"long"},"permalink":{"type":"keyword"},"permalink_public":{"type":"keyword"},"pretty_type":{"type":"keyword"},"public_url_shared":{"type":"boolean"},"size":{"type":"long"},"thumb_1024":{"type":"keyword"},"thumb_1024_h":{"type":"long"},"thumb_1024_w":{"type":"long"},"thumb_160":{"type":"keyword"},"thumb_360":{"type":"keyword"},"thumb_360_h":{"type":"long"},"thumb_360_w":{"type":"long"},"thumb_480":{"type":"keyword"},"thumb_480_h":{"type":"long"},"thumb_480_w":{"type":"long"},"thumb_64":{"type":"keyword"},"thumb_720":{"type":"keyword"},"thumb_720_h":{"type":"long"},"thumb_720_w":{"type":"long"},"thumb_80":{"type":"keyword"},"thumb_800":{"type":"keyword"},"thumb_800_h":{"type":"long"},"thumb_800_w":{"type":"long"},"thumb_960":{"type":"keyword"},"thumb_960_h":{"type":"long"},"thumb_960_w":{"type":"long"},"thumb_tiny":{"type":"keyword"},"timestamp":{"type":"long"},"title":{"type":"keyword"},"url_private":{"type":"keyword"},"url_private_download":{"type":"keyword"},"user":{"type":"keyword"},"username":{"type":"keyword"}}},"fullDisplayName":{"type":"keyword"},"id":{"type":"keyword"},"inviter":{"type":"keyword"},"keepLog":{"type":"boolean"},"latest_reply":{"type":"keyword"},"nextBuild":{"properties":{"number":{"type":"long"},"url":{"type":"keyword"}}},"number":{"type":"long"},"parent_user_id":{"type":"keyword"},"previousBuild":{"properties":{"number":{"type":"long"},"url":{"type":"keyword"}}},"queueId":{"type":"long"},"reactions":{"properties":{"count":{"type":"long"},"name":{"type":"keyword"},"users":{"type":"keyword"}}},"replies":{"properties":{"ts":{"type":"keyword"},"user":{"type":"keyword"}}},"reply_count":{"type":"long"},"reply_users":{"type":"keyword"},"reply_users_count":{"type":"long"},"result":{"type":"keyword"},"root":{"type":"object","dynamic":"false"},"runs":{"type":"object","dynamic":"false"},"subBuilds":{"type":"object"},"subscribed":{"type":"boolean"},"subtype":{"type":"keyword"},"team":{"type":"keyword"},"text":{"type":"keyword"},"thread_ts":{"type":"keyword"},"timestamp":{"type":"long"},"ts":{"type":"keyword"},"type":{"type":"keyword"},"upload":{"type":"boolean"},"url":{"type":"keyword"},"user":{"type":"keyword"},"user_data":{"properties":{"color":{"type":"keyword"},"deleted":{"type":"boolean"},"id":{"type":"keyword"},"is_admin":{"type":"boolean"},"is_app_user":{"type":"boolean"},"is_bot":{"type":"boolean"},"is_owner":{"type":"boolean"},"is_primary_owner":{"type":"boolean"},"is_restricted":{"type":"boolean"},"is_ultra_restricted":{"type":"boolean"},"name":{"type":"keyword"},"profile":{"properties":{"avatar_hash":{"type":"keyword"},"display_name":{"type":"keyword"},"display_name_normalized":{"type":"keyword"},"email":{"type":"keyword"},"fields":{"properties":{"XfE42V6N4Q":{"properties":{"alt":{"type":"keyword"},"value":{"type":"keyword"}}}}},"first_name":{"type":"keyword"},"image_1024":{"type":"keyword"},"image_192":{"type":"keyword"},"image_24":{"type":"keyword"},"image_32":{"type":"keyword"},"image_48":{"type":"keyword"},"image_512":{"type":"keyword"},"image_72":{"type":"keyword"},"image_original":{"type":"keyword"},"is_custom_image":{"type":"boolean"},"last_name":{"type":"keyword"},"phone":{"type":"keyword"},"real_name":{"type":"keyword"},"real_name_normalized":{"type":"keyword"},"skype":{"type":"keyword"},"status_emoji":{"type":"keyword"},"status_expiration":{"type":"long"},"status_text":{"type":"keyword"},"status_text_canonical":{"type":"keyword"},"team":{"type":"keyword"},"title":{"type":"keyword"}}},"real_name":{"type":"keyword"},"team_id":{"type":"keyword"},"tz":{"type":"keyword"},"tz_label":{"type":"keyword"},"tz_offset":{"type":"long"},"updated":{"type":"long"}}}}},"metadata__timestamp":{"type":"date"},"metadata__updated_on":{"type":"date"},"origin":{"type":"keyword"},"perceval_version":{"type":"keyword"},"search_fields":{"properties":{"channel_id":{"type":"keyword"},"channel_name":{"type":"keyword"},"item_id":{"type":"keyword"},"number":{"type":"long"}}},"tag":{"type":"keyword"},"timestamp":{"type":"float"},"updated_on":{"type":"float"},"uuid":{"type":"keyword"}}}}`)

JenkinsRawMapping depicts the mapping of *-raw indexes

View Source
var JenkinsRichMapping = []byte(`{"mappings":{"dynamic_templates":[{"notanalyzed":{"match":"*","match_mapping_type":"string","mapping":{"type":"keyword"}}},{"formatdate":{"match":"*","match_mapping_type":"date","mapping":{"format":"strict_date_optional_time||epoch_millis","type":"date"}}}],"properties":{"author_bot":{"type":"boolean"},"author_domain":{"type":"keyword"},"author_gender":{"type":"keyword"},"author_gender_acc":{"type":"long"},"author_id":{"type":"keyword"},"author_multi_org_names":{"type":"keyword"},"author_name":{"type":"keyword"},"author_org_name":{"type":"keyword"},"author_user_name":{"type":"keyword"},"author_uuid":{"type":"keyword"},"avatar":{"type":"keyword"},"branch":{"type":"keyword"},"build":{"type":"long"},"build_date":{"type":"date"},"builtOn":{"type":"keyword"},"category":{"type":"keyword"},"channel_created":{"type":"long"},"channel_id":{"type":"keyword"},"channel_is_archived":{"type":"long"},"channel_is_general":{"type":"long"},"channel_is_starred":{"type":"long"},"channel_member_count":{"type":"long"},"channel_name":{"type":"keyword"},"channel_purpose":{"properties":{"creator":{"type":"keyword"},"last_set":{"type":"long"},"value":{"type":"keyword"}}},"channel_topic":{"properties":{"creator":{"type":"keyword"},"last_set":{"type":"long"},"value":{"type":"keyword"}}},"duration":{"type":"long"},"duration_days":{"type":"float"},"fullDisplayName":{"type":"keyword"},"fullDisplayName_analyzed":{"type":"text"},"grimoire_creation_date":{"type":"date"},"installer":{"type":"keyword"},"is_admin":{"type":"long"},"is_jenkins_job":{"type":"long"},"is_owner":{"type":"long"},"is_primary_owner":{"type":"long"},"is_slack_message":{"type":"long"},"job_build":{"type":"keyword"},"job_name":{"type":"keyword"},"job_url":{"type":"keyword"},"loop":{"type":"keyword"},"metadata__enriched_on":{"type":"date"},"metadata__gelk_backend_name":{"type":"keyword"},"metadata__gelk_version":{"type":"keyword"},"metadata__timestamp":{"type":"date"},"metadata__updated_on":{"type":"date"},"number_attachs":{"type":"long"},"origin":{"type":"keyword"},"pod":{"type":"keyword"},"profile_title":{"type":"keyword"},"project":{"type":"keyword"},"project_ts":{"type":"long"},"reaction_count":{"type":"long"},"reactions":{"type":"keyword"},"reply_count":{"type":"long"},"result":{"type":"keyword"},"subscribed":{"type":"long"},"subtype":{"type":"keyword"},"tag":{"type":"keyword"},"team_id":{"type":"keyword"},"testproject":{"type":"keyword"},"text":{"type":"keyword"},"text_analyzed":{"type":"text","fielddata":true},"type":{"type":"keyword"},"tz":{"type":"long"},"url":{"type":"keyword"},"user":{"type":"keyword"},"user_data_bot":{"type":"boolean"},"user_data_domain":{"type":"keyword"},"user_data_gender":{"type":"keyword"},"user_data_gender_acc":{"type":"long"},"user_data_id":{"type":"keyword"},"user_data_multi_org_names":{"type":"keyword"},"user_data_name":{"type":"keyword"},"user_data_org_name":{"type":"keyword"},"user_data_user_name":{"type":"keyword"},"user_data_uuid":{"type":"keyword"},"uuid":{"type":"keyword"}}}}`)

JenkinsRichMapping depicts the mapping of the enriched indexes

View Source
var NestedJobClasses map[string]string = map[string]string{
	"org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject": "CLASS_JOB_WORKFLOW_MULTIBRANCH",
	"com.cloudbees.hudson.plugins.folder.Folder":                            "CLASS_JOB_PLUGINS_FOLDER",
	"jenkins.branch.OrganizationFolder":                                     "CLASS_JOB_ORG_FOLDER",
}

NestedJobClasses is the map of the JOBS that might have nested jobs

Functions

This section is empty.

Types

type Aggregations

type Aggregations struct {
	LastDate LastDate `json:"last_date"`
}

Aggregations result

type Build

type Build struct {
	Class   string `json:"_class"`
	Actions []struct {
		Class  string `json:"_class,omitempty"`
		Causes []struct {
			Class            string `json:"_class"`
			ShortDescription string `json:"shortDescription"`
		} `json:"causes,omitempty"`
		BuildsByBranchName struct {
			RefsRemotesOriginMaster struct {
				Class       string      `json:"_class"`
				BuildNumber int         `json:"buildNumber"`
				BuildResult interface{} `json:"buildResult"`
				Marked      struct {
					SHA1   string `json:"SHA1"`
					Branch []struct {
						SHA1 string `json:"SHA1"`
						Name string `json:"name"`
					} `json:"branch"`
				} `json:"marked"`
				Revision struct {
					SHA1   string `json:"SHA1"`
					Branch []struct {
						SHA1 string `json:"SHA1"`
						Name string `json:"name"`
					} `json:"branch"`
				} `json:"revision"`
			} `json:"refs/remotes/origin/master"`
		} `json:"buildsByBranchName,omitempty"`
		LastBuiltRevision struct {
			SHA1   string `json:"SHA1"`
			Branch []struct {
				SHA1 string `json:"SHA1"`
				Name string `json:"name"`
			} `json:"branch"`
		} `json:"lastBuiltRevision,omitempty"`
		RemoteUrls []string `json:"remoteUrls,omitempty"`
		ScmName    string   `json:"scmName,omitempty"`
	} `json:"actions"`
	Artifacts []struct {
		DisplayPath  string `json:"displayPath"`
		FileName     string `json:"fileName"`
		RelativePath string `json:"relativePath"`
	} `json:"artifacts"`
	Building          bool        `json:"building"`
	Description       interface{} `json:"description"`
	DisplayName       string      `json:"displayName"`
	Duration          int         `json:"duration"`
	EstimatedDuration int         `json:"estimatedDuration"`
	Executor          interface{} `json:"executor"`
	FullDisplayName   string      `json:"fullDisplayName"`
	ID                string      `json:"id"`
	KeepLog           bool        `json:"keepLog"`
	Number            int         `json:"number"`
	QueueID           int         `json:"queueId"`
	Result            *string     `json:"result"`
	Timestamp         int64       `json:"timestamp"`
	URL               string      `json:"url"`
	BuiltOn           string      `json:"builtOn"`
	ChangeSet         struct {
		Class string        `json:"_class"`
		Items []interface{} `json:"items"`
		Kind  string        `json:"kind"`
	} `json:"changeSet"`
	Culprits []interface{} `json:"culprits"`
	Runs     []struct {
		Number int    `json:"number"`
		URL    string `json:"url"`
	} `json:"runs"`
}

Build is the single build in the response of the jenkins api to get the builds

type BuildResponse

type BuildResponse struct {
	Description       string      `json:"description"`
	DisplayName       string      `json:"displayName"`
	DisplayNameOrNull interface{} `json:"displayNameOrNull"`
	FullDisplayName   string      `json:"fullDisplayName"`
	FullName          string      `json:"fullName"`
	Name              string      `json:"name"`
	URL               string      `json:"url"`
	Builds            []Build     `json:"builds"`
}

BuildResponse struct represent the response of the jenkins api to get all the builds

type BuildServer

type BuildServer struct {
	Username string `json:"username"`
	Password string `json:"password"`
	URL      string `json:"url"`
	Project  string `json:"project"`
	Index    string `json:"index"`
}

BuildServer is a single Jenkins Configuration for a single project

type BuildsEnrich

type BuildsEnrich struct {
	MetadataUpdatedOn       time.Time   `json:"metadata__updated_on"`
	MetadataTimestamp       time.Time   `json:"metadata__timestamp"`
	Offset                  interface{} `json:"offset"`
	Origin                  string      `json:"origin"`
	Tag                     string      `json:"tag"`
	UUID                    string      `json:"uuid"`
	FullDisplayName         string      `json:"fullDisplayName"`
	URL                     string      `json:"url"`
	Result                  *string     `json:"result"`
	Duration                int         `json:"duration"`
	BuiltOn                 string      `json:"builtOn"`
	FullDisplayNameAnalyzed string      `json:"fullDisplayName_analyzed"`
	Build                   int         `json:"build"`
	JobURL                  string      `json:"job_url"`
	JobName                 string      `json:"job_name"`
	JobBuild                string      `json:"job_build"`
	BuildDate               time.Time   `json:"build_date"`
	DurationDays            float64     `json:"duration_days"`
	Category                string      `json:"category"`
	Installer               string      `json:"installer"`
	Scenario                interface{} `json:"scenario"`
	Testproject             string      `json:"testproject"`
	Pod                     string      `json:"pod"`
	Loop                    string      `json:"loop"`
	Branch                  string      `json:"branch"`
	GrimoireCreationDate    time.Time   `json:"grimoire_creation_date"`
	IsJenkinsJob            int         `json:"is_jenkins_job"`
	RepositoryLabels        interface{} `json:"repository_labels"`
	MetadataFilterRaw       interface{} `json:"metadata__filter_raw"`
	MetadataBackendVersion  string      `json:"metadata__backend_version"`
	MetadataBackendName     string      `json:"metadata__backend_name"`
	Project                 string      `json:"project"`
	MetadataEnrichedOn      time.Time   `json:"metadata__enriched_on"`
}

BuildsEnrich represents the schema for the enriched documents in ES

type BuildsRaw

type BuildsRaw struct {
	BackendName              string      `json:"backend_name"`
	BackendVersion           string      `json:"backend_version"`
	PercevalVersion          string      `json:"perceval_version"`
	Timestamp                float64     `json:"timestamp"`
	Origin                   string      `json:"origin"`
	UUID                     string      `json:"uuid"`
	UpdatedOn                float64     `json:"updated_on"`
	ClassifiedFieldsFiltered interface{} `json:"classified_fields_filtered"`
	Category                 string      `json:"category"`
	SearchFields             struct {
		ItemID string `json:"item_id"`
		Number int    `json:"number"`
	} `json:"search_fields"`
	Tag               string    `json:"tag"`
	Data              Build     `json:"data"`
	MetadataUpdatedOn time.Time `json:"metadata__updated_on"`
	MetadataTimestamp time.Time `json:"metadata__timestamp"`
	Installer         string    `json:"installer"`
}

BuildsRaw struct represent the schema of the raw documents in ES

type ESClientProvider

type ESClientProvider interface {
	Add(index string, documentID string, body []byte) ([]byte, error)
	CreateIndex(index string, body []byte) ([]byte, error)
	Bulk(body []byte) ([]byte, error)
	Get(index string, query map[string]interface{}, result interface{}) (err error)
	GetStat(index string, field string, aggType string, mustConditions []map[string]interface{}, mustNotConditions []map[string]interface{}) (result time.Time, err error)
	ReadWithScroll(index string, query map[string]interface{}, result interface{}, scrollID string) (err error)
	BulkInsert(data []elastic.BulkData) ([]byte, error)
}

ESClientProvider used in connecting to ES Client server

type Enricher

type Enricher struct {
	DSName                string // Datasource will be used as key for ES
	ElasticSearchProvider ESClientProvider
	BackendVersion        string
	ScrollSize            int
}

Enricher contains jenkins datasource enrich logic

func NewEnricher

func NewEnricher(backendVersion string, esClientProvider ESClientProvider, scrollSize int) *Enricher

NewEnricher initiates a new Enricher

func (*Enricher) EnrichItem

func (e *Enricher) EnrichItem(rawItem BuildsRaw, project string, now time.Time) (*BuildsEnrich, error)

EnrichItem enriches raw item

func (*Enricher) GetFetchedDataItem

func (e *Enricher) GetFetchedDataItem(buildServer *BuildServer, cmdLastDate *time.Time, lastDate *time.Time, noIncremental bool) (result *TopHits, err error)

GetFetchedDataItem gets fetched data items starting from lastDate

func (*Enricher) HandleMapping

func (e *Enricher) HandleMapping(index string) error

HandleMapping creates rich mapping

type Fetcher

type Fetcher struct {
	DSName                string // Datasource will be used as key for ES
	IncludeArchived       bool
	HTTPClientProvider    HTTPClientProvider
	ElasticSearchProvider ESClientProvider
	BackendVersion        string
}

Fetcher contains Jenkins datasource fetch logic

func NewFetcher

func NewFetcher(params *Params, httpClientProvider HTTPClientProvider, esClientProvider ESClientProvider) *Fetcher

NewFetcher initiates a new jenkins fetcher

func (*Fetcher) FetchBuilds

func (f *Fetcher) FetchBuilds(params *Params, jobURL string) (*BuildResponse, error)

FetchBuilds fetches all the builds associated with a jobURL provided

func (*Fetcher) FetchItem

func (f *Fetcher) FetchItem(params *Params) ([]BuildsRaw, error)

FetchItem pulls all the jobs and the builds data

func (*Fetcher) FetchJobs

func (f *Fetcher) FetchJobs(params *Params) (*JobResponse, error)

FetchJobs fetches the total jobs associated with the url provided

func (*Fetcher) FetchJobsByViews

func (f *Fetcher) FetchJobsByViews(params *Params) (*JobResponse, error)

FetchJobsByViews fetches the total jobs associated with the url provided

func (*Fetcher) GetLastDate

func (f *Fetcher) GetLastDate(buildServer BuildServer, now time.Time) (time.Time, error)

GetLastDate gets fetching lastDate

func (*Fetcher) HandleMapping

func (f *Fetcher) HandleMapping(index string) error

HandleMapping updates Jenkins raw mapping

func (*Fetcher) MapToJenkinsRaw

func (f *Fetcher) MapToJenkinsRaw(response *BuildResponse, params *Params, installers *map[string]string) []BuildsRaw

MapToJenkinsRaw maps the api response from jenkins to the BuildsRaw documents

type HTTPClientProvider

type HTTPClientProvider interface {
	Request(url string, method string, header map[string]string, body []byte, params map[string]string) (statusCode int, resBody []byte, err error)
}

HTTPClientProvider used in connecting to remote http server

type Hits

type Hits struct {
	Total    Total        `json:"total"`
	MaxScore float32      `json:"max_score"`
	Hits     []NestedHits `json:"hits"`
}

Hits result

type JobResponse

type JobResponse struct {
	Jobs []struct {
		Class string `json:"_class"`
		Name  string `json:"name"`
		URL   string `json:"url"`
		Color string `json:"color,omitempty"`
	} `json:"jobs"`
	URL   string `json:"url"`
	Views []struct {
		Class string `json:"_class"`
		Name  string `json:"name"`
		URL   string `json:"url"`
	} `json:"views"`
}

JobResponse struct represent the response of the Jenkins api to get all the jobs

type LastDate

type LastDate struct {
	Value         float64 `json:"value"`
	ValueAsString string  `json:"value_as_string"`
}

LastDate result

type Manager

type Manager struct {
	FetcherBackendVersion  string
	EnricherBackendVersion string
	EnrichOnly             bool
	Enrich                 bool
	ESUrl                  string
	ESUsername             string
	ESPassword             string
	HTTPTimeout            time.Duration
	BuildServers           []*BuildServer
	FromDate               *time.Time
	NoIncremental          bool
	BulkSize               int
	ESScrollSize           int
}

Manager describes Jenkins manager

func NewManager

func NewManager(
	fetcherBackendVersion string,
	enricherBackendVersion string,
	enrichOnly bool,
	enrich bool,
	eSUrl string,
	httpTimeout time.Duration,
	buildServers []*BuildServer,
	fromDate *time.Time,
	noIncremental bool,
	bulkSize int,
	scrollSize int,
) *Manager

NewManager initiates Jenkins manager instance

func (*Manager) Sync

func (m *Manager) Sync() error

Sync runs jenkins fetch and enrich according to passed parameters

type NestedHits

type NestedHits struct {
	Index  string     `json:"_index"`
	Type   string     `json:"_type"`
	ID     string     `json:"_id"`
	Score  float64    `json:"_score"`
	Source *BuildsRaw `json:"_source"`
}

NestedHits result

type Params

type Params struct {
	JenkinsURL     string
	Username       string
	Password       string
	Depth          int
	BackendVersion string
}

Params required parameters for Jenkins fetcher

type TopHits

type TopHits struct {
	ScrollID     string       `json:"_scroll_id"`
	Took         int          `json:"took"`
	Hits         Hits         `json:"hits"`
	Aggregations Aggregations `json:"aggregations"`
}

TopHits result

type Total

type Total struct {
	Value    int    `json:"value"`
	Relation string `json:"relation"`
}

Total result

Jump to

Keyboard shortcuts

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