gojenkins

package
v0.0.0-...-03b00cc Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

README

Jenkins API Client for Go

About

Jenkins is the most popular Open Source Continuous Integration system. This Library will help you interact with Jenkins in a more developer-friendly way.

Fork From https://github.com/bndr/gojenkins

These are some of the features that are currently implemented:

  • Get information on test-results of completed/failed build
  • Ability to query Nodes, and manipulate them. Start, Stop, set Offline.
  • Ability to query Jobs, and manipulate them.
  • Get Plugins, Builds, Artifacts, Fingerprints
  • Validate Fingerprints of Artifacts
  • Get Current Queue, Cancel Tasks
  • etc. For all methods go to GoDoc Reference.

Add some features:

  • Credentials Management
  • Pipeline Model Converter
  • RBAC control

Documentation

Overview

Gojenkins is a Jenkins Client in Go, that exposes the jenkins REST api in a more developer friendly way.

Index

Constants

View Source
const (
	STATUS_FAIL           = "FAIL"
	STATUS_ERROR          = "ERROR"
	STATUS_ABORTED        = "ABORTED"
	STATUS_REGRESSION     = "REGRESSION"
	STATUS_SUCCESS        = "SUCCESS"
	STATUS_FIXED          = "FIXED"
	STATUS_PASSED         = "PASSED"
	RESULT_STATUS_FAILURE = "FAILURE"
	RESULT_STATUS_FAILED  = "FAILED"
	RESULT_STATUS_SKIPPED = "SKIPPED"
	STR_RE_SPLIT_VIEW     = "(.*)/view/([^/]*)/?"
)
View Source
const (
	GLOBAL_ROLE  = "globalRoles"
	PROJECT_ROLE = "projectRoles"
)
View Source
const DirectKubeconfigCredentialStaperClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials$DirectEntryKubeconfigSource"
View Source
const DirectSSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"
View Source
const GLOBALScope = "GLOBAL"
View Source
const KubeconfigCredentialStaplerClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials"
View Source
const SSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
View Source
const SecretTextCredentialStaplerClass = "org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl"
View Source
const UsernamePassswordCredentialStaplerClass = "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"

Variables

View Source
var (
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
)

Loggers

View Source
var (
	LIST_VIEW      = "hudson.model.ListView"
	NESTED_VIEW    = "hudson.plugins.nested_view.NestedView"
	MY_VIEW        = "hudson.model.MyView"
	DASHBOARD_VIEW = "hudson.plugins.view.dashboard.Dashboard"
	PIPELINE_VIEW  = "au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView"
)

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func Reverse

func Reverse(s string) string

Types

type APIRequest

type APIRequest struct {
	Method   string
	Endpoint string
	Payload  io.Reader
	Headers  http.Header
	Suffix   string
}

func NewAPIRequest

func NewAPIRequest(method string, endpoint string, payload io.Reader) *APIRequest

func (*APIRequest) SetHeader

func (ar *APIRequest) SetHeader(key string, value string) *APIRequest

type Artifact

type Artifact struct {
	Jenkins  *Jenkins
	Build    *Build
	FileName string
	Path     string
}

Represents an Artifact

func (Artifact) GetData

func (a Artifact) GetData() ([]byte, error)

Get raw byte data of Artifact

func (Artifact) Save

func (a Artifact) Save(path string) (bool, error)

Save artifact to a specific path, using your own filename.

func (Artifact) SaveToDir

func (a Artifact) SaveToDir(dir string) (bool, error)

Save Artifact to directory using Artifact filename.

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

Basic Authentication

type Build

type Build struct {
	Raw     *BuildResponse
	Job     *Job
	Jenkins *Jenkins
	Base    string
	Depth   int
}

func (*Build) GetActions

func (b *Build) GetActions() []GeneralObj

func (*Build) GetAllFingerPrints

func (b *Build) GetAllFingerPrints() []*FingerPrint

func (*Build) GetArtifacts

func (b *Build) GetArtifacts() []Artifact

func (*Build) GetBuildNumber

func (b *Build) GetBuildNumber() int64

func (*Build) GetCauses

func (b *Build) GetCauses() ([]map[string]interface{}, error)

func (*Build) GetConsoleOutput

func (b *Build) GetConsoleOutput() string

func (*Build) GetCulprits

func (b *Build) GetCulprits() []Culprit

func (*Build) GetDownstreamBuilds

func (b *Build) GetDownstreamBuilds() ([]*Build, error)

func (*Build) GetDownstreamJobNames

func (b *Build) GetDownstreamJobNames() []string

func (*Build) GetDuration

func (b *Build) GetDuration() int64

func (*Build) GetInjectedEnvVars

func (b *Build) GetInjectedEnvVars() (map[string]string, error)

func (*Build) GetMatrixRuns

func (b *Build) GetMatrixRuns() ([]*Build, error)

func (*Build) GetParameters

func (b *Build) GetParameters() []parameter

func (*Build) GetResult

func (b *Build) GetResult() string

func (*Build) GetResultSet

func (b *Build) GetResultSet() (*TestResult, error)

func (*Build) GetRevision

func (b *Build) GetRevision() string

func (*Build) GetRevisionBranch

func (b *Build) GetRevisionBranch() string

func (*Build) GetTimestamp

func (b *Build) GetTimestamp() time.Time

func (*Build) GetUpstreamBuild

func (b *Build) GetUpstreamBuild() (*Build, error)

func (*Build) GetUpstreamBuildNumber

func (b *Build) GetUpstreamBuildNumber() (int64, error)

func (*Build) GetUpstreamJob

func (b *Build) GetUpstreamJob() (*Job, error)

func (*Build) GetUrl

func (b *Build) GetUrl() string

func (*Build) Info

func (b *Build) Info() *BuildResponse

Builds

func (*Build) IsGood

func (b *Build) IsGood() bool

func (*Build) IsRunning

func (b *Build) IsRunning() bool

func (*Build) PauseToggle

func (b *Build) PauseToggle() error

func (*Build) Poll

func (b *Build) Poll(options ...interface{}) (int, error)

Poll for current data. Optional parameter - depth. More about depth here: https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

func (*Build) SetDescription

func (b *Build) SetDescription(description string) error

func (*Build) Stop

func (b *Build) Stop() (bool, error)

type BuildResponse

type BuildResponse struct {
	Actions   []GeneralObj
	Artifacts []struct {
		DisplayPath  string `json:"displayPath"`
		FileName     string `json:"fileName"`
		RelativePath string `json:"relativePath"`
	} `json:"artifacts"`
	Building  bool   `json:"building"`
	BuiltOn   string `json:"builtOn"`
	ChangeSet struct {
		Items []struct {
			AffectedPaths []string `json:"affectedPaths"`
			Author        struct {
				AbsoluteUrl string `json:"absoluteUrl"`
				FullName    string `json:"fullName"`
			} `json:"author"`
			Comment  string `json:"comment"`
			CommitID string `json:"commitId"`
			Date     string `json:"date"`
			ID       string `json:"id"`
			Msg      string `json:"msg"`
			Paths    []struct {
				EditType string `json:"editType"`
				File     string `json:"file"`
			} `json:"paths"`
			Timestamp int64 `json:"timestamp"`
		} `json:"items"`
		Kind      string `json:"kind"`
		Revisions []struct {
			Module   string
			Revision int
		} `json:"revision"`
	} `json:"changeSet"`
	Culprits          []Culprit   `json:"culprits"`
	Description       interface{} `json:"description"`
	Duration          int64       `json:"duration"`
	EstimatedDuration int64       `json:"estimatedDuration"`
	Executor          interface{} `json:"executor"`
	FullDisplayName   string      `json:"fullDisplayName"`
	ID                string      `json:"id"`
	KeepLog           bool        `json:"keepLog"`
	Number            int64       `json:"number"`
	QueueID           int64       `json:"queueId"`
	Result            string      `json:"result"`
	Timestamp         int64       `json:"timestamp"`
	URL               string      `json:"url"`
	MavenArtifacts    interface{} `json:"mavenArtifacts"`
	MavenVersionUsed  string      `json:"mavenVersionUsed"`
	FingerPrint       []FingerPrintResponse
	Runs              []struct {
		Number int64
		URL    string
	} `json:"runs"`
}

type BuildRevision

type BuildRevision struct {
	SHA1   string   `json:"SHA1,omitempty"`
	Branch []branch `json:"branch,omitempty"`
}

type Builds

type Builds struct {
	BuildNumber int64         `json:"buildNumber"`
	BuildResult interface{}   `json:"buildResult"`
	Marked      BuildRevision `json:"marked"`
	Revision    BuildRevision `json:"revision"`
}

type Computers

type Computers struct {
	BusyExecutors  int             `json:"busyExecutors"`
	Computers      []*NodeResponse `json:"computer"`
	DisplayName    string          `json:"displayName"`
	TotalExecutors int             `json:"totalExecutors"`
}

type CreateKubeconfigCredentialRequest

type CreateKubeconfigCredentialRequest struct {
	Credentials KubeconfigCredential `json:"credentials"`
}

func NewCreateKubeconfigCredentialRequest

func NewCreateKubeconfigCredentialRequest(id, content, description string) *CreateKubeconfigCredentialRequest

type CreateSecretTextCredentialRequest

type CreateSecretTextCredentialRequest struct {
	Credentials SecretTextCredential `json:"credentials"`
}

func NewCreateSecretTextCredentialRequest

func NewCreateSecretTextCredentialRequest(id, secret, description string) *CreateSecretTextCredentialRequest

type CreateSshCredentialRequest

type CreateSshCredentialRequest struct {
	Credentials SshCredential `json:"credentials"`
}

func NewCreateSshCredentialRequest

func NewCreateSshCredentialRequest(id, username, passphrase, privateKey, description string) *CreateSshCredentialRequest

type CreateUsernamePasswordCredentialRequest

type CreateUsernamePasswordCredentialRequest struct {
	Credentials UsernamePasswordCredential `json:"credentials"`
}

func NewCreateUsernamePasswordRequest

func NewCreateUsernamePasswordRequest(id, username, password, description string) *CreateUsernamePasswordCredentialRequest

type CredentialResponse

type CredentialResponse struct {
	Id          string `json:"id"`
	TypeName    string `json:"typeName"`
	DisplayName string `json:"displayName"`
	Fingerprint *struct {
		FileName string `json:"fileName,omitempty"`
		Hash     string `json:"hash,omitempty"`
		Usage    []*struct {
			Name   string `json:"name,omitempty"`
			Ranges struct {
				Ranges []*struct {
					Start int `json:"start"`
					End   int `json:"end"`
				} `json:"ranges"`
			} `json:"ranges"`
		} `json:"usage,omitempty"`
	} `json:"fingerprint,omitempty"`
	Description string `json:"description"`
	Domain      string `json:"domain"`
}

type Culprit

type Culprit struct {
	AbsoluteUrl string
	FullName    string
}

type ErrorResponse

type ErrorResponse struct {
	Body     []byte
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Executor

type Executor struct {
	Raw     *ExecutorResponse
	Jenkins *Jenkins
}

type ExecutorResponse

type ExecutorResponse struct {
	AssignedLabels  []struct{}  `json:"assignedLabels"`
	Description     interface{} `json:"description"`
	Jobs            []InnerJob  `json:"jobs"`
	Mode            string      `json:"mode"`
	NodeDescription string      `json:"nodeDescription"`
	NodeName        string      `json:"nodeName"`
	NumExecutors    int64       `json:"numExecutors"`
	OverallLoad     struct{}    `json:"overallLoad"`
	PrimaryView     struct {
		Name string `json:"name"`
		URL  string `json:"url"`
	} `json:"primaryView"`
	QuietingDown   bool       `json:"quietingDown"`
	SlaveAgentPort int64      `json:"slaveAgentPort"`
	UnlabeledLoad  struct{}   `json:"unlabeledLoad"`
	UseCrumbs      bool       `json:"useCrumbs"`
	UseSecurity    bool       `json:"useSecurity"`
	Views          []ViewData `json:"views"`
}

type FingerPrint

type FingerPrint struct {
	Jenkins *Jenkins
	Base    string
	Id      string
	Raw     *FingerPrintResponse
}

func (FingerPrint) GetInfo

func (f FingerPrint) GetInfo() (*FingerPrintResponse, error)

func (FingerPrint) Poll

func (f FingerPrint) Poll() (int, error)

func (FingerPrint) Valid

func (f FingerPrint) Valid() (bool, error)

func (FingerPrint) ValidateForBuild

func (f FingerPrint) ValidateForBuild(filename string, build *Build) (bool, error)

type FingerPrintResponse

type FingerPrintResponse struct {
	FileName string `json:"fileName"`
	Hash     string `json:"hash"`
	Original struct {
		Name   string
		Number int64
	} `json:"original"`
	Timestamp int64 `json:"timestamp"`
	Usage     []struct {
		Name   string `json:"name"`
		Ranges struct {
			Ranges []struct {
				End   int64 `json:"end"`
				Start int64 `json:"start"`
			} `json:"ranges"`
		} `json:"ranges"`
	} `json:"usage"`
}

type Folder

type Folder struct {
	Raw     *FolderResponse
	Jenkins *Jenkins
	Base    string
}

func (*Folder) Create

func (f *Folder) Create(name, description string) (*Folder, error)

func (*Folder) GetName

func (f *Folder) GetName() string

func (*Folder) Poll

func (f *Folder) Poll() (int, error)

type FolderResponse

type FolderResponse struct {
	Actions     []GeneralObj
	Description string     `json:"description"`
	DisplayName string     `json:"displayName"`
	Name        string     `json:"name"`
	URL         string     `json:"url"`
	Jobs        []InnerJob `json:"jobs"`
	PrimaryView *ViewData  `json:"primaryView"`
	Views       []ViewData `json:"views"`
}

type GeneralObj

type GeneralObj struct {
	Parameters              []parameter              `json:"parameters,omitempty"`
	Causes                  []map[string]interface{} `json:"causes,omitempty"`
	BuildsByBranchName      map[string]Builds        `json:"buildsByBranchName,omitempty"`
	LastBuiltRevision       *BuildRevision           `json:"lastBuiltRevision,omitempty"`
	RemoteUrls              []string                 `json:"remoteUrls,omitempty"`
	ScmName                 string                   `json:"scmName,omitempty"`
	MercurialNodeName       string                   `json:"mercurialNodeName,omitempty"`
	MercurialRevisionNumber string                   `json:"mercurialRevisionNumber,omitempty"`
	Subdir                  interface{}              `json:"subdir,omitempty"`
	ClassName               string                   `json:"_class,omitempty"`
	SonarTaskId             string                   `json:"ceTaskId,omitempty"`
	SonarServerUrl          string                   `json:"serverUrl,omitempty"`
	SonarDashboardUrl       string                   `json:"sonarqubeDashboardUrl,omitempty"`
	TotalCount              int64                    `json:",omitempty"`
	UrlName                 string                   `json:",omitempty"`
}

type GlobalPermissionIds

type GlobalPermissionIds struct {
	Administer              bool `json:"hudson.model.Hudson.Administer"`
	GlobalRead              bool `json:"hudson.model.Hudson.Read"`
	CredentialCreate        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Create"`
	CredentialUpdate        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Update"`
	CredentialView          bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.View"`
	CredentialDelete        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Delete"`
	CredentialManageDomains bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains"`
	SlaveCreate             bool `json:"hudson.model.Computer.Create"`
	SlaveConfigure          bool `json:"hudson.model.Computer.Configure"`
	SlaveDelete             bool `json:"hudson.model.Computer.Delete"`
	SlaveBuild              bool `json:"hudson.model.Computer.Build"`
	SlaveConnect            bool `json:"hudson.model.Computer.Connect"`
	SlaveDisconnect         bool `json:"hudson.model.Computer.Disconnect"`
	ItemBuild               bool `json:"hudson.model.Item.Build"`
	ItemCreate              bool `json:"hudson.model.Item.Create"`
	ItemRead                bool `json:"hudson.model.Item.Read"`
	ItemConfigure           bool `json:"hudson.model.Item.Configure"`
	ItemCancel              bool `json:"hudson.model.Item.Cancel"`
	ItemMove                bool `json:"hudson.model.Item.Move"`
	ItemDiscover            bool `json:"hudson.model.Item.Discover"`
	ItemWorkspace           bool `json:"hudson.model.Item.Workspace"`
	ItemDelete              bool `json:"hudson.model.Item.Delete"`
	RunUpdate               bool `json:"hudson.model.Run.Update"`
	RunDelete               bool `json:"hudson.model.Run.Delete"`
	ViewCreate              bool `json:"hudson.model.View.Create"`
	ViewConfigure           bool `json:"hudson.model.View.Configure"`
	ViewRead                bool `json:"hudson.model.View.Read"`
	ViewDelete              bool `json:"hudson.model.View.Delete"`
	SCMTag                  bool `json:"hudson.scm.SCM.Tag"`
}

type GlobalRole

type GlobalRole struct {
	Jenkins *Jenkins
	Raw     GlobalRoleResponse
}

func (*GlobalRole) AssignRole

func (j *GlobalRole) AssignRole(sid string) error

func (*GlobalRole) UnAssignRole

func (j *GlobalRole) UnAssignRole(sid string) error

func (*GlobalRole) Update

func (j *GlobalRole) Update(ids GlobalPermissionIds) error

type GlobalRoleResponse

type GlobalRoleResponse struct {
	RoleName      string              `json:"roleName"`
	PermissionIds GlobalPermissionIds `json:"permissionIds"`
}

type History

type History struct {
	BuildNumber    int
	BuildStatus    string
	BuildTimestamp int64
}

type InnerJob

type InnerJob struct {
	Name  string `json:"name"`
	Url   string `json:"url"`
	Color string `json:"color"`
}

type Jenkins

type Jenkins struct {
	Server    string
	Version   string
	Raw       *ExecutorResponse
	Requester *Requester
}

func CreateJenkins

func CreateJenkins(client *http.Client, base string, maxConnection int, auth ...interface{}) *Jenkins

Creates a new Jenkins Instance Optional parameters are: client, username, password After creating an instance call init method.

func (*Jenkins) AddGlobalRole

func (j *Jenkins) AddGlobalRole(roleName string, ids GlobalPermissionIds, overwrite bool) (*GlobalRole, error)

func (*Jenkins) AddProjectRole

func (j *Jenkins) AddProjectRole(roleName string, pattern string, ids ProjectPermissionIds, overwrite bool) (*ProjectRole, error)

func (*Jenkins) BuildJob

func (j *Jenkins) BuildJob(name string, options ...interface{}) (int64, error)

Invoke a job. First parameter job name, second parameter is optional Build parameters.

func (*Jenkins) CopyJob

func (j *Jenkins) CopyJob(copyFrom string, newName string) (*Job, error)

Create a copy of a job. First parameter Name of the job to copy from, Second parameter new job name.

func (*Jenkins) CreateFolder

func (j *Jenkins) CreateFolder(name, description string, parents ...string) (*Folder, error)

Create a new folder This folder can be nested in other parent folders Example: jenkins.CreateFolder("newFolder", "grandparentFolder", "parentFolder")

func (*Jenkins) CreateJob

func (j *Jenkins) CreateJob(config string, options ...interface{}) (*Job, error)

Create a new job from config File Method takes XML string as first parameter, and if the name is not specified in the config file takes name as string as second parameter e.g jenkins.CreateJob("<config></config>","newJobName")

func (*Jenkins) CreateJobInFolder

func (j *Jenkins) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)

Create a new job in the folder Example: jenkins.CreateJobInFolder("<config></config>", "newJobName", "myFolder", "parentFolder")

func (*Jenkins) CreateKubeconfigCredentialInFolder

func (j *Jenkins) CreateKubeconfigCredentialInFolder(domain, id, content, description string, folders ...string) (*string, error)

func (*Jenkins) CreateNode

func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, label string, options ...interface{}) (*Node, error)

Create a new Node Can be JNLPLauncher or SSHLauncher Example : jenkins.CreateNode("nodeName", 1, "Description", "/var/lib/jenkins", "jdk8 docker", map[string]string{"method": "JNLPLauncher"}) By Default JNLPLauncher is created Multiple labels should be separated by blanks

func (*Jenkins) CreateSecretTextCredentialInFolder

func (j *Jenkins) CreateSecretTextCredentialInFolder(domain, id, secret, description string, folders ...string) (*string, error)

func (*Jenkins) CreateSshCredential

func (j *Jenkins) CreateSshCredential(id, username, passphrase, privateKey, description string) (*string, error)

Create a ssh credentials return credentials id

func (*Jenkins) CreateSshCredentialInFolder

func (j *Jenkins) CreateSshCredentialInFolder(domain, id, username, passphrase, privateKey, description string, folders ...string) (*string, error)

func (*Jenkins) CreateUsernamePasswordCredential

func (j *Jenkins) CreateUsernamePasswordCredential(id, username, password, description string) (*string, error)

func (*Jenkins) CreateUsernamePasswordCredentialInFolder

func (j *Jenkins) CreateUsernamePasswordCredentialInFolder(domain, id, username, password, description string, folders ...string) (*string, error)

func (*Jenkins) CreateView

func (j *Jenkins) CreateView(name string, viewType string) (*View, error)

Create View First Parameter - name of the View Second parameter - Type Possible Types:

gojenkins.LIST_VIEW
gojenkins.NESTED_VIEW
gojenkins.MY_VIEW
gojenkins.DASHBOARD_VIEW
gojenkins.PIPELINE_VIEW

Example: jenkins.CreateView("newView",gojenkins.LIST_VIEW)

func (*Jenkins) DeleteCredentialInFolder

func (j *Jenkins) DeleteCredentialInFolder(domain, id string, folders ...string) (*string, error)

func (*Jenkins) DeleteJob

func (j *Jenkins) DeleteJob(name string, parentIDs ...string) (bool, error)

Delete a job.

func (*Jenkins) DeleteNode

func (j *Jenkins) DeleteNode(name string) (bool, error)

Delete a Jenkins slave node

func (*Jenkins) DeleteProjectRoles

func (j *Jenkins) DeleteProjectRoles(roleName ...string) error

func (*Jenkins) GetAllBuildIds

func (j *Jenkins) GetAllBuildIds(job string) ([]JobBuild, error)

Get all builds Numbers and URLS for a specific job. There are only build IDs here, To get all the other info of the build use jenkins.GetBuild(job,buildNumber) or job.GetBuild(buildNumber)

func (*Jenkins) GetAllBuildStatus

func (j *Jenkins) GetAllBuildStatus(jobId string) ([]JobBuildStatus, error)

func (*Jenkins) GetAllJobNames

func (j *Jenkins) GetAllJobNames() ([]InnerJob, error)

Get Only Array of Job Names, Color, URL Does not query each single Job.

func (*Jenkins) GetAllJobs

func (j *Jenkins) GetAllJobs() ([]*Job, error)

Get All Possible Job Objects. Each job will be queried.

func (*Jenkins) GetAllNodes

func (j *Jenkins) GetAllNodes() ([]*Node, error)

func (*Jenkins) GetAllViews

func (j *Jenkins) GetAllViews() ([]*View, error)

func (*Jenkins) GetArtifactData

func (j *Jenkins) GetArtifactData(id string) (*FingerPrintResponse, error)

Get Artifact data by Hash

func (*Jenkins) GetBuild

func (j *Jenkins) GetBuild(jobName string, number int64) (*Build, error)

func (*Jenkins) GetCredentialContentInFolder

func (j *Jenkins) GetCredentialContentInFolder(domain, id string, folders ...string) (string, error)

func (*Jenkins) GetCredentialInFolder

func (j *Jenkins) GetCredentialInFolder(domain, id string, folders ...string) (*CredentialResponse, error)

func (*Jenkins) GetCredentialsInFolder

func (j *Jenkins) GetCredentialsInFolder(domain string, folders ...string) ([]*CredentialResponse, error)

func (*Jenkins) GetFolder

func (j *Jenkins) GetFolder(id string, parents ...string) (*Folder, error)

func (*Jenkins) GetGlobalRole

func (j *Jenkins) GetGlobalRole(roleName string) (*GlobalRole, error)

func (*Jenkins) GetJob

func (j *Jenkins) GetJob(id string, parentIDs ...string) (*Job, error)

func (*Jenkins) GetLabel

func (j *Jenkins) GetLabel(name string) (*Label, error)

func (*Jenkins) GetNode

func (j *Jenkins) GetNode(name string) (*Node, error)

func (*Jenkins) GetPlugins

func (j *Jenkins) GetPlugins(depth int) (*Plugins, error)

Returns the list of all plugins installed on the Jenkins server. You can supply depth parameter, to limit how much data is returned.

func (*Jenkins) GetProjectRole

func (j *Jenkins) GetProjectRole(roleName string) (*ProjectRole, error)

func (*Jenkins) GetQueue

func (j *Jenkins) GetQueue() (*Queue, error)

Returns a Queue

func (*Jenkins) GetQueueItem

func (j *Jenkins) GetQueueItem(number int64) (*QueueItemResponse, error)

func (*Jenkins) GetQueueUrl

func (j *Jenkins) GetQueueUrl() string

func (*Jenkins) GetSubJob

func (j *Jenkins) GetSubJob(parentId string, childId string) (*Job, error)

func (*Jenkins) GetView

func (j *Jenkins) GetView(name string) (*View, error)

func (*Jenkins) HasPlugin

func (j *Jenkins) HasPlugin(name string) (*Plugin, error)

Check if the plugin is installed on the server. Depth level 1 is used. If you need to go deeper, you can use GetPlugins, and iterate through them.

func (*Jenkins) Info

func (j *Jenkins) Info() (*ExecutorResponse, error)

Get Basic Information About Jenkins

func (*Jenkins) Init

func (j *Jenkins) Init() (*Jenkins, error)

Init Method. Should be called after creating a Jenkins Instance. e.g jenkins := CreateJenkins("url").Init() HTTP Client is set here, Connection to jenkins is tested here.

func (*Jenkins) JenkinsfileToPipelineJson

func (j *Jenkins) JenkinsfileToPipelineJson(jenkinsfile string) (*JenkinsfileToPipelineJsonResponse, error)

func (*Jenkins) PipelineJsonToJenkinsfile

func (j *Jenkins) PipelineJsonToJenkinsfile(json string) (*PipelineJsonToJenkinsfileResponse, error)

func (*Jenkins) Poll

func (j *Jenkins) Poll() (int, error)

func (*Jenkins) RenameJob

func (j *Jenkins) RenameJob(job string, name string) *Job

Rename a job. First parameter job old name, Second parameter job new name.

func (*Jenkins) StepsJenkinsfileToJson

func (j *Jenkins) StepsJenkinsfileToJson(jenkinsfile string) (*StepsJenkinsfileToJsonResponse, error)

func (*Jenkins) StepsJsonToJenkinsfile

func (j *Jenkins) StepsJsonToJenkinsfile(json string) (*StepJsonToJenkinsfileResponse, error)

func (*Jenkins) UpdateKubeconfigCredentialInFolder

func (j *Jenkins) UpdateKubeconfigCredentialInFolder(domain, id, content, description string, folders ...string) (*string, error)

func (*Jenkins) UpdateSecretTextCredentialInFolder

func (j *Jenkins) UpdateSecretTextCredentialInFolder(domain, id, secret, description string, folders ...string) (*string, error)

func (*Jenkins) UpdateSshCredentialInFolder

func (j *Jenkins) UpdateSshCredentialInFolder(domain, id, username, passphrase, privateKey, description string, folders ...string) (*string, error)

func (*Jenkins) UpdateUsernamePasswordCredentialInFolder

func (j *Jenkins) UpdateUsernamePasswordCredentialInFolder(domain, id, username, password, description string, folders ...string) (*string, error)

func (*Jenkins) ValidateFingerPrint

func (j *Jenkins) ValidateFingerPrint(id string) (bool, error)

Verify FingerPrint

func (*Jenkins) ValidateJenkinsfile

func (j *Jenkins) ValidateJenkinsfile(jenkinsfile string) (*ValidateJenkinsfileResponse, error)

func (*Jenkins) ValidatePipelineJson

func (j *Jenkins) ValidatePipelineJson(json string) (*ValidatePipelineJsonResponse, error)

type JenkinsBlueTime

type JenkinsBlueTime time.Time

func (JenkinsBlueTime) MarshalJSON

func (t JenkinsBlueTime) MarshalJSON() ([]byte, error)

func (*JenkinsBlueTime) UnmarshalJSON

func (t *JenkinsBlueTime) UnmarshalJSON(b []byte) error

type JenkinsfileToPipelineJsonResponse

type JenkinsfileToPipelineJsonResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result string                   `json:"result"`
		Errors []map[string]interface{} `json:"errors"`
		Json   map[string]interface{}   `json:"json"`
	} `json:"data"`
}

type Job

type Job struct {
	Raw     *JobResponse
	Jenkins *Jenkins
	Base    string
}

func (*Job) Copy

func (j *Job) Copy(destinationName string) (*Job, error)

func (*Job) Create

func (j *Job) Create(config string, qr ...interface{}) (*Job, error)

func (*Job) Delete

func (j *Job) Delete() (bool, error)

func (*Job) Disable

func (j *Job) Disable() (bool, error)

func (*Job) Enable

func (j *Job) Enable() (bool, error)

func (*Job) GetAllBuildIds

func (j *Job) GetAllBuildIds() ([]JobBuild, error)

Returns All Builds with Number and URL

func (*Job) GetAllBuildStatus

func (j *Job) GetAllBuildStatus() ([]JobBuildStatus, error)

func (*Job) GetBuild

func (j *Job) GetBuild(id int64) (*Build, error)

func (*Job) GetConfig

func (j *Job) GetConfig() (string, error)

func (*Job) GetDescription

func (j *Job) GetDescription() string

func (*Job) GetDetails

func (j *Job) GetDetails() *JobResponse

func (*Job) GetDownstreamJobs

func (j *Job) GetDownstreamJobs() ([]*Job, error)

func (*Job) GetDownstreamJobsMetadata

func (j *Job) GetDownstreamJobsMetadata() []InnerJob

func (*Job) GetFirstBuild

func (j *Job) GetFirstBuild() (*Build, error)

func (*Job) GetInnerJob

func (j *Job) GetInnerJob(id string) (*Job, error)

func (*Job) GetInnerJobs

func (j *Job) GetInnerJobs() ([]*Job, error)

func (*Job) GetInnerJobsMetadata

func (j *Job) GetInnerJobsMetadata() []InnerJob

func (*Job) GetLastBuild

func (j *Job) GetLastBuild() (*Build, error)

func (*Job) GetLastCompletedBuild

func (j *Job) GetLastCompletedBuild() (*Build, error)

func (*Job) GetLastFailedBuild

func (j *Job) GetLastFailedBuild() (*Build, error)

func (*Job) GetLastStableBuild

func (j *Job) GetLastStableBuild() (*Build, error)

func (*Job) GetLastSuccessfulBuild

func (j *Job) GetLastSuccessfulBuild() (*Build, error)

func (*Job) GetName

func (j *Job) GetName() string

func (*Job) GetParameters

func (j *Job) GetParameters() ([]ParameterDefinition, error)

func (*Job) GetSubJobs

func (j *Job) GetSubJobs() ([]*Job, error)

func (*Job) GetSubJobsMetadata

func (j *Job) GetSubJobsMetadata() []InnerJob

func (*Job) GetUpstreamJobs

func (j *Job) GetUpstreamJobs() ([]*Job, error)

func (*Job) GetUpstreamJobsMetadata

func (j *Job) GetUpstreamJobsMetadata() []InnerJob

func (*Job) HasQueuedBuild

func (j *Job) HasQueuedBuild()

func (*Job) History

func (j *Job) History() ([]*History, error)

func (*Job) Invoke

func (j *Job) Invoke(files []string, skipIfRunning bool, params map[string]string, cause string, securityToken string) (bool, error)

func (*Job) InvokeSimple

func (j *Job) InvokeSimple(params map[string]string) (int64, error)

func (*Job) IsEnabled

func (j *Job) IsEnabled() (bool, error)

func (*Job) IsQueued

func (j *Job) IsQueued() (bool, error)

func (*Job) IsRunning

func (j *Job) IsRunning() (bool, error)

func (*Job) Poll

func (j *Job) Poll() (int, error)

func (*Job) Rename

func (j *Job) Rename(name string) (bool, error)

func (*Job) UpdateConfig

func (j *Job) UpdateConfig(config string) error

type JobBuild

type JobBuild struct {
	Number int64
	URL    string
}

type JobBuildStatus

type JobBuildStatus struct {
	Number   int64
	Building bool
	Result   string
}

type JobResponse

type JobResponse struct {
	Class              string `json:"_class"`
	Actions            []GeneralObj
	Buildable          bool `json:"buildable"`
	Builds             []JobBuild
	Color              string      `json:"color"`
	ConcurrentBuild    bool        `json:"concurrentBuild"`
	Description        string      `json:"description"`
	DisplayName        string      `json:"displayName"`
	DisplayNameOrNull  interface{} `json:"displayNameOrNull"`
	DownstreamProjects []InnerJob  `json:"downstreamProjects"`
	FirstBuild         JobBuild
	HealthReport       []struct {
		Description   string `json:"description"`
		IconClassName string `json:"iconClassName"`
		IconUrl       string `json:"iconUrl"`
		Score         int64  `json:"score"`
	} `json:"healthReport"`
	InQueue               bool       `json:"inQueue"`
	KeepDependencies      bool       `json:"keepDependencies"`
	LastBuild             JobBuild   `json:"lastBuild"`
	LastCompletedBuild    JobBuild   `json:"lastCompletedBuild"`
	LastFailedBuild       JobBuild   `json:"lastFailedBuild"`
	LastStableBuild       JobBuild   `json:"lastStableBuild"`
	LastSuccessfulBuild   JobBuild   `json:"lastSuccessfulBuild"`
	LastUnstableBuild     JobBuild   `json:"lastUnstableBuild"`
	LastUnsuccessfulBuild JobBuild   `json:"lastUnsuccessfulBuild"`
	Name                  string     `json:"name"`
	SubJobs               []InnerJob `json:"jobs"`
	NextBuildNumber       int64      `json:"nextBuildNumber"`
	Property              []struct {
		ParameterDefinitions []ParameterDefinition `json:"parameterDefinitions"`
	} `json:"property"`
	QueueItem        interface{} `json:"queueItem"`
	Scm              struct{}    `json:"scm"`
	UpstreamProjects []InnerJob  `json:"upstreamProjects"`
	URL              string      `json:"url"`
	Jobs             []InnerJob  `json:"jobs"`
	PrimaryView      *ViewData   `json:"primaryView"`
	Views            []ViewData  `json:"views"`
}

type KubeconfigCredential

type KubeconfigCredential struct {
	Scope            string           `json:"scope"`
	Id               string           `json:"id"`
	Description      string           `json:"description"`
	KubeconfigSource KubeconfigSource `json:"kubeconfigSource"`
	StaplerClass     string           `json:"stapler-class"`
}

func NewKubeconfigCredential

func NewKubeconfigCredential(id, content, description string) *KubeconfigCredential

type KubeconfigSource

type KubeconfigSource struct {
	StaplerClass string `json:"stapler-class"`
	Content      string `json:"content"`
}

type Label

type Label struct {
	Raw     *LabelResponse
	Jenkins *Jenkins
	Base    string
}

func (*Label) GetName

func (l *Label) GetName() string

func (*Label) GetNodes

func (l *Label) GetNodes() []LabelNode

func (*Label) Poll

func (l *Label) Poll() (int, error)

type LabelNode

type LabelNode struct {
	NodeName        string `json:"nodeName"`
	NodeDescription string `json:"nodeDescription"`
	NumExecutors    int64  `json:"numExecutors"`
	Mode            string `json:"mode"`
	Class           string `json:"_class"`
}

type LabelResponse

type LabelResponse struct {
	Name           string      `json:"name"`
	Description    string      `json:"description"`
	Nodes          []LabelNode `json:"nodes"`
	Offline        bool        `json:"offline"`
	IdleExecutors  int64       `json:"idleExecutors"`
	BusyExecutors  int64       `json:"busyExecutors"`
	TotalExecutors int64       `json:"totalExecutors"`
}

type MODE

type MODE string
const (
	NORMAL    MODE = "NORMAL"
	EXCLUSIVE      = "EXCLUSIVE"
)

type Node

type Node struct {
	Raw     *NodeResponse
	Jenkins *Jenkins
	Base    string
}

func (*Node) Delete

func (n *Node) Delete() (bool, error)

func (*Node) Disconnect

func (n *Node) Disconnect() (int, error)

func (*Node) GetLogText

func (n *Node) GetLogText() (string, error)

func (*Node) GetName

func (n *Node) GetName() string

func (*Node) Info

func (n *Node) Info() (*NodeResponse, error)

func (*Node) IsIdle

func (n *Node) IsIdle() (bool, error)

func (*Node) IsJnlpAgent

func (n *Node) IsJnlpAgent() (bool, error)

func (*Node) IsOnline

func (n *Node) IsOnline() (bool, error)

func (*Node) IsTemporarilyOffline

func (n *Node) IsTemporarilyOffline() (bool, error)

func (*Node) LaunchNodeBySSH

func (n *Node) LaunchNodeBySSH() (int, error)

func (*Node) Poll

func (n *Node) Poll() (int, error)

func (*Node) SetOffline

func (n *Node) SetOffline(options ...interface{}) (bool, error)

func (*Node) SetOnline

func (n *Node) SetOnline() (bool, error)

func (*Node) ToggleTemporarilyOffline

func (n *Node) ToggleTemporarilyOffline(options ...interface{}) (bool, error)

type NodeResponse

type NodeResponse struct {
	Actions     []interface{} `json:"actions"`
	DisplayName string        `json:"displayName"`
	Executors   []struct {
		CurrentExecutable struct {
			Number    int    `json:"number"`
			URL       string `json:"url"`
			SubBuilds []struct {
				Abort             bool        `json:"abort"`
				Build             interface{} `json:"build"`
				BuildNumber       int         `json:"buildNumber"`
				Duration          string      `json:"duration"`
				Icon              string      `json:"icon"`
				JobName           string      `json:"jobName"`
				ParentBuildNumber int         `json:"parentBuildNumber"`
				ParentJobName     string      `json:"parentJobName"`
				PhaseName         string      `json:"phaseName"`
				Result            string      `json:"result"`
				Retry             bool        `json:"retry"`
				URL               string      `json:"url"`
			} `json:"subBuilds"`
		} `json:"currentExecutable"`
	} `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 {
		Hudson_NodeMonitors_ArchitectureMonitor interface{} `json:"hudson.node_monitors.ArchitectureMonitor"`
		Hudson_NodeMonitors_ClockMonitor        interface{} `json:"hudson.node_monitors.ClockMonitor"`
		Hudson_NodeMonitors_DiskSpaceMonitor    interface{} `json:"hudson.node_monitors.DiskSpaceMonitor"`
		Hudson_NodeMonitors_ResponseTimeMonitor struct {
			Average int64 `json:"average"`
		} `json:"hudson.node_monitors.ResponseTimeMonitor"`
		Hudson_NodeMonitors_SwapSpaceMonitor      interface{} `json:"hudson.node_monitors.SwapSpaceMonitor"`
		Hudson_NodeMonitors_TemporarySpaceMonitor interface{} `json:"hudson.node_monitors.TemporarySpaceMonitor"`
	} `json:"monitorData"`
	NumExecutors       int64         `json:"numExecutors"`
	Offline            bool          `json:"offline"`
	OfflineCause       struct{}      `json:"offlineCause"`
	OfflineCauseReason string        `json:"offlineCauseReason"`
	OneOffExecutors    []interface{} `json:"oneOffExecutors"`
	TemporarilyOffline bool          `json:"temporarilyOffline"`
}

type ParameterDefinition

type ParameterDefinition struct {
	DefaultParameterValue struct {
		Name  string      `json:"name"`
		Value interface{} `json:"value"`
	} `json:"defaultParameterValue"`
	Description string `json:"description"`
	Name        string `json:"name"`
	Type        string `json:"type"`
}

type PipelineJsonToJenkinsfileResponse

type PipelineJsonToJenkinsfileResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result      string                   `json:"result"`
		Errors      []map[string]interface{} `json:"errors"`
		Jenkinsfile string                   `json:"jenkinsfile"`
	} `json:"data"`
}

type Plugin

type Plugin struct {
	Active        bool        `json:"active"`
	BackupVersion interface{} `json:"backupVersion"`
	Bundled       bool        `json:"bundled"`
	Deleted       bool        `json:"deleted"`
	Dependencies  []struct {
		Optional  string `json:"optional"`
		ShortName string `json:"shortname"`
		Version   string `json:"version"`
	} `json:"dependencies"`
	Downgradable        bool   `json:"downgradable"`
	Enabled             bool   `json:"enabled"`
	HasUpdate           bool   `json:"hasUpdate"`
	LongName            string `json:"longName"`
	Pinned              bool   `json:"pinned"`
	ShortName           string `json:"shortName"`
	SupportsDynamicLoad string `json:"supportsDynamicLoad"`
	URL                 string `json:"url"`
	Version             string `json:"version"`
}

type PluginResponse

type PluginResponse struct {
	Plugins []Plugin `json:"plugins"`
}

type Plugins

type Plugins struct {
	Jenkins *Jenkins
	Raw     *PluginResponse
	Base    string
	Depth   int
}

func (*Plugins) Contains

func (p *Plugins) Contains(name string) *Plugin

func (*Plugins) Count

func (p *Plugins) Count() int

func (*Plugins) Poll

func (p *Plugins) Poll() (int, error)

type PrivateKeySource

type PrivateKeySource struct {
	StaplerClass string `json:"stapler-class"`
	PrivateKey   string `json:"privateKey"`
}

type ProjectPermissionIds

type ProjectPermissionIds struct {
	CredentialCreate        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Create"`
	CredentialUpdate        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Update"`
	CredentialView          bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.View"`
	CredentialDelete        bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.Delete"`
	CredentialManageDomains bool `json:"com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains"`
	ItemBuild               bool `json:"hudson.model.Item.Build"`
	ItemCreate              bool `json:"hudson.model.Item.Create"`
	ItemRead                bool `json:"hudson.model.Item.Read"`
	ItemConfigure           bool `json:"hudson.model.Item.Configure"`
	ItemCancel              bool `json:"hudson.model.Item.Cancel"`
	ItemMove                bool `json:"hudson.model.Item.Move"`
	ItemDiscover            bool `json:"hudson.model.Item.Discover"`
	ItemWorkspace           bool `json:"hudson.model.Item.Workspace"`
	ItemDelete              bool `json:"hudson.model.Item.Delete"`
	RunUpdate               bool `json:"hudson.model.Run.Update"`
	RunDelete               bool `json:"hudson.model.Run.Delete"`
	RunReplay               bool `json:"hudson.model.Run.Replay"`
	SCMTag                  bool `json:"hudson.scm.SCM.Tag"`
}

type ProjectRole

type ProjectRole struct {
	Jenkins *Jenkins
	Raw     ProjectRoleResponse
}

func (*ProjectRole) AssignRole

func (j *ProjectRole) AssignRole(sid string) error

func (*ProjectRole) UnAssignRole

func (j *ProjectRole) UnAssignRole(sid string) error

func (*ProjectRole) Update

func (j *ProjectRole) Update(pattern string, ids ProjectPermissionIds) error

type ProjectRoleResponse

type ProjectRoleResponse struct {
	RoleName      string               `json:"roleName"`
	PermissionIds ProjectPermissionIds `json:"permissionIds"`
	Pattern       string               `json:"pattern"`
}

type Queue

type Queue struct {
	Jenkins *Jenkins
	Raw     *queueResponse
	Base    string
}

func (*Queue) CancelTask

func (q *Queue) CancelTask(id int64) (bool, error)

func (*Queue) GetTaskById

func (q *Queue) GetTaskById(id int64) *Task

func (*Queue) GetTasksForJob

func (q *Queue) GetTasksForJob(name string) []*Task

func (*Queue) Poll

func (q *Queue) Poll() (int, error)

func (*Queue) Tasks

func (q *Queue) Tasks() []*Task

type QueueItemResponse

type QueueItemResponse struct {
	Actions      []generalAction `json:"actions"`
	Blocked      bool            `json:"blocked"`
	Buildable    bool            `json:"buildable"`
	ID           int64           `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"`
	Cancelled  bool   `json:"cancelled"`
	Why        string `json:"why"`
	Executable struct {
		Number int64  `json:"number"`
		Url    string `json:"url"`
	} `json:"executable"`
}

type Requester

type Requester struct {
	Base      string
	BasicAuth *BasicAuth
	Client    *http.Client
	CACert    []byte
	SslVerify bool
	// contains filtered or unexported fields
}

func (*Requester) Do

func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)

func (*Requester) DoGet

func (r *Requester) DoGet(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)

func (*Requester) DoPostForm

func (r *Requester) DoPostForm(ar *APIRequest, responseStruct interface{}, form map[string]string) (*http.Response, error)

func (*Requester) Get

func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

func (*Requester) GetHtml

func (r *Requester) GetHtml(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

func (*Requester) GetJSON

func (r *Requester) GetJSON(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)

func (*Requester) GetXML

func (r *Requester) GetXML(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)

func (*Requester) Post

func (r *Requester) Post(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

func (*Requester) PostFiles

func (r *Requester) PostFiles(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string, files []string) (*http.Response, error)

func (*Requester) PostForm

func (r *Requester) PostForm(endpoint string, payload io.Reader, responseStruct interface{}, formString map[string]string) (*http.Response, error)

func (*Requester) PostJSON

func (r *Requester) PostJSON(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

func (*Requester) PostXML

func (r *Requester) PostXML(endpoint string, xml string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

func (*Requester) ReadJSONResponse

func (r *Requester) ReadJSONResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)

func (*Requester) ReadRawResponse

func (r *Requester) ReadRawResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)

func (*Requester) SetClient

func (r *Requester) SetClient(client *http.Client) *Requester

func (*Requester) SetCrumb

func (r *Requester) SetCrumb(ar *APIRequest) error

type SecretTextCredential

type SecretTextCredential struct {
	Scope        string `json:"scope"`
	Id           string `json:"id"`
	Secret       string `json:"secret"`
	Description  string `json:"description"`
	StaplerClass string `json:"stapler-class"`
}

func NewSecretTextCredential

func NewSecretTextCredential(id, secret, description string) *SecretTextCredential

type SshCredential

type SshCredential struct {
	Scope        string           `json:"scope"`
	Id           string           `json:"id"`
	Username     string           `json:"username"`
	Passphrase   string           `json:"passphrase"`
	KeySource    PrivateKeySource `json:"privateKeySource"`
	Description  string           `json:"description"`
	StaplerClass string           `json:"stapler-class"`
}

func NewSshCredential

func NewSshCredential(id, username, passphrase, privateKey, description string) *SshCredential

type StepJsonToJenkinsfileResponse

type StepJsonToJenkinsfileResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result      string                   `json:"result"`
		Errors      []map[string]interface{} `json:"errors"`
		Jenkinsfile string                   `json:"jenkinsfile"`
	} `json:"data"`
}

type StepsJenkinsfileToJsonResponse

type StepsJenkinsfileToJsonResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result string                   `json:"result"`
		Errors []map[string]interface{} `json:"errors"`
		Json   []map[string]interface{} `json:"json"`
	} `json:"data"`
}

type Task

type Task struct {
	Raw     *taskResponse
	Jenkins *Jenkins
	Queue   *Queue
}

func (*Task) Cancel

func (t *Task) Cancel() (bool, error)

func (*Task) GetCauses

func (t *Task) GetCauses() []map[string]interface{}

func (*Task) GetJob

func (t *Task) GetJob() (*Job, error)

func (*Task) GetParameters

func (t *Task) GetParameters() []parameter

func (*Task) GetWhy

func (t *Task) GetWhy() string

type TestResult

type TestResult struct {
	Duration  int64 `json:"duration"`
	Empty     bool  `json:"empty"`
	FailCount int64 `json:"failCount"`
	PassCount int64 `json:"passCount"`
	SkipCount int64 `json:"skipCount"`
	Suites    []struct {
		Cases []struct {
			Age             int64       `json:"age"`
			ClassName       string      `json:"className"`
			Duration        int64       `json:"duration"`
			ErrorDetails    interface{} `json:"errorDetails"`
			ErrorStackTrace interface{} `json:"errorStackTrace"`
			FailedSince     int64       `json:"failedSince"`
			Name            string      `json:"name"`
			Skipped         bool        `json:"skipped"`
			SkippedMessage  interface{} `json:"skippedMessage"`
			Status          string      `json:"status"`
			Stderr          interface{} `json:"stderr"`
			Stdout          interface{} `json:"stdout"`
		} `json:"cases"`
		Duration  int64       `json:"duration"`
		ID        interface{} `json:"id"`
		Name      string      `json:"name"`
		Stderr    interface{} `json:"stderr"`
		Stdout    interface{} `json:"stdout"`
		Timestamp interface{} `json:"timestamp"`
	} `json:"suites"`
}

type UsernamePasswordCredential

type UsernamePasswordCredential struct {
	Scope        string `json:"scope"`
	Id           string `json:"id"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	Description  string `json:"description"`
	StaplerClass string `json:"stapler-class"`
}

func NewUsernamePasswordCredential

func NewUsernamePasswordCredential(id, username, password, description string) *UsernamePasswordCredential

type ValidateJenkinsfileResponse

type ValidateJenkinsfileResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result string                   `json:"result"`
		Errors []map[string]interface{} `json:"errors"`
	} `json:"data"`
}

type ValidatePipelineJsonResponse

type ValidatePipelineJsonResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result string                   `json:"result"`
		Errors []map[string]interface{} `json:"errors"`
	}
}

type View

type View struct {
	Raw     *ViewResponse
	Jenkins *Jenkins
	Base    string
}

func (*View) AddJob

func (v *View) AddJob(name string) (bool, error)

Returns True if successfully added Job, otherwise false

func (*View) DeleteJob

func (v *View) DeleteJob(name string) (bool, error)

Returns True if successfully deleted Job, otherwise false

func (*View) GetDescription

func (v *View) GetDescription() string

func (*View) GetJobs

func (v *View) GetJobs() []InnerJob

func (*View) GetName

func (v *View) GetName() string

func (*View) GetUrl

func (v *View) GetUrl() string

func (*View) Poll

func (v *View) Poll() (int, error)

type ViewData

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

type ViewResponse

type ViewResponse struct {
	Description string        `json:"description"`
	Jobs        []InnerJob    `json:"jobs"`
	Name        string        `json:"name"`
	Property    []interface{} `json:"property"`
	URL         string        `json:"url"`
}

Jump to

Keyboard shortcuts

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