jenkins

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: Apache-2.0 Imports: 31 Imported by: 5

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 (
	Git = "git"
	Hg  = "hg"
	Svn = "svc"
)
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 (
	GetPipelineUrl         = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/"
	ListPipelinesUrl       = "/blue/rest/search/?"
	GetPipelineRunUrl      = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/"
	ListPipelineRunUrl     = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/?"
	StopPipelineUrl        = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/stop/?"
	ReplayPipelineUrl      = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/replay/"
	RunPipelineUrl         = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/"
	GetArtifactsUrl        = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/artifacts/?"
	GetRunLogUrl           = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/log/?"
	GetStepLogUrl          = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/%s/steps/%s/log/?"
	GetPipelineRunNodesUrl = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/?"
	SubmitInputStepUrl     = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/%s/steps/%s/"
	GetNodeStepsUrl        = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/runs/%s/nodes/%s/steps/?"

	GetBranchPipelineUrl     = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/"
	GetBranchPipelineRunUrl  = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/"
	StopBranchPipelineUrl    = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/stop/?"
	ReplayBranchPipelineUrl  = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/replay/"
	RunBranchPipelineUrl     = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/"
	GetBranchArtifactsUrl    = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/artifacts/?"
	GetBranchRunLogUrl       = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/log/?"
	GetBranchStepLogUrl      = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/%s/log/?"
	GetBranchNodeStepsUrl    = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/?"
	GetBranchPipeRunNodesUrl = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/?"
	CheckBranchPipelineUrl   = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/%s/runs/%s/nodes/%s/steps/%s/"
	GetPipeBranchUrl         = "/blue/rest/organizations/jenkins/pipelines/%s/pipelines/%s/branches/?"
	ScanBranchUrl            = "/job/%s/job/%s/build?"
	GetConsoleLogUrl         = "/job/%s/job/%s/indexing/consoleText"
	GetCrumbUrl              = "/crumbIssuer/api/json/"
	GetSCMServersUrl         = "/blue/rest/organizations/jenkins/scm/%s/servers/"
	GetSCMOrgUrl             = "/blue/rest/organizations/jenkins/scm/%s/organizations/?"
	GetOrgRepoUrl            = "/blue/rest/organizations/jenkins/scm/%s/organizations/%s/repositories/?"
	CreateSCMServersUrl      = "/blue/rest/organizations/jenkins/scm/%s/servers/"
	ValidateUrl              = "/blue/rest/organizations/jenkins/scm/%s/validate"

	GetNotifyCommitUrl    = "/git/notifyCommit/?"
	GithubWebhookUrl      = "/github-webhook/"
	CheckScriptCompileUrl = "/job/%s/job/%s/descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile"

	CheckPipelienCronUrl = "/job/%s/job/%s/descriptorByName/hudson.triggers.TimerTrigger/checkSpec?value=%s"
	CheckCronUrl         = "/job/%s/descriptorByName/hudson.triggers.TimerTrigger/checkSpec?value=%s"
	ToJenkinsfileUrl     = "/pipeline-model-converter/toJenkinsfile"
	ToJsonUrl            = "/pipeline-model-converter/toJson"
)
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 ParameterTypeMap = map[string]string{
	"hudson.model.StringParameterDefinition":   "string",
	"hudson.model.ChoiceParameterDefinition":   "choice",
	"hudson.model.TextParameterDefinition":     "text",
	"hudson.model.BooleanParameterDefinition":  "boolean",
	"hudson.model.FileParameterDefinition":     "file",
	"hudson.model.PasswordParameterDefinition": "password",
}

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func NewDevopsClient

func NewDevopsClient(options *Options) (devops.Interface, error)

func Reverse

func Reverse(s string) string

func SetBasicBearTokenHeader

func SetBasicBearTokenHeader(header *http.Header) error

set basic token for jenkins auth

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 BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

Basic Authentication

type Branch

type Branch struct {
	SHA1 string `json:",omitempty"`
	Name string `json:",omitempty"`
}

type Build

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

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) GetDownstreamBuilds

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

func (*Build) GetDuration

func (b *Build) GetDuration() int64

func (*Build) GetInjectedEnvVars

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

func (*Build) GetResult

func (b *Build) GetResult() string

func (*Build) GetResultSet

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

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() *devops.Build

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   []devops.GeneralAction
	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          []devops.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"`
	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 CredentialResponse

type CredentialResponse struct {
	Id          string `json:"id"`
	TypeName    string `json:"typeName"`
	DisplayName string `json:"displayName"`
	Fingerprint *struct {
		FileName string `json:"file_name,omitempty" description:"Credential's display name and description"`
		Hash     string `json:"hash,omitempty" description:"Credential's hash"`
		Usage    []*struct {
			Name   string `json:"name,omitempty" description:"Jenkins pipeline full name"`
			Ranges struct {
				Ranges []*struct {
					Start int `json:"start,omitempty" description:"Start build number"`
					End   int `json:"end,omitempty" description:"End build number"`
				} `json:"ranges,omitempty"`
			} `json:"ranges,omitempty" description:"The build number of all pipelines that use this credential"`
		} `json:"usage,omitempty" description:"all usage of Credential"`
	} `json:"fingerprint,omitempty" description:"usage of the Credential"`
	Description string `json:"description,omitempty"`
	Domain      string `json:"domain"`
}

type Culprit

type Culprit struct {
	AbsoluteUrl string
	FullName    string
}

type DevOpsProjectRoleResponse

type DevOpsProjectRoleResponse struct {
	ProjectRole *ProjectRole
	Err         error
}

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"`
}

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 GlobalRole

type GlobalRole struct {
	Jenkins *Jenkins
	Raw     GlobalRoleResponse
}

func (*GlobalRole) AssignRole

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

call jenkins api to update global role

func (*GlobalRole) UnAssignRole

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

func (*GlobalRole) Update

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

type GlobalRoleResponse

type GlobalRoleResponse struct {
	RoleName      string                     `json:"roleName"`
	PermissionIds devops.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
	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 devops.GlobalPermissionIds, overwrite bool) error

add a global roleName

func (*Jenkins) AddProjectRole

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

add roleName for project

func (*Jenkins) AssignGlobalRole

func (j *Jenkins) AssignGlobalRole(roleName string, sid string) error

assign a global roleName to username(sid)

func (*Jenkins) AssignProjectRole

func (j *Jenkins) AssignProjectRole(roleName string, sid string) error

assign a project roleName to username(sid)

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) CheckCron

func (j *Jenkins) CheckCron(projectName string, httpParameters *devops.HttpParameters) (*devops.CheckCronRes, error)

func (*Jenkins) CheckScriptCompile

func (j *Jenkins) CheckScriptCompile(projectName, pipelineName string, httpParameters *devops.HttpParameters) (*devops.CheckScript, error)

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) CreateCredentialInProject

func (j *Jenkins) CreateCredentialInProject(projectId string, credential *v1.Secret) (string, error)

func (*Jenkins) CreateDevOpsProject

func (j *Jenkins) CreateDevOpsProject(projectId string) (string, error)

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) CreateProjectPipeline

func (j *Jenkins) CreateProjectPipeline(projectId string, pipeline *devopsv1alpha3.Pipeline) (string, error)

func (*Jenkins) CreateSCMServers

func (j *Jenkins) CreateSCMServers(scmId string, httpParameters *devops.HttpParameters) (*devops.SCMServer, error)

func (*Jenkins) DeleteCredentialInProject

func (j *Jenkins) DeleteCredentialInProject(projectId, id string) (string, error)

func (*Jenkins) DeleteDevOpsProject

func (j *Jenkins) DeleteDevOpsProject(projectId string) error

func (*Jenkins) DeleteJob

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

Delete a job.

func (*Jenkins) DeleteProjectPipeline

func (j *Jenkins) DeleteProjectPipeline(projectId string, pipelineId string) (string, error)

func (*Jenkins) DeleteProjectRoles

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

delete roleName from the project

func (*Jenkins) DeleteUserInProject

func (j *Jenkins) DeleteUserInProject(username string) error

func (*Jenkins) GetArtifacts

func (j *Jenkins) GetArtifacts(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) ([]devops.Artifacts, error)

func (*Jenkins) GetBranchArtifacts

func (j *Jenkins) GetBranchArtifacts(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) ([]devops.Artifacts, error)

func (*Jenkins) GetBranchNodeSteps

func (j *Jenkins) GetBranchNodeSteps(projectName, pipelineName, branchName, runId, nodeId string, httpParameters *devops.HttpParameters) ([]devops.NodeSteps, error)

func (*Jenkins) GetBranchPipeline

func (j *Jenkins) GetBranchPipeline(projectName, pipelineName, branchName string, httpParameters *devops.HttpParameters) (*devops.BranchPipeline, error)

func (*Jenkins) GetBranchPipelineRun

func (j *Jenkins) GetBranchPipelineRun(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) (*devops.PipelineRun, error)

func (*Jenkins) GetBranchPipelineRunNodes

func (j *Jenkins) GetBranchPipelineRunNodes(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) ([]devops.BranchPipelineRunNodes, error)

func (*Jenkins) GetBranchRunLog

func (j *Jenkins) GetBranchRunLog(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) GetBranchStepLog

func (j *Jenkins) GetBranchStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId string, httpParameters *devops.HttpParameters) ([]byte, http.Header, error)

func (*Jenkins) GetBuild

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

func (*Jenkins) GetConsoleLog

func (j *Jenkins) GetConsoleLog(projectName, pipelineName string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) GetCredentialInProject

func (j *Jenkins) GetCredentialInProject(projectId, id string) (*devops.Credential, error)

func (*Jenkins) GetCredentialsInProject

func (j *Jenkins) GetCredentialsInProject(projectId string) ([]*devops.Credential, error)

func (*Jenkins) GetCrumb

func (j *Jenkins) GetCrumb(httpParameters *devops.HttpParameters) (*devops.Crumb, error)

func (*Jenkins) GetDevOpsProject

func (j *Jenkins) GetDevOpsProject(projectId string) (string, error)

func (*Jenkins) GetFolder

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

func (*Jenkins) GetGlobalRole

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

query roleName exist or not if return roleName means exist

func (*Jenkins) GetGlobalRoleHandler

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

func (*Jenkins) GetJob

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

func (*Jenkins) GetMultiBranchPipelineBuildByType

func (j *Jenkins) GetMultiBranchPipelineBuildByType(projectId, pipelineId, branch string, status string) (*devops.Build, error)

func (*Jenkins) GetNodeSteps

func (j *Jenkins) GetNodeSteps(projectName, pipelineName, runId, nodeId string, httpParameters *devops.HttpParameters) ([]devops.NodeSteps, error)

func (*Jenkins) GetNotifyCommit

func (j *Jenkins) GetNotifyCommit(httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) GetOrgRepo

func (j *Jenkins) GetOrgRepo(scmId, organizationId string, httpParameters *devops.HttpParameters) (devops.OrgRepo, error)

func (*Jenkins) GetPipeline

func (j *Jenkins) GetPipeline(projectName, pipelineName string, httpParameters *devops.HttpParameters) (*devops.Pipeline, error)

func (*Jenkins) GetPipelineBranch

func (j *Jenkins) GetPipelineBranch(projectName, pipelineName string, httpParameters *devops.HttpParameters) (*devops.PipelineBranch, error)

func (*Jenkins) GetPipelineRun

func (j *Jenkins) GetPipelineRun(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) (*devops.PipelineRun, error)

func (*Jenkins) GetPipelineRunNodes

func (j *Jenkins) GetPipelineRunNodes(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) ([]devops.PipelineRunNodes, error)

func (*Jenkins) GetProjectPipelineBuildByType

func (j *Jenkins) GetProjectPipelineBuildByType(projectId, pipelineId string, status string) (*devops.Build, error)

func (*Jenkins) GetProjectPipelineConfig

func (j *Jenkins) GetProjectPipelineConfig(projectId, pipelineId string) (*devopsv1alpha3.Pipeline, error)

func (*Jenkins) GetProjectRole

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

func (*Jenkins) GetRunLog

func (j *Jenkins) GetRunLog(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) GetSCMOrg

func (j *Jenkins) GetSCMOrg(scmId string, httpParameters *devops.HttpParameters) ([]devops.SCMOrg, error)

func (*Jenkins) GetSCMServers

func (j *Jenkins) GetSCMServers(scmId string, httpParameters *devops.HttpParameters) ([]devops.SCMServer, error)

func (*Jenkins) GetStepLog

func (j *Jenkins) GetStepLog(projectName, pipelineName, runId, nodeId, stepId string, httpParameters *devops.HttpParameters) ([]byte, http.Header, error)

func (*Jenkins) GithubWebhook

func (j *Jenkins) GithubWebhook(httpParameters *devops.HttpParameters) ([]byte, error)

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) ListPipelineRuns

func (j *Jenkins) ListPipelineRuns(projectName, pipelineName string, httpParameters *devops.HttpParameters) (*devops.PipelineRunList, error)

func (*Jenkins) ListPipelines

func (j *Jenkins) ListPipelines(httpParameters *devops.HttpParameters) (*devops.PipelineList, 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) ReplayBranchPipeline

func (j *Jenkins) ReplayBranchPipeline(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) (*devops.ReplayPipeline, error)

func (*Jenkins) ReplayPipeline

func (j *Jenkins) ReplayPipeline(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) (*devops.ReplayPipeline, error)

func (*Jenkins) RunBranchPipeline

func (j *Jenkins) RunBranchPipeline(projectName, pipelineName, branchName string, httpParameters *devops.HttpParameters) (*devops.RunPipeline, error)

func (*Jenkins) RunPipeline

func (j *Jenkins) RunPipeline(projectName, pipelineName string, httpParameters *devops.HttpParameters) (*devops.RunPipeline, error)

func (*Jenkins) ScanBranch

func (j *Jenkins) ScanBranch(projectName, pipelineName string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) SendPureRequest

func (j *Jenkins) SendPureRequest(path string, httpParameters *devops.HttpParameters) ([]byte, error)

TODO: deprecated, use SendJenkinsRequestWithHeaderResp() instead

func (*Jenkins) SendPureRequestWithHeaderResp

func (j *Jenkins) SendPureRequestWithHeaderResp(path string, httpParameters *devops.HttpParameters) ([]byte, http.Header, error)

provider request header to call jenkins api. transfer bearer token to basic token for inner Oauth and Jeknins

func (*Jenkins) StepsJenkinsfileToJson

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

func (*Jenkins) StepsJsonToJenkinsfile

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

func (*Jenkins) StopBranchPipeline

func (j *Jenkins) StopBranchPipeline(projectName, pipelineName, branchName, runId string, httpParameters *devops.HttpParameters) (*devops.StopPipeline, error)

func (*Jenkins) StopPipeline

func (j *Jenkins) StopPipeline(projectName, pipelineName, runId string, httpParameters *devops.HttpParameters) (*devops.StopPipeline, error)

func (*Jenkins) SubmitBranchInputStep

func (j *Jenkins) SubmitBranchInputStep(projectName, pipelineName, branchName, runId, nodeId, stepId string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) SubmitInputStep

func (j *Jenkins) SubmitInputStep(projectName, pipelineName, runId, nodeId, stepId string, httpParameters *devops.HttpParameters) ([]byte, error)

func (*Jenkins) ToJenkinsfile

func (j *Jenkins) ToJenkinsfile(httpParameters *devops.HttpParameters) (*devops.ResJenkinsfile, error)

func (*Jenkins) ToJson

func (j *Jenkins) ToJson(httpParameters *devops.HttpParameters) (*devops.ResJson, error)

func (*Jenkins) UnAssignGlobalRole

func (j *Jenkins) UnAssignGlobalRole(roleName string, sid string) error

unassign a global roleName to username(sid)

func (*Jenkins) UnAssignProjectRole

func (j *Jenkins) UnAssignProjectRole(roleName string, sid string) error

unassign a project roleName to username(sid)

func (*Jenkins) UpdateCredentialInProject

func (j *Jenkins) UpdateCredentialInProject(projectId string, credential *v1.Secret) (string, error)

func (*Jenkins) UpdateProjectPipeline

func (j *Jenkins) UpdateProjectPipeline(projectId string, pipeline *devopsv1alpha3.Pipeline) (string, error)

func (*Jenkins) Validate

func (j *Jenkins) Validate(scmId string, httpParameters *devops.HttpParameters) (*devops.Validates, error)

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 JkError

type JkError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

func (*JkError) Error

func (err *JkError) Error() string

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) GetUpstreamJobs

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

func (*Job) GetUpstreamJobsMetadata

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

func (*Job) HasQueuedBuild

func (j *Job) HasQueuedBuild()

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            []devops.GeneralAction
	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:"subJobs"`
	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"`
}

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(secret *v1.Secret) *KubeconfigCredential

type KubeconfigSource

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

type Options

type Options struct {
	Host           string `json:",omitempty" yaml:"host" description:"Jenkins service host address"`
	Username       string `json:",omitempty" yaml:"username" description:"Jenkins admin username"`
	Password       string `json:",omitempty" yaml:"password" description:"Jenkins admin password"`
	MaxConnections int    `json:"maxConnections,omitempty" yaml:"maxConnections" description:"Maximum connections allowed to connect to Jenkins"`
}

func NewDevopsOptions

func NewDevopsOptions() *Options

NewDevopsOptions returns a `zero` instance

func (*Options) AddFlags

func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options)

func (*Options) ApplyTo

func (s *Options) ApplyTo(options *Options)

ApplyTo apply configuration to another options

func (*Options) Validate

func (s *Options) Validate() []error

Validate check if there is misconfiguration in options

type Parameter

type Parameter struct {
	Name  string
	Value string
}

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 Pipeline

type Pipeline struct {
	HttpParameters *devops.HttpParameters
	Jenkins        *Jenkins
	Path           string
}

func (*Pipeline) CheckCron

func (p *Pipeline) CheckCron() (*devops.CheckCronRes, error)

func (*Pipeline) CheckScriptCompile

func (p *Pipeline) CheckScriptCompile() (*devops.CheckScript, error)

func (*Pipeline) CreateSCMServers

func (p *Pipeline) CreateSCMServers() (*devops.SCMServer, error)

func (*Pipeline) GetArtifacts

func (p *Pipeline) GetArtifacts() ([]devops.Artifacts, error)

func (*Pipeline) GetBranchArtifacts

func (p *Pipeline) GetBranchArtifacts() ([]devops.Artifacts, error)

func (*Pipeline) GetBranchNodeSteps

func (p *Pipeline) GetBranchNodeSteps() ([]devops.NodeSteps, error)

func (*Pipeline) GetBranchPipeline

func (p *Pipeline) GetBranchPipeline() (*devops.BranchPipeline, error)

func (*Pipeline) GetBranchPipelineRun

func (p *Pipeline) GetBranchPipelineRun() (*devops.PipelineRun, error)

func (*Pipeline) GetBranchPipelineRunNodes

func (p *Pipeline) GetBranchPipelineRunNodes() ([]devops.BranchPipelineRunNodes, error)

func (*Pipeline) GetBranchRunLog

func (p *Pipeline) GetBranchRunLog() ([]byte, error)

func (*Pipeline) GetBranchStepLog

func (p *Pipeline) GetBranchStepLog() ([]byte, http.Header, error)

func (*Pipeline) GetConsoleLog

func (p *Pipeline) GetConsoleLog() ([]byte, error)

func (*Pipeline) GetCrumb

func (p *Pipeline) GetCrumb() (*devops.Crumb, error)

func (*Pipeline) GetNodeSteps

func (p *Pipeline) GetNodeSteps() ([]devops.NodeSteps, error)

func (*Pipeline) GetNotifyCommit

func (p *Pipeline) GetNotifyCommit() ([]byte, error)

func (*Pipeline) GetOrgRepo

func (p *Pipeline) GetOrgRepo() (devops.OrgRepo, error)

func (*Pipeline) GetPipeline

func (p *Pipeline) GetPipeline() (*devops.Pipeline, error)

func (*Pipeline) GetPipelineBranch

func (p *Pipeline) GetPipelineBranch() (*devops.PipelineBranch, error)

func (*Pipeline) GetPipelineRun

func (p *Pipeline) GetPipelineRun() (*devops.PipelineRun, error)

func (*Pipeline) GetPipelineRunNodes

func (p *Pipeline) GetPipelineRunNodes() ([]devops.PipelineRunNodes, error)

func (*Pipeline) GetRunLog

func (p *Pipeline) GetRunLog() ([]byte, error)

func (*Pipeline) GetSCMOrg

func (p *Pipeline) GetSCMOrg() ([]devops.SCMOrg, error)

func (*Pipeline) GetSCMServers

func (p *Pipeline) GetSCMServers() ([]devops.SCMServer, error)

func (*Pipeline) GetStepLog

func (p *Pipeline) GetStepLog() ([]byte, http.Header, error)

func (*Pipeline) GithubWebhook

func (p *Pipeline) GithubWebhook() ([]byte, error)

func (*Pipeline) ListPipelineRuns

func (p *Pipeline) ListPipelineRuns() (*devops.PipelineRunList, error)

func (*Pipeline) ListPipelines

func (p *Pipeline) ListPipelines() (*devops.PipelineList, error)

func (*Pipeline) ReplayBranchPipeline

func (p *Pipeline) ReplayBranchPipeline() (*devops.ReplayPipeline, error)

func (*Pipeline) ReplayPipeline

func (p *Pipeline) ReplayPipeline() (*devops.ReplayPipeline, error)

func (*Pipeline) RunBranchPipeline

func (p *Pipeline) RunBranchPipeline() (*devops.RunPipeline, error)

func (*Pipeline) RunPipeline

func (p *Pipeline) RunPipeline() (*devops.RunPipeline, error)

func (*Pipeline) ScanBranch

func (p *Pipeline) ScanBranch() ([]byte, error)

func (*Pipeline) StopBranchPipeline

func (p *Pipeline) StopBranchPipeline() (*devops.StopPipeline, error)

func (*Pipeline) StopPipeline

func (p *Pipeline) StopPipeline() (*devops.StopPipeline, error)

func (*Pipeline) SubmitBranchInputStep

func (p *Pipeline) SubmitBranchInputStep() ([]byte, error)

func (*Pipeline) SubmitInputStep

func (p *Pipeline) SubmitInputStep() ([]byte, error)

func (*Pipeline) ToJenkinsfile

func (p *Pipeline) ToJenkinsfile() (*devops.ResJenkinsfile, error)

func (*Pipeline) ToJson

func (p *Pipeline) ToJson() (*devops.ResJson, error)

func (*Pipeline) Validate

func (p *Pipeline) Validate() (*devops.Validates, error)

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 PrivateKeySource

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

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 devops.ProjectPermissionIds) error

update ProjectPermissionIds to Project pattern string means some project, like project-name/*

type ProjectRoleResponse

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

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(secret *v1.Secret) *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(secret *v1.Secret) *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 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(secret *v1.Secret) *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"`
	}
}

Jump to

Keyboard shortcuts

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