jb

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false
View Source
var ErrNoEnv = errors.New("no env")
View Source
var ErrNoJob = errors.New("no job")

Functions

func Build

func Build(env Env, job string, query string) (error, string)

func CancelJob

func CancelJob(env Env, job string, id int) (string, error)

func CancelQueue

func CancelQueue(env Env, id int)

func Check

func Check(env Env) error

func Console

func Console(env Env, job string, id int, start string) (string, string, error)

func DelEnv

func DelEnv(name EName) error

func SetConf

func SetConf()

func SetDef

func SetDef(eName string)

func SetEnv

func SetEnv(env Env)

Types

type BuildInfo

type BuildInfo struct {
	Id      string `json:"id"`
	Actions []struct {
		Parameters []struct {
			Name  string `json:"name"`
			Value string `json:"value"`
		} `json:"parameters,omitempty"`
		Causes []struct {
			ShortDescription string `json:"shortDescription"`
			UpstreamBuild    int    `json:"upstreamBuild"`
			UpstreamProject  string `json:"upstreamProject"`
			UpstreamURL      string `json:"upstreamUrl"`
		} `json:"causes,omitempty"`
	} `json:"actions"`
	Duration int    `json:"duration"`
	Building bool   `json:"building"`
	Result   string `json:"result"`
	QueueId  int    `json:"queueId"`
}

func GetBuildInfo

func GetBuildInfo(env Env, job string, id int) (*BuildInfo, error)

func GetLastSuccessfulBuildInfo

func GetLastSuccessfulBuildInfo(env Env, job string) (*BuildInfo, error)

type Bundle

type Bundle struct {
	Name     EName     `json:"name"`
	Views    []View    `json:"views"`
	JobsInfo []JobInfo `json:"JobsInfo"`
}

func GetBundle

func GetBundle(env Env) *Bundle

type Config

type Config struct {
	Use  EName `yaml:"use"`
	Envs []Env `yaml:"envs"`
}

type EName

type EName string

func GetDefEnv

func GetDefEnv() EName

type EType

type EType string

func (EType) String

func (t EType) String() string

type Env

type Env struct {
	Url    string `yaml:"url"`
	Name   EName  `yaml:"name"`
	Type   EType  `yaml:"type"`
	Login  string `yaml:"login"`
	Secret string `yaml:"secret"`
}

func GetEnv

func GetEnv(name string) (error, Env)

func GetEnvs

func GetEnvs() []Env

func Init

func Init(envName string) Env

type Job

type Job struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type JobInfo

type JobInfo struct {
	Name               string `json:"name"`
	NextBuildNumber    int    `json:"nextBuildNumber"`
	DownstreamProjects []struct {
		Name string `json:"name"`
		URL  string `json:"url"`
	} `json:"downstreamProjects"`
	LastBuild struct {
		Number int    `json:"number"`
		URL    string `json:"url"`
	} `json:"lastBuild"`
	LastCompletedBuild struct {
		Number int    `json:"number"`
		URL    string `json:"url"`
	}
	InQueue  bool `json:"inQueue"`
	Property []struct {
		ParameterDefinitions []ParameterDefinitions `json:"parameterDefinitions,omitempty"`
	} `json:"property"`
}

func GetJobInfo

func GetJobInfo(env Env, jobName string) (error, *JobInfo)
func GetJobInfo(env Env, jobName string) JobInfo{
	var jobinfo JobInfo
	code, rsp, _, err := req(env,"job/"+jobName+"/api/json", []byte{})
	if err != nil {
		panic(err)
	}
	if code != 200 {
		panic("failed to get job details,code" + strconv.Itoa(code) + ", " + string(rsp))
	}
	err = json.Unmarshal(rsp, &jobinfo)
	if err!=nil{
		panic("failed to get Job information")
	}
	return jobinfo
}

func (*JobInfo) GetParameterDefinitions

func (ji *JobInfo) GetParameterDefinitions() []ParameterDefinitions

type ParameterDefinitions

type ParameterDefinitions struct {
	DefaultParameterValue struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"defaultParameterValue"`
	Description string   `json:"description"`
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Choices     []string `json:"choices,omitempty"`
}

type QueueInfo

type QueueInfo struct {
	Actions []struct {
		Parameters []struct {
			Name  string `json:"name"`
			Value string `json:"value"`
		} `json:"parameters,omitempty"`
		Causes []struct {
			ShortDescription string      `json:"shortDescription"`
			UserID           interface{} `json:"userId"`
			UserName         string      `json:"userName"`
		} `json:"causes,omitempty"`
	} `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        interface{} `json:"why"`
	Cancelled  bool        `json:"cancelled"`
	Executable struct {
		Number int    `json:"number"`
		URL    string `json:"url"`
	} `json:"executable"`
}

func GetQueueInfo

func GetQueueInfo(env Env, id int) (error, QueueInfo)

type Queues

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

func GetQueues

func GetQueues(env Env) Queues

type View

type View struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	Desc string `json:"desc"`
	Jobs []Job  `json:"jobs"`
}

Jump to

Keyboard shortcuts

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