dashboard

package module
v0.0.0-...-edb8809 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

Camunda-CI Dashboard

This package provides a biased Dashboard for Camunda-CIs Jenkins & Travis Broken Jobs board.

Build

Requirements:

  • Go 1.8
  • Make
  • Docker
git clone https://github.com/camunda-ci/camunda-ci-dashboard
cd camuda-ci-dashboard
make package

Usage

Docker Image:

docker run -t -e CCD_USERNAME=foo -e CCD_PASSWORD=bar registry.camunda.com/camunda-ci-dashboard:latest

Binary:

./camunda-ci-dashboard [--debug=true] --username=foo --password=bar --bindAddress=0.0.0.0:8000

Configuration

The Jenkins Username and Jenkins Password for Basic Auth can be set either using the cmdline flags, inside the .camunda-ci-dashboard.json config file or specified as environment variables.

  • CCD_USERNAME
  • CCD_PASSWORD
  • CCD_BINDADDRESS
  • CCD_DEBUG

Example Config

{
	"username": "<jenkins username>",
	"password": "<jenkins password>",
	"jenkins": {
		"Release": {
			"url": "http://release-cambpm-ui:8080",
			"publicUrl": "https://release.cambpm.camunda.cloud"
		},
		"Docs": {
			"url": "http://ci-cambpm-ui:8080",
			"brokenJobsUrl": "http://ci-cambpm-ui:8080/job/docs",
			"publicUrl": "https://ci.cambpm.camunda.cloud/job/docs"
		}
	},
	"travis": {
		"accessToken": "",
		"organizations": [
			{
				"name": "camunda",
				"repos": [
					{
						"name": "camunda-external-task-client-js"
					},
					{
						"name": "camunda-bpm-assert-scenario"
					}
				]
			}
		]
	}
}

Documentation

Index

Constants

View Source
const (
	TravisApiUrl = travis.ApiOrgUrl
)

Variables

View Source
var (
	// Debug set to true enable request debugging
	Debug = false
)

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	Name   string `json:"name"`
	Url    string `json:"url"`
	Type   string `json:"type"`
	Status Status `json:"status"`
}

type Dashboard

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

Dashboard is a container for all configured JenkinsInstance's.

func Init

func Init(jenkinsInstances []*JenkinsInstance, travisInstances []*TravisInstance,
	jenkinsUsername string, jenkinsPassword string) *Dashboard

Init initializes the Dashboard with the given JenkinsInstance's and how to access them.

func (*Dashboard) GetBrokenJenkinsBuilds

func (d *Dashboard) GetBrokenJenkinsBuilds() []*JenkinsAggregation

GetBrokenJenkinsBuilds retrieves the failed builds displayed on the Broken page from all configured JenkinsInstance's.

func (*Dashboard) GetBrokenTravisBuilds

func (d *Dashboard) GetBrokenTravisBuilds() []*TravisAggregation

type Jenkins

type Jenkins interface {
	GetQueue() (*JenkinsQueue, error)
	GetJobsFromView(viewName string) ([]JenkinsJob, error)
	GetJobsFromViewWithTree(viewName string, tree string) ([]JenkinsJob, error)
	GetJobsFromViewByPath(path string) ([]JenkinsJob, error)
	GetJobsFromViewWithTreeByPath(path string, tree string) ([]JenkinsJob, error)
	GetOverallLoad() (*JenkinsOverallLoad, error)
	GetExecutors() (*JenkinsExecutors, error)
	GetBusyExecutors() (int, error)
}

Jenkins is high-level API for accessing the underlying Jenkins instance.

func NewJenkinsClient

func NewJenkinsClient(url string, username string, password string) Jenkins

NewJenkinsClient returns a new Jenkins instance with the given url, username and password.

type JenkinsAggregation

type JenkinsAggregation struct {
	Aggregation
	BrokenJobsUrl  string       `json:"brokenJobsUrl"`
	PublicUrl      string       `json:"publicUrl"`
	BusyExecutors  int          `json:"busyExecutors"`
	BuildQueueSize int          `json:"buildQueueSize"`
	Jobs           []JenkinsJob `json:"jobs"`
}

Holds all dashboard relevant informations for a Jenkins instance

type JenkinsAggregations

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

JenkinsAggregations is a container for all retrieved JenkinsAggregation

type JenkinsClient

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

JenkinsClient implements the Jenkins interface and holds the client connected to the underlying Jenkins instance.

func (*JenkinsClient) GetBusyExecutors

func (j *JenkinsClient) GetBusyExecutors() (int, error)

GetBusyExecutors returns the number of currently occupied JenkinsExecutors of the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetExecutors

func (j *JenkinsClient) GetExecutors() (*JenkinsExecutors, error)

GetExecutors returns the currently configured JenkinsExecutors of the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetJobsFromView

func (j *JenkinsClient) GetJobsFromView(viewName string) ([]JenkinsJob, error)

GetJobsFromView returns a slice with all Jobs from a given JenkinsView name from the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetJobsFromViewByPath

func (j *JenkinsClient) GetJobsFromViewByPath(path string) ([]JenkinsJob, error)

GetJobsFromViewByPath returns a slice with all Jobs from a given JenkinsView name from the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetJobsFromViewWithTree

func (j *JenkinsClient) GetJobsFromViewWithTree(viewName string, tree string) ([]JenkinsJob, error)

GetJobsFromViewWithTree returns a slice with all Jobs from a given JenkinsView name, restricting the returned attributes by the given tree string. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetJobsFromViewWithTreeByPath

func (j *JenkinsClient) GetJobsFromViewWithTreeByPath(path string, tree string) ([]JenkinsJob, error)

GetJobsFromViewWithTreeByPath returns a slice with all Jobs from a given JenkinsView name, restricting the returned attributes by the given tree string. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetOverallLoad

func (j *JenkinsClient) GetOverallLoad() (*JenkinsOverallLoad, error)

GetOverallLoad returns the JenkinsOverallLoad of the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

func (*JenkinsClient) GetQueue

func (j *JenkinsClient) GetQueue() (*JenkinsQueue, error)

GetQueue retrieves the JenkinsQueue of the underlying Jenkins instance. It will return an error, if the connection or the JSON un-marshalling breaks.

type JenkinsExecutors

type JenkinsExecutors struct {
	BusyExecutors int `json:"busyExecutors"`
	Computer      []struct {
		Actions []struct {
		} `json:"actions"`
		DisplayName string `json:"displayName"`
		Executors   []struct {
		} `json:"executors"`
		Icon            string `json:"icon"`
		IconClassName   string `json:"iconClassName"`
		Idle            bool   `json:"idle"`
		JnlpAgent       bool   `json:"jnlpAgent"`
		LaunchSupported bool   `json:"launchSupported"`
		LoadStatistics  struct {
		} `json:"loadStatistics"`
		ManualLaunchAllowed bool `json:"manualLaunchAllowed"`
		MonitorData         struct {
			HudsonNodeMonitorsSwapSpaceMonitor struct {
				AvailablePhysicalMemory int64 `json:"availablePhysicalMemory"`
				AvailableSwapSpace      int64 `json:"availableSwapSpace"`
				TotalPhysicalMemory     int64 `json:"totalPhysicalMemory"`
				TotalSwapSpace          int64 `json:"totalSwapSpace"`
			} `json:"hudson.node_monitors.SwapSpaceMonitor"`
			HudsonNodeMonitorsArchitectureMonitor string `json:"hudson.node_monitors.ArchitectureMonitor"`
			HudsonNodeMonitorsResponseTimeMonitor struct {
				Average int `json:"average"`
			} `json:"hudson.node_monitors.ResponseTimeMonitor"`
			HudsonNodeMonitorsTemporarySpaceMonitor struct {
				Path string `json:"path"`
				Size int64  `json:"size"`
			} `json:"hudson.node_monitors.TemporarySpaceMonitor"`
			HudsonNodeMonitorsDiskSpaceMonitor struct {
				Path string `json:"path"`
				Size int64  `json:"size"`
			} `json:"hudson.node_monitors.DiskSpaceMonitor"`
			HudsonNodeMonitorsClockMonitor struct {
				Diff int `json:"diff"`
			} `json:"hudson.node_monitors.ClockMonitor"`
		} `json:"monitorData"`
		NumExecutors       int           `json:"numExecutors"`
		Offline            bool          `json:"offline"`
		OfflineCause       interface{}   `json:"offlineCause"`
		OfflineCauseReason string        `json:"offlineCauseReason"`
		OneOffExecutors    []interface{} `json:"oneOffExecutors"`
		TemporarilyOffline bool          `json:"temporarilyOffline"`
	} `json:"computer"`
	DisplayName    string `json:"displayName"`
	TotalExecutors int    `json:"totalExecutors"`
}

represents the configured executors of the underlying Jenkins instance.

func (*JenkinsExecutors) String

func (e *JenkinsExecutors) String() string

type JenkinsInstance

type JenkinsInstance struct {
	Name          string
	Url           string
	BrokenJobsUrl string
	PublicUrl     string
	Client        Jenkins
}

JenkinsInstance holds basic informations about a Jenkins instance and the client connected to it.

type JenkinsJob

type JenkinsJob struct {
	Name      string `json:"name"`
	URL       string `json:"url"`
	Color     string `json:"color"`
	LastBuild struct {
		Actions []struct {
			FailCount          int           `json:"failCount,omitempty"`
			SkipCount          int           `json:"skipCount,omitempty"`
			TotalCount         int           `json:"totalCount,omitempty"`
			FoundFailureCauses []interface{} `json:"foundFailureCauses,omitempty"`
		} `json:"actions"`
	} `json:"lastBuild"`
}

func (*JenkinsJob) String

func (j *JenkinsJob) String() string

type JenkinsOverallLoad

type JenkinsOverallLoad struct {
	AvailableExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"availableExecutors"`
	BusyExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"busyExecutors"`
	ConnectingExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"connectingExecutors"`
	DefinedExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"definedExecutors"`
	IdleExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"idleExecutors"`
	OnlineExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"onlineExecutors"`
	QueueLength struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"queueLength"`
	TotalExecutors struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"totalExecutors"`
	TotalQueueLength struct {
		Hour struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"hour"`
		Min struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"min"`
		Sec10 struct {
			History []float64 `json:"history"`
			Latest  float64   `json:"latest"`
		} `json:"sec10"`
	} `json:"totalQueueLength"`
}

represents the overall load of the underlying Jenkins instance.

func (*JenkinsOverallLoad) String

func (o *JenkinsOverallLoad) String() string

type JenkinsQueue

type JenkinsQueue struct {
	Items []struct {
		Actions []struct {
			Causes []struct {
				ShortDescription string `json:"shortDescription"`
				UpstreamBuild    int    `json:"upstreamBuild"`
				UpstreamProject  string `json:"upstreamProject"`
				UpstreamURL      string `json:"upstreamUrl"`
			} `json:"causes"`
		} `json:"actions"`
		Blocked      bool   `json:"blocked"`
		Buildable    bool   `json:"buildable"`
		ID           int    `json:"id"`
		InQueueSince int64  `json:"inQueueSince"`
		Params       string `json:"params"`
		Stuck        bool   `json:"stuck"`
		Task         struct {
			Name  string `json:"name"`
			URL   string `json:"url"`
			Color string `json:"color"`
		} `json:"task"`
		URL                        string `json:"url"`
		Why                        string `json:"why"`
		BuildableStartMilliseconds int64  `json:"buildableStartMilliseconds"`
		Pending                    bool   `json:"pending"`
	} `json:"items"`
}

JenkinsQueue represents the Jenkins Build queue.

func (*JenkinsQueue) String

func (q *JenkinsQueue) String() string

type JenkinsView

type JenkinsView struct {
	Jobs []JenkinsJob `json:"jobs"`
}

JenkinsView represents a view inside Jenkins including all jobs on it.

func (*JenkinsView) String

func (v *JenkinsView) String() string

type Status

type Status bool

status describes the current state of the instance. 'ok', when the client was able to connect to it, or 'not available', when the connection was unsuccessful.

type Travis

type Travis interface {
	Job(r TravisRepository) (TravisJob, error)
}

func NewTravisClient

func NewTravisClient(baseUrl string, apiToken string) Travis

type TravisAggregation

type TravisAggregation struct {
	Aggregation
	Jobs []TravisJob `json:"jobs"`
}

Holds all dashboard relevant informations for a Travis instance

type TravisBuildStatus

type TravisBuildStatus bool

type TravisClient

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

func (*TravisClient) Job

type TravisInstance

type TravisInstance struct {
	Name   string
	Repos  []TravisRepository
	Client Travis
}

func (*TravisInstance) Url

func (t *TravisInstance) Url() string

type TravisJob

type TravisJob struct {
	Name  string `json:"name"`
	URL   string `json:"url"`
	Color string `json:"color"`
}

func (TravisJob) IsSuccessful

func (j TravisJob) IsSuccessful() bool

type TravisRepository

type TravisRepository struct {
	Organization string
	Name         string
	Branch       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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