Documentation ¶
Overview ¶
Gojenkins is a Jenkins Client in Go, that exposes the jenkins REST api in a more developer friendly way.
Index ¶
- Constants
- Variables
- func CheckResponse(r *http.Response) error
- func CreatePipelineConfigXml(pipeline *types.NoScmPipeline) (string, error)
- func GetStatusCode(err error) int
- func ParsePipelineConfigXml(config string) (*types.NoScmPipeline, error)
- func Reverse(s string) string
- func SetBasicBearTokenHeader(basic *BasicAuth, header *http.Header)
- type APIRequest
- type Artifact
- type BasicAuth
- type Build
- func (b *Build) GetActions() []types.GeneralAction
- func (b *Build) GetAllFingerPrints() []*FingerPrint
- func (b *Build) GetArtifacts() []Artifact
- func (b *Build) GetBuildNumber() int64
- func (b *Build) GetCauses() ([]map[string]interface{}, error)
- func (b *Build) GetConsoleOutput() string
- func (b *Build) GetConsoleOutputFromIndex(startID int64) (consoleResponse, error)
- func (b *Build) GetCulprits() []types.Culprit
- func (b *Build) GetDownstreamBuilds() ([]*Build, error)
- func (b *Build) GetDownstreamJobNames() []string
- func (b *Build) GetDuration() float64
- func (b *Build) GetInjectedEnvVars() (map[string]string, error)
- func (b *Build) GetMatrixRuns() ([]*Build, error)
- func (b *Build) GetParameters() []types.GeneralParameter
- func (b *Build) GetResult() string
- func (b *Build) GetResultSet() (*TestResult, error)
- func (b *Build) GetRevision() string
- func (b *Build) GetRevisionBranch() string
- func (b *Build) GetTimestamp() time.Time
- func (b *Build) GetUpstreamBuild() (*Build, error)
- func (b *Build) GetUpstreamBuildNumber() (int64, error)
- func (b *Build) GetUpstreamJob() (*Job, error)
- func (b *Build) GetUrl() string
- func (b *Build) Info() *types.Build
- func (b *Build) IsGood() bool
- func (b *Build) IsRunning() bool
- func (b *Build) Poll(options ...interface{}) (int, error)
- func (b *Build) SetDescription(description string) error
- func (b *Build) Stop() (bool, error)
- type BuildRevision
- type Builds
- type Computers
- type CredentialResponse
- type DevOpsProjectRoleResponse
- type ErrorResponse
- type Executor
- type ExecutorResponse
- type FingerPrint
- type Folder
- type FolderResponse
- type GlobalRole
- type GlobalRoleResponse
- type History
- type InnerJob
- type Interface
- type Jenkins
- func (j *Jenkins) AddGlobalRole(roleName string, ids types.GlobalPermissionIds, overwrite bool) error
- func (j *Jenkins) AddProjectRole(roleName string, pattern string, ids types.ProjectPermissionIds, ...) error
- func (j *Jenkins) AssignGlobalRole(roleName string, sid string) error
- func (j *Jenkins) AssignProjectRole(roleName string, sid string) error
- func (j *Jenkins) BuildJob(name string, options ...interface{}) (int64, error)
- func (j *Jenkins) CheckCron(projectName string, httpParameters *types.HttpParameters) (*types.CheckCronRes, error)
- func (j *Jenkins) CheckScriptCompile(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.CheckScript, error)
- func (j *Jenkins) CopyJob(copyFrom string, newName string) (*Job, error)
- func (j *Jenkins) CreateCredentialInProject(projectId string, credential *types.Secret) (string, error)
- func (j *Jenkins) CreateFolder(name string, parents ...string) (*Folder, error)
- func (j *Jenkins) CreateJob(config string, options ...interface{}) (*Job, error)
- func (j *Jenkins) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error)
- func (j *Jenkins) CreateNode(name string, numExecutors int, description string, remoteFS string, ...) (*Node, error)
- func (j *Jenkins) CreateProject(projectId string) (string, error)
- func (j *Jenkins) CreateProjectPipeline(projectId string, pipelineSpec *types.PipelineSpec) (string, error)
- func (j *Jenkins) CreateSCMServers(scmId string, httpParameters *types.HttpParameters) (*types.SCMServer, error)
- func (j *Jenkins) CreateView(name string, viewType string) (*View, error)
- func (j *Jenkins) DeleteCredentialInProject(projectId, id string) (string, error)
- func (j *Jenkins) DeleteJob(name string) (bool, error)
- func (j *Jenkins) DeleteJobInFolder(name string, parentIDs ...string) (bool, error)
- func (j *Jenkins) DeleteNode(name string) (bool, error)
- func (j *Jenkins) DeleteProject(projectId string) error
- func (j *Jenkins) DeleteProjectPipeline(projectId string, pipelineId string) (string, error)
- func (j *Jenkins) DeleteProjectRoles(roleName ...string) error
- func (j *Jenkins) DeleteUserInProject(username string) error
- func (j *Jenkins) GetAllBuildIds(job string) ([]JobBuild, error)
- func (j *Jenkins) GetAllJobNames() ([]InnerJob, error)
- func (j *Jenkins) GetAllJobs() ([]*Job, error)
- func (j *Jenkins) GetAllNodes() ([]*Node, error)
- func (j *Jenkins) GetAllViews() ([]*View, error)
- func (j *Jenkins) GetArtifactData(id string) (*types.FingerPrintResponse, error)
- func (j *Jenkins) GetArtifacts(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]types.Artifacts, error)
- func (j *Jenkins) GetBranchArtifacts(projectName, pipelineName, branchName, runId string, ...) ([]types.Artifacts, error)
- func (j *Jenkins) GetBranchNodeSteps(projectName, pipelineName, branchName, runId, nodeId string, ...) ([]types.NodeSteps, error)
- func (j *Jenkins) GetBranchPipeline(projectName, pipelineName, branchName string, ...) (*types.BranchPipeline, error)
- func (j *Jenkins) GetBranchPipelineRun(projectName, pipelineName, branchName, runId string, ...) (*types.PipelineRun, error)
- func (j *Jenkins) GetBranchPipelineRunNodes(projectName, pipelineName, branchName, runId string, ...) ([]types.BranchPipelineRunNodes, error)
- func (j *Jenkins) GetBranchRunLog(projectName, pipelineName, branchName, runId string, ...) ([]byte, error)
- func (j *Jenkins) GetBranchStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId string, ...) ([]byte, http.Header, error)
- func (j *Jenkins) GetBuild(jobName string, number int64) (*Build, error)
- func (j *Jenkins) GetConsoleLog(projectName, pipelineName string, httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) GetCredentialInProject(projectId, id string) (*types.Credential, error)
- func (j *Jenkins) GetCredentialsInProject(projectId string) ([]*types.Credential, error)
- func (j *Jenkins) GetCrumb(httpParameters *types.HttpParameters) (*types.Crumb, error)
- func (j *Jenkins) GetFolder(id string, parents ...string) (*Folder, error)
- func (j *Jenkins) GetGlobalRole(roleName string) (string, error)
- func (j *Jenkins) GetGlobalRoleHandler(roleName string) (*GlobalRole, error)
- func (j *Jenkins) GetJob(id string, parentIDs ...string) (*Job, error)
- func (j *Jenkins) GetLabel(name string) (*Label, error)
- func (j *Jenkins) GetMultiBranchPipelineBuildByType(projectId, pipelineId, branch string, status string) (*types.Build, error)
- func (j *Jenkins) GetNode(name string) (*Node, error)
- func (j *Jenkins) GetNodeSteps(projectName, pipelineName, runId, nodeId string, ...) ([]types.NodeSteps, error)
- func (j *Jenkins) GetNotifyCommit(httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) GetOrgRepo(scmId, organizationId string, httpParameters *types.HttpParameters) (types.OrgRepo, error)
- func (j *Jenkins) GetPipeline(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.Pipeline, error)
- func (j *Jenkins) GetPipelineBranch(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineBranch, error)
- func (j *Jenkins) GetPipelineRun(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.PipelineRun, error)
- func (j *Jenkins) GetPipelineRunNodes(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]types.PipelineRunNodes, error)
- func (j *Jenkins) GetPlugins(depth int) (*Plugins, error)
- func (j *Jenkins) GetProject(projectId string) (string, error)
- func (j *Jenkins) GetProjectPipelineBuildByType(projectId, pipelineId string, status string) (*types.Build, error)
- func (j *Jenkins) GetProjectPipelineConfig(projectId, pipelineId string) (*types.PipelineSpec, error)
- func (j *Jenkins) GetProjectRole(roleName string) (*ProjectRole, error)
- func (j *Jenkins) GetQueue() (*Queue, error)
- func (j *Jenkins) GetQueueItem(id int64) (*Task, error)
- func (j *Jenkins) GetQueueUrl() string
- func (j *Jenkins) GetRunLog(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) GetSCMOrg(scmId string, httpParameters *types.HttpParameters) ([]types.SCMOrg, error)
- func (j *Jenkins) GetSCMServers(scmId string, httpParameters *types.HttpParameters) ([]types.SCMServer, error)
- func (j *Jenkins) GetStepLog(projectName, pipelineName, runId, nodeId, stepId string, ...) ([]byte, http.Header, error)
- func (j *Jenkins) GetSubJob(parentId string, childId string) (*Job, error)
- func (j *Jenkins) GetView(name string) (*View, error)
- func (j *Jenkins) GithubWebhook(httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) HasPlugin(name string) (*Plugin, error)
- func (j *Jenkins) Info() (*ExecutorResponse, error)
- func (j *Jenkins) Init() (*Jenkins, error)
- func (j *Jenkins) InstallPlugin(name string, version string) error
- func (j *Jenkins) JenkinsfileToPipelineJson(jenkinsfile string) (*JenkinsfileToPipelineJsonResponse, error)
- func (j *Jenkins) ListPipelineRuns(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineRunList, error)
- func (j *Jenkins) ListPipelines(httpParameters *types.HttpParameters) (*types.PipelineList, error)
- func (j *Jenkins) PipelineJsonToJenkinsfile(json string) (*PipelineJsonToJenkinsfileResponse, error)
- func (j *Jenkins) Poll() (int, error)
- func (j *Jenkins) RenameJob(job string, name string) *Job
- func (j *Jenkins) ReplayBranchPipeline(projectName, pipelineName, branchName, runId string, ...) (*types.ReplayPipeline, error)
- func (j *Jenkins) ReplayPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.ReplayPipeline, error)
- func (j *Jenkins) RunBranchPipeline(projectName, pipelineName, branchName string, ...) (*types.RunPipeline, error)
- func (j *Jenkins) RunPipeline(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.RunPipeline, error)
- func (j *Jenkins) SafeRestart() error
- func (j *Jenkins) ScanBranch(projectName, pipelineName string, httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) SendPureRequest(path string, httpParameters *types.HttpParameters) ([]byte, error)
- func (j *Jenkins) SendPureRequestWithHeaderResp(path string, httpParameters *types.HttpParameters) ([]byte, http.Header, error)
- func (j *Jenkins) StepsJenkinsfileToJson(jenkinsfile string) (*StepsJenkinsfileToJsonResponse, error)
- func (j *Jenkins) StepsJsonToJenkinsfile(json string) (*StepJsonToJenkinsfileResponse, error)
- func (j *Jenkins) StopBranchPipeline(projectName, pipelineName, branchName, runId string, ...) (*types.StopPipeline, error)
- func (j *Jenkins) StopPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.StopPipeline, error)
- func (j *Jenkins) SubmitBranchInputStep(projectName, pipelineName, branchName, runId, nodeId, stepId string, ...) ([]byte, error)
- func (j *Jenkins) SubmitInputStep(projectName, pipelineName, runId, nodeId, stepId string, ...) ([]byte, error)
- func (j *Jenkins) ToJenkinsfile(httpParameters *types.HttpParameters) (*types.ResJenkinsfile, error)
- func (j *Jenkins) ToJson(httpParameters *types.HttpParameters) (*types.ResJson, error)
- func (j *Jenkins) UnAssignGlobalRole(roleName string, sid string) error
- func (j *Jenkins) UnAssignProjectRole(roleName string, sid string) error
- func (j *Jenkins) UninstallPlugin(name string) error
- func (j *Jenkins) UpdateCredentialInProject(projectId string, credential *types.Secret) (string, error)
- func (j *Jenkins) UpdateJob(job string, config string) *Job
- func (j *Jenkins) UpdateProjectPipeline(projectId string, pipelineSpec *types.PipelineSpec) (string, error)
- func (j *Jenkins) Validate(scmId string, httpParameters *types.HttpParameters) (*types.Validates, error)
- func (j *Jenkins) ValidateFingerPrint(id string) (bool, error)
- func (j *Jenkins) ValidateJenkinsfile(jenkinsfile string) (*ValidateJenkinsfileResponse, error)
- func (j *Jenkins) ValidatePipelineJson(json string) (*ValidatePipelineJsonResponse, error)
- type JenkinsBlueTime
- type JenkinsfileToPipelineJsonResponse
- type JkError
- type Job
- func (j *Job) Copy(destinationName string) (*Job, error)
- func (j *Job) Create(config string, qr ...interface{}) (*Job, error)
- func (j *Job) Delete() (bool, error)
- func (j *Job) Disable() (bool, error)
- func (j *Job) Enable() (bool, error)
- func (j *Job) GetAllBuildIds() ([]JobBuild, error)
- func (j *Job) GetBuild(id int64) (*Build, error)
- func (j *Job) GetBuildsFields(fields []string, custom interface{}) error
- func (j *Job) GetConfig() (string, error)
- func (j *Job) GetDescription() string
- func (j *Job) GetDetails() *JobResponse
- func (j *Job) GetDownstreamJobs() ([]*Job, error)
- func (j *Job) GetDownstreamJobsMetadata() []InnerJob
- func (j *Job) GetFirstBuild() (*Build, error)
- func (j *Job) GetInnerJob(id string) (*Job, error)
- func (j *Job) GetInnerJobs() ([]*Job, error)
- func (j *Job) GetInnerJobsMetadata() []InnerJob
- func (j *Job) GetLastBuild() (*Build, error)
- func (j *Job) GetLastCompletedBuild() (*Build, error)
- func (j *Job) GetLastFailedBuild() (*Build, error)
- func (j *Job) GetLastStableBuild() (*Build, error)
- func (j *Job) GetLastSuccessfulBuild() (*Build, error)
- func (j *Job) GetName() string
- func (j *Job) GetParameters() ([]ParameterDefinition, error)
- func (job *Job) GetPipelineRun(id string) (pr *PipelineRun, err error)
- func (job *Job) GetPipelineRuns() (pr []PipelineRun, err error)
- func (j *Job) GetUpstreamJobs() ([]*Job, error)
- func (j *Job) GetUpstreamJobsMetadata() []InnerJob
- func (j *Job) HasQueuedBuild()
- func (j *Job) History() ([]*History, error)
- func (j *Job) Invoke(files []string, skipIfRunning bool, params map[string]string, cause string, ...) (bool, error)
- func (j *Job) InvokeSimple(params map[string]string) (int64, error)
- func (j *Job) IsEnabled() (bool, error)
- func (j *Job) IsQueued() (bool, error)
- func (j *Job) IsRunning() (bool, error)
- func (j *Job) Poll() (int, error)
- func (j *Job) Rename(name string) (bool, error)
- func (j *Job) UpdateConfig(config string) error
- type JobBuild
- type JobResponse
- type KubeconfigCredential
- type KubeconfigSource
- type Label
- type LabelNode
- type LabelResponse
- type MODE
- type Node
- func (n *Node) Delete() (bool, error)
- func (n *Node) Disconnect() (int, error)
- func (n *Node) GetLogText() (string, error)
- func (n *Node) GetName() string
- func (n *Node) Info() (*NodeResponse, error)
- func (n *Node) IsIdle() (bool, error)
- func (n *Node) IsJnlpAgent() (bool, error)
- func (n *Node) IsOnline() (bool, error)
- func (n *Node) IsTemporarilyOffline() (bool, error)
- func (n *Node) LaunchNodeBySSH() (int, error)
- func (n *Node) Poll() (int, error)
- func (n *Node) SetOffline(options ...interface{}) (bool, error)
- func (n *Node) SetOnline() (bool, error)
- func (n *Node) ToggleTemporarilyOffline(options ...interface{}) (bool, error)
- type NodeResponse
- type Options
- type ParameterDefinition
- type Pipeline
- func (p *Pipeline) CheckCron() (*types.CheckCronRes, error)
- func (p *Pipeline) CheckScriptCompile() (*types.CheckScript, error)
- func (p *Pipeline) CreateSCMServers() (*types.SCMServer, error)
- func (p *Pipeline) GetArtifacts() ([]types.Artifacts, error)
- func (p *Pipeline) GetBranchArtifacts() ([]types.Artifacts, error)
- func (p *Pipeline) GetBranchNodeSteps() ([]types.NodeSteps, error)
- func (p *Pipeline) GetBranchPipeline() (*types.BranchPipeline, error)
- func (p *Pipeline) GetBranchPipelineRun() (*types.PipelineRun, error)
- func (p *Pipeline) GetBranchPipelineRunNodes() ([]types.BranchPipelineRunNodes, error)
- func (p *Pipeline) GetBranchRunLog() ([]byte, error)
- func (p *Pipeline) GetBranchStepLog() ([]byte, http.Header, error)
- func (p *Pipeline) GetConsoleLog() ([]byte, error)
- func (p *Pipeline) GetCrumb() (*types.Crumb, error)
- func (p *Pipeline) GetNodeSteps() ([]types.NodeSteps, error)
- func (p *Pipeline) GetNotifyCommit() ([]byte, error)
- func (p *Pipeline) GetOrgRepo() (types.OrgRepo, error)
- func (p *Pipeline) GetPipeline() (*types.Pipeline, error)
- func (p *Pipeline) GetPipelineBranch() (*types.PipelineBranch, error)
- func (p *Pipeline) GetPipelineRun() (*types.PipelineRun, error)
- func (p *Pipeline) GetPipelineRunNodes() ([]types.PipelineRunNodes, error)
- func (p *Pipeline) GetRunLog() ([]byte, error)
- func (p *Pipeline) GetSCMOrg() ([]types.SCMOrg, error)
- func (p *Pipeline) GetSCMServers() ([]types.SCMServer, error)
- func (p *Pipeline) GetStepLog() ([]byte, http.Header, error)
- func (p *Pipeline) GithubWebhook() ([]byte, error)
- func (p *Pipeline) ListPipelineRuns() (*types.PipelineRunList, error)
- func (p *Pipeline) ListPipelines() (*types.PipelineList, error)
- func (p *Pipeline) ReplayBranchPipeline() (*types.ReplayPipeline, error)
- func (p *Pipeline) ReplayPipeline() (*types.ReplayPipeline, error)
- func (p *Pipeline) RunBranchPipeline() (*types.RunPipeline, error)
- func (p *Pipeline) RunPipeline() (*types.RunPipeline, error)
- func (p *Pipeline) ScanBranch() ([]byte, error)
- func (p *Pipeline) StopBranchPipeline() (*types.StopPipeline, error)
- func (p *Pipeline) StopPipeline() (*types.StopPipeline, error)
- func (p *Pipeline) SubmitBranchInputStep() ([]byte, error)
- func (p *Pipeline) SubmitInputStep() ([]byte, error)
- func (p *Pipeline) ToJenkinsfile() (*types.ResJenkinsfile, error)
- func (p *Pipeline) ToJson() (*types.ResJson, error)
- func (p *Pipeline) Validate() (*types.Validates, error)
- type PipelineArtifact
- type PipelineInputAction
- type PipelineJsonToJenkinsfileResponse
- type PipelineNode
- type PipelineNodeLog
- type PipelineRun
- func (pr *PipelineRun) AbortInput() (bool, error)
- func (pr *PipelineRun) GetArtifacts() (artifacts []PipelineArtifact, err error)
- func (pr *PipelineRun) GetNode(id string) (node *PipelineNode, err error)
- func (pr *PipelineRun) GetPendingInputActions() (PIAs []PipelineInputAction, err error)
- func (pr *PipelineRun) ProceedInput() (bool, error)
- type Plugin
- type PluginResponse
- type Plugins
- type PrivateKeySource
- type ProjectRole
- type ProjectRoleResponse
- type Queue
- type Requester
- func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)
- func (r *Requester) DoGet(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)
- func (r *Requester) DoPostForm(ar *APIRequest, responseStruct interface{}, form map[string]string) (*http.Response, error)
- func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)
- func (r *Requester) GetJSON(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)
- func (r *Requester) GetXML(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)
- func (r *Requester) Post(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostFiles(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostForm(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostJSON(endpoint string, payload io.Reader, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) PostXML(endpoint string, xml string, responseStruct interface{}, ...) (*http.Response, error)
- func (r *Requester) ReadJSONResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)
- func (r *Requester) ReadRawResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)
- func (r *Requester) SetClient(client *http.Client) *Requester
- func (r *Requester) SetCrumb(ar *APIRequest) error
- type SecretTextCredential
- type SshCredential
- type StepJsonToJenkinsfileResponse
- type StepsJenkinsfileToJsonResponse
- type Task
- type TestResult
- type UsernamePasswordCredential
- type ValidateJenkinsfileResponse
- type ValidatePipelineJsonResponse
- type View
- type ViewData
- type ViewResponse
Constants ¶
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/([^/]*)/?" )
const ( GLOBAL_ROLE = "globalRoles" PROJECT_ROLE = "projectRoles" )
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" )
const DirectKubeconfigCredentialStaperClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials$DirectEntryKubeconfigSource"
const DirectSSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"
const GLOBALScope = "GLOBAL"
const KubeconfigCredentialStaplerClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials"
const SSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
const SecretTextCredentialStaplerClass = "org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl"
const UsernamePassswordCredentialStaplerClass = "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
Variables ¶
Loggers
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" )
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 CreatePipelineConfigXml ¶
func CreatePipelineConfigXml(pipeline *types.NoScmPipeline) (string, error)
func GetStatusCode ¶
func ParsePipelineConfigXml ¶
func ParsePipelineConfigXml(config string) (*types.NoScmPipeline, error)
func SetBasicBearTokenHeader ¶
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 Artifact ¶
Represents an Artifact
type Build ¶
func (*Build) GetActions ¶
func (b *Build) GetActions() []types.GeneralAction
func (*Build) GetAllFingerPrints ¶
func (b *Build) GetAllFingerPrints() []*FingerPrint
func (*Build) GetArtifacts ¶
func (*Build) GetBuildNumber ¶
func (*Build) GetConsoleOutput ¶
func (*Build) GetConsoleOutputFromIndex ¶
func (*Build) GetCulprits ¶
func (*Build) GetDownstreamBuilds ¶
func (*Build) GetDownstreamJobNames ¶
func (*Build) GetDuration ¶
func (*Build) GetMatrixRuns ¶
func (*Build) GetParameters ¶
func (b *Build) GetParameters() []types.GeneralParameter
func (*Build) GetResultSet ¶
func (b *Build) GetResultSet() (*TestResult, error)
func (*Build) GetRevision ¶
func (*Build) GetRevisionBranch ¶
func (*Build) GetTimestamp ¶
func (*Build) GetUpstreamBuild ¶
func (*Build) GetUpstreamBuildNumber ¶
func (*Build) GetUpstreamJob ¶
func (*Build) Poll ¶
Poll for current data. Optional parameter - depth. More about depth here: https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
func (*Build) SetDescription ¶
type BuildRevision ¶
type BuildRevision struct { SHA1 string `json:"SHA1"` Branch []branch `json:"branch"` }
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 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 DevOpsProjectRoleResponse ¶
type DevOpsProjectRoleResponse struct { ProjectRole *ProjectRole Err error }
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Executor ¶
type Executor struct { Raw *ExecutorResponse Jenkins *Jenkins }
type ExecutorResponse ¶
type ExecutorResponse struct { AssignedLabels []map[string]string `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 *types.FingerPrintResponse }
func (FingerPrint) GetInfo ¶
func (f FingerPrint) GetInfo() (*types.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 Folder ¶
type Folder struct { Raw *FolderResponse Jenkins *Jenkins Base string }
type FolderResponse ¶
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 types.GlobalPermissionIds) error
type GlobalRoleResponse ¶
type GlobalRoleResponse struct { RoleName string `json:"roleName"` PermissionIds types.GlobalPermissionIds `json:"permissionIds"` }
type Interface ¶
type Interface interface { Init() (*Jenkins, error) Info() (*ExecutorResponse, error) SafeRestart() error CreateNode(name string, numExecutors int, description string, remoteFS string, label string, options ...interface{}) (*Node, error) DeleteNode(name string) (bool, error) CreateFolder(name string, parents ...string) (*Folder, error) CreateJobInFolder(config string, jobName string, parentIDs ...string) (*Job, error) CreateJob(config string, options ...interface{}) (*Job, error) UpdateJob(job string, config string) *Job RenameJob(job string, name string) *Job CopyJob(copyFrom string, newName string) (*Job, error) DeleteJob(name string) (bool, error) DeleteJobInFolder(name string, parentIDs ...string) (bool, error) BuildJob(name string, options ...interface{}) (int64, error) GetNode(name string) (*Node, error) GetLabel(name string) (*Label, error) GetBuild(jobName string, number int64) (*Build, error) GetJob(id string, parentIDs ...string) (*Job, error) GetSubJob(parentId string, childId string) (*Job, error) GetFolder(id string, parents ...string) (*Folder, error) GetAllNodes() ([]*Node, error) GetAllBuildIds(job string) ([]JobBuild, error) GetAllJobNames() ([]InnerJob, error) GetAllJobs() ([]*Job, error) GetQueue() (*Queue, error) GetQueueUrl() string GetQueueItem(id int64) (*Task, error) GetArtifactData(id string) (*types.FingerPrintResponse, error) GetPlugins(depth int) (*Plugins, error) UninstallPlugin(name string) error HasPlugin(name string) (*Plugin, error) InstallPlugin(name string, version string) error GetView(name string) (*View, error) GetAllViews() ([]*View, error) CreateView(name string, viewType string) (*View, error) Poll() (int, error) CreateCredentialInProject(projectId string, credential *types.Secret) (string, error) UpdateCredentialInProject(projectId string, credential *types.Secret) (string, error) GetCredentialInProject(projectId, id string) (*types.Credential, error) DeleteCredentialInProject(projectId, id string) (string, error) GetProjectPipelineBuildByType(projectId, pipelineId string, status string) (*types.Build, error) GetMultiBranchPipelineBuildByType(projectId, pipelineId, branch string, status string) (*types.Build, error) GetPipeline(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.Pipeline, error) ListPipelines(httpParameters *types.HttpParameters) (*types.PipelineList, error) GetPipelineRun(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.PipelineRun, error) ListPipelineRuns(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineRunList, error) StopPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.StopPipeline, error) ReplayPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.ReplayPipeline, error) RunPipeline(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.RunPipeline, error) GetArtifacts(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]types.Artifacts, error) GetRunLog(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]byte, error) GetStepLog(projectName, pipelineName, runId, nodeId, stepId string, httpParameters *types.HttpParameters) ([]byte, http.Header, error) GetNodeSteps(projectName, pipelineName, runId, nodeId string, httpParameters *types.HttpParameters) ([]types.NodeSteps, error) GetPipelineRunNodes(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]types.PipelineRunNodes, error) SubmitInputStep(projectName, pipelineName, runId, nodeId, stepId string, httpParameters *types.HttpParameters) ([]byte, error) //BranchPipelinne operator interface GetBranchPipeline(projectName, pipelineName, branchName string, httpParameters *types.HttpParameters) (*types.BranchPipeline, error) GetBranchPipelineRun(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) (*types.PipelineRun, error) StopBranchPipeline(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) (*types.StopPipeline, error) ReplayBranchPipeline(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) (*types.ReplayPipeline, error) RunBranchPipeline(projectName, pipelineName, branchName string, httpParameters *types.HttpParameters) (*types.RunPipeline, error) GetBranchArtifacts(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) ([]types.Artifacts, error) GetBranchRunLog(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) ([]byte, error) GetBranchStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId string, httpParameters *types.HttpParameters) ([]byte, http.Header, error) GetBranchNodeSteps(projectName, pipelineName, branchName, runId, nodeId string, httpParameters *types.HttpParameters) ([]types.NodeSteps, error) GetBranchPipelineRunNodes(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) ([]types.BranchPipelineRunNodes, error) SubmitBranchInputStep(projectName, pipelineName, branchName, runId, nodeId, stepId string, httpParameters *types.HttpParameters) ([]byte, error) GetPipelineBranch(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineBranch, error) ScanBranch(projectName, pipelineName string, httpParameters *types.HttpParameters) ([]byte, error) // Common pipeline operator interface GetConsoleLog(projectName, pipelineName string, httpParameters *types.HttpParameters) ([]byte, error) GetCrumb(httpParameters *types.HttpParameters) (*types.Crumb, error) // SCM operator interface GetSCMServers(scmId string, httpParameters *types.HttpParameters) ([]types.SCMServer, error) GetSCMOrg(scmId string, httpParameters *types.HttpParameters) ([]types.SCMOrg, error) GetOrgRepo(scmId, organizationId string, httpParameters *types.HttpParameters) (types.OrgRepo, error) CreateSCMServers(scmId string, httpParameters *types.HttpParameters) (*types.SCMServer, error) Validate(scmId string, httpParameters *types.HttpParameters) (*types.Validates, error) //Webhook operator interface GetNotifyCommit(httpParameters *types.HttpParameters) ([]byte, error) GithubWebhook(httpParameters *types.HttpParameters) ([]byte, error) CheckScriptCompile(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.CheckScript, error) CheckCron(projectName string, httpParameters *types.HttpParameters) (*types.CheckCronRes, error) ToJenkinsfile(httpParameters *types.HttpParameters) (*types.ResJenkinsfile, error) ToJson(httpParameters *types.HttpParameters) (*types.ResJson, error) CreateProjectPipeline(projectId string, pipeline *types.PipelineSpec) (string, error) DeleteProjectPipeline(projectId string, pipelineId string) (string, error) UpdateProjectPipeline(projectId string, pipeline *types.PipelineSpec) (string, error) GetProjectPipelineConfig(projectId, pipelineId string) (*types.PipelineSpec, error) CreateProject(projectId string) (string, error) DeleteProject(projectId string) error GetProject(projectId string) (string, error) AddGlobalRole(roleName string, ids types.GlobalPermissionIds, overwrite bool) error GetGlobalRole(roleName string) (string, error) AddProjectRole(roleName string, pattern string, ids types.ProjectPermissionIds, overwrite bool) error DeleteProjectRoles(roleName ...string) error AssignProjectRole(roleName string, sid string) error UnAssignProjectRole(roleName string, sid string) error AssignGlobalRole(roleName string, sid string) error UnAssignGlobalRole(roleName string, sid string) error DeleteUserInProject(sid string) error }
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 or token After creating an instance call init method.
func (*Jenkins) AddGlobalRole ¶
func (j *Jenkins) AddGlobalRole(roleName string, ids types.GlobalPermissionIds, overwrite bool) error
add a global roleName
func (*Jenkins) AddProjectRole ¶
func (j *Jenkins) AddProjectRole(roleName string, pattern string, ids types.ProjectPermissionIds, overwrite bool) error
add roleName for project
func (*Jenkins) AssignGlobalRole ¶
assign a global roleName to username(sid)
func (*Jenkins) AssignProjectRole ¶
assign a project roleName to username(sid)
func (*Jenkins) BuildJob ¶
Invoke a job. First parameter job name, second parameter is optional Build parameters.
func (*Jenkins) CheckCron ¶
func (j *Jenkins) CheckCron(projectName string, httpParameters *types.HttpParameters) (*types.CheckCronRes, error)
func (*Jenkins) CheckScriptCompile ¶
func (j *Jenkins) CheckScriptCompile(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.CheckScript, error)
func (*Jenkins) CopyJob ¶
Create a copy of a job. First parameter Name of the job to copy from, Second parameter new job name.
func (*Jenkins) CreateCredentialInProject ¶
func (*Jenkins) CreateFolder ¶
Create a new folder This folder can be nested in other parent folders Example: jenkins.CreateFolder("newFolder", "grandparentFolder", "parentFolder")
func (*Jenkins) CreateJob ¶
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) 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) CreateProjectPipeline ¶
func (*Jenkins) CreateSCMServers ¶
func (*Jenkins) CreateView ¶
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) DeleteCredentialInProject ¶
func (*Jenkins) DeleteJobInFolder ¶
Delete a job.
func (*Jenkins) DeleteNode ¶
Delete a Jenkins slave node
func (*Jenkins) DeleteProject ¶
func (*Jenkins) DeleteProjectPipeline ¶
func (*Jenkins) DeleteProjectRoles ¶
delete roleName from the project
func (*Jenkins) DeleteUserInProject ¶
func (*Jenkins) GetAllBuildIds ¶
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) GetAllJobNames ¶
Get Only Array of Job Names, Color, URL Does not query each single Job.
func (*Jenkins) GetAllJobs ¶
Get All Possible Job Objects. Each job will be queried.
func (*Jenkins) GetAllNodes ¶
func (*Jenkins) GetAllViews ¶
func (*Jenkins) GetArtifactData ¶
func (j *Jenkins) GetArtifactData(id string) (*types.FingerPrintResponse, error)
Get Artifact data by Hash
func (*Jenkins) GetArtifacts ¶
func (*Jenkins) GetBranchArtifacts ¶
func (*Jenkins) GetBranchNodeSteps ¶
func (*Jenkins) GetBranchPipeline ¶
func (j *Jenkins) GetBranchPipeline(projectName, pipelineName, branchName string, httpParameters *types.HttpParameters) (*types.BranchPipeline, error)
func (*Jenkins) GetBranchPipelineRun ¶
func (j *Jenkins) GetBranchPipelineRun(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) (*types.PipelineRun, error)
func (*Jenkins) GetBranchPipelineRunNodes ¶
func (j *Jenkins) GetBranchPipelineRunNodes(projectName, pipelineName, branchName, runId string, httpParameters *types.HttpParameters) ([]types.BranchPipelineRunNodes, error)
func (*Jenkins) GetBranchRunLog ¶
func (*Jenkins) GetBranchStepLog ¶
func (*Jenkins) GetConsoleLog ¶
func (*Jenkins) GetCredentialInProject ¶
func (j *Jenkins) GetCredentialInProject(projectId, id string) (*types.Credential, error)
func (*Jenkins) GetCredentialsInProject ¶
func (j *Jenkins) GetCredentialsInProject(projectId string) ([]*types.Credential, error)
func (*Jenkins) GetGlobalRole ¶
if return roleName means exist
func (*Jenkins) GetGlobalRoleHandler ¶
func (j *Jenkins) GetGlobalRoleHandler(roleName string) (*GlobalRole, error)
func (*Jenkins) GetMultiBranchPipelineBuildByType ¶
func (*Jenkins) GetNodeSteps ¶
func (*Jenkins) GetNotifyCommit ¶
func (j *Jenkins) GetNotifyCommit(httpParameters *types.HttpParameters) ([]byte, error)
func (*Jenkins) GetOrgRepo ¶
func (*Jenkins) GetPipeline ¶
func (*Jenkins) GetPipelineBranch ¶
func (j *Jenkins) GetPipelineBranch(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineBranch, error)
func (*Jenkins) GetPipelineRun ¶
func (j *Jenkins) GetPipelineRun(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.PipelineRun, error)
func (*Jenkins) GetPipelineRunNodes ¶
func (j *Jenkins) GetPipelineRunNodes(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) ([]types.PipelineRunNodes, error)
func (*Jenkins) GetPlugins ¶
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) GetProjectPipelineBuildByType ¶
func (*Jenkins) GetProjectPipelineConfig ¶
func (j *Jenkins) GetProjectPipelineConfig(projectId, pipelineId string) (*types.PipelineSpec, error)
func (*Jenkins) GetProjectRole ¶
func (j *Jenkins) GetProjectRole(roleName string) (*ProjectRole, error)
func (*Jenkins) GetQueueItem ¶
GetQueueItem returns a single queue Task
func (*Jenkins) GetQueueUrl ¶
func (*Jenkins) GetSCMServers ¶
func (*Jenkins) GetStepLog ¶
func (*Jenkins) GithubWebhook ¶
func (j *Jenkins) GithubWebhook(httpParameters *types.HttpParameters) ([]byte, error)
func (*Jenkins) HasPlugin ¶
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 ¶
Init Method. Should be called after creating a Jenkins Instance. e.g jenkins,err := CreateJenkins("url").Init() HTTP Client is set here, Connection to jenkins is tested here.
func (*Jenkins) InstallPlugin ¶
InstallPlugin with given version and name
func (*Jenkins) JenkinsfileToPipelineJson ¶
func (j *Jenkins) JenkinsfileToPipelineJson(jenkinsfile string) (*JenkinsfileToPipelineJsonResponse, error)
func (*Jenkins) ListPipelineRuns ¶
func (j *Jenkins) ListPipelineRuns(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.PipelineRunList, error)
func (*Jenkins) ListPipelines ¶
func (j *Jenkins) ListPipelines(httpParameters *types.HttpParameters) (*types.PipelineList, error)
func (*Jenkins) PipelineJsonToJenkinsfile ¶
func (j *Jenkins) PipelineJsonToJenkinsfile(json string) (*PipelineJsonToJenkinsfileResponse, error)
func (*Jenkins) RenameJob ¶
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 *types.HttpParameters) (*types.ReplayPipeline, error)
func (*Jenkins) ReplayPipeline ¶
func (j *Jenkins) ReplayPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.ReplayPipeline, error)
func (*Jenkins) RunBranchPipeline ¶
func (j *Jenkins) RunBranchPipeline(projectName, pipelineName, branchName string, httpParameters *types.HttpParameters) (*types.RunPipeline, error)
func (*Jenkins) RunPipeline ¶
func (j *Jenkins) RunPipeline(projectName, pipelineName string, httpParameters *types.HttpParameters) (*types.RunPipeline, error)
func (*Jenkins) SafeRestart ¶
SafeRestart jenkins, restart will be done when there are no jobs running
func (*Jenkins) ScanBranch ¶
func (*Jenkins) SendPureRequest ¶
func (j *Jenkins) SendPureRequest(path string, httpParameters *types.HttpParameters) ([]byte, error)
TODO: deprecated, use SendJenkinsRequestWithHeaderResp() instead
func (*Jenkins) SendPureRequestWithHeaderResp ¶
func (j *Jenkins) SendPureRequestWithHeaderResp(path string, httpParameters *types.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 *types.HttpParameters) (*types.StopPipeline, error)
func (*Jenkins) StopPipeline ¶
func (j *Jenkins) StopPipeline(projectName, pipelineName, runId string, httpParameters *types.HttpParameters) (*types.StopPipeline, error)
func (*Jenkins) SubmitBranchInputStep ¶
func (*Jenkins) SubmitInputStep ¶
func (*Jenkins) ToJenkinsfile ¶
func (j *Jenkins) ToJenkinsfile(httpParameters *types.HttpParameters) (*types.ResJenkinsfile, error)
func (*Jenkins) UnAssignGlobalRole ¶
unassign a global roleName to username(sid)
func (*Jenkins) UnAssignProjectRole ¶
unassign a project roleName to username(sid)
func (*Jenkins) UninstallPlugin ¶
UninstallPlugin plugin otherwise returns error
func (*Jenkins) UpdateCredentialInProject ¶
func (*Jenkins) UpdateProjectPipeline ¶
func (*Jenkins) ValidateFingerPrint ¶
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 ¶
func (JenkinsBlueTime) MarshalJSON ¶
func (t JenkinsBlueTime) MarshalJSON() ([]byte, error)
func (*JenkinsBlueTime) UnmarshalJSON ¶
func (t *JenkinsBlueTime) UnmarshalJSON(b []byte) error
type Job ¶
type Job struct { Raw *JobResponse Jenkins *Jenkins Base string }
func (*Job) GetAllBuildIds ¶
Returns All Builds with Number and URL
func (*Job) GetBuildsFields ¶
func (*Job) GetDescription ¶
func (*Job) GetDetails ¶
func (j *Job) GetDetails() *JobResponse
func (*Job) GetDownstreamJobs ¶
func (*Job) GetDownstreamJobsMetadata ¶
func (*Job) GetFirstBuild ¶
func (*Job) GetInnerJobs ¶
func (*Job) GetInnerJobsMetadata ¶
func (*Job) GetLastBuild ¶
func (*Job) GetLastCompletedBuild ¶
func (*Job) GetLastFailedBuild ¶
func (*Job) GetLastStableBuild ¶
func (*Job) GetLastSuccessfulBuild ¶
func (*Job) GetParameters ¶
func (j *Job) GetParameters() ([]ParameterDefinition, error)
func (*Job) GetPipelineRun ¶
func (job *Job) GetPipelineRun(id string) (pr *PipelineRun, err error)
func (*Job) GetPipelineRuns ¶
func (job *Job) GetPipelineRuns() (pr []PipelineRun, err error)
func (*Job) GetUpstreamJobs ¶
func (*Job) GetUpstreamJobsMetadata ¶
func (*Job) HasQueuedBuild ¶
func (j *Job) HasQueuedBuild()
func (*Job) UpdateConfig ¶
type JobResponse ¶
type JobResponse struct { Class string `json:"_class"` Actions []types.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 FullName string `json:"fullName"` FullDisplayName string `json:"fullDisplayName"` 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"` 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(secret *types.Secret) *KubeconfigCredential
type KubeconfigSource ¶
type Label ¶
type Label struct { Raw *LabelResponse Jenkins *Jenkins Base string }
type LabelResponse ¶
type Node ¶
type Node struct { Raw *NodeResponse Jenkins *Jenkins Base string }
func (*Node) Disconnect ¶
func (*Node) GetLogText ¶
func (*Node) Info ¶
func (n *Node) Info() (*NodeResponse, error)
func (*Node) IsJnlpAgent ¶
func (*Node) IsTemporarilyOffline ¶
func (*Node) LaunchNodeBySSH ¶
func (*Node) SetOffline ¶
func (*Node) ToggleTemporarilyOffline ¶
type NodeResponse ¶
type NodeResponse struct { Class string `json:"_class"` 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"` CommandInfo struct { JnLpUrl string `json:"jn_lp_url"` AgentJarUrl string `json:"agent_jar_url"` Secret string `json:"secret"` WorkDir string `json:"work_dir"` Command string `json:"command"` } `json:"command_info,omitempty"` }
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"` }
type ParameterDefinition ¶
type Pipeline ¶
type Pipeline struct { HttpParameters *types.HttpParameters Jenkins *Jenkins Path string }
func (*Pipeline) CheckScriptCompile ¶
func (p *Pipeline) CheckScriptCompile() (*types.CheckScript, error)
func (*Pipeline) GetBranchArtifacts ¶
func (*Pipeline) GetBranchNodeSteps ¶
func (*Pipeline) GetBranchPipeline ¶
func (p *Pipeline) GetBranchPipeline() (*types.BranchPipeline, error)
func (*Pipeline) GetBranchPipelineRun ¶
func (p *Pipeline) GetBranchPipelineRun() (*types.PipelineRun, error)
func (*Pipeline) GetBranchPipelineRunNodes ¶
func (p *Pipeline) GetBranchPipelineRunNodes() ([]types.BranchPipelineRunNodes, error)
func (*Pipeline) GetBranchRunLog ¶
func (*Pipeline) GetBranchStepLog ¶
func (*Pipeline) GetConsoleLog ¶
func (*Pipeline) GetNotifyCommit ¶
func (*Pipeline) GetPipelineBranch ¶
func (p *Pipeline) GetPipelineBranch() (*types.PipelineBranch, error)
func (*Pipeline) GetPipelineRun ¶
func (p *Pipeline) GetPipelineRun() (*types.PipelineRun, error)
func (*Pipeline) GetPipelineRunNodes ¶
func (p *Pipeline) GetPipelineRunNodes() ([]types.PipelineRunNodes, error)
func (*Pipeline) GithubWebhook ¶
func (*Pipeline) ListPipelineRuns ¶
func (p *Pipeline) ListPipelineRuns() (*types.PipelineRunList, error)
func (*Pipeline) ListPipelines ¶
func (p *Pipeline) ListPipelines() (*types.PipelineList, error)
func (*Pipeline) ReplayBranchPipeline ¶
func (p *Pipeline) ReplayBranchPipeline() (*types.ReplayPipeline, error)
func (*Pipeline) ReplayPipeline ¶
func (p *Pipeline) ReplayPipeline() (*types.ReplayPipeline, error)
func (*Pipeline) RunBranchPipeline ¶
func (p *Pipeline) RunBranchPipeline() (*types.RunPipeline, error)
func (*Pipeline) RunPipeline ¶
func (p *Pipeline) RunPipeline() (*types.RunPipeline, error)
func (*Pipeline) ScanBranch ¶
func (*Pipeline) StopBranchPipeline ¶
func (p *Pipeline) StopBranchPipeline() (*types.StopPipeline, error)
func (*Pipeline) StopPipeline ¶
func (p *Pipeline) StopPipeline() (*types.StopPipeline, error)
func (*Pipeline) SubmitBranchInputStep ¶
func (*Pipeline) SubmitInputStep ¶
func (*Pipeline) ToJenkinsfile ¶
func (p *Pipeline) ToJenkinsfile() (*types.ResJenkinsfile, error)
type PipelineArtifact ¶
type PipelineInputAction ¶
type PipelineNode ¶
type PipelineNode struct { Run *PipelineRun Base string URLs map[string]map[string]string `json:"_links"` ID string Name string Status string StartTime int64 `json:"startTimeMillis"` Duration int64 `json:"durationMillis"` StageFlowNodes []PipelineNode ParentNodes []int64 }
func (*PipelineNode) GetLog ¶
func (node *PipelineNode) GetLog() (log *PipelineNodeLog, err error)
type PipelineNodeLog ¶
type PipelineRun ¶
type PipelineRun struct { Job *Job Base string URLs map[string]map[string]string `json:"_links"` ID string Name string Status string StartTime int64 `json:"startTimeMillis"` EndTime int64 `json:"endTimeMillis"` Duration int64 `json:"durationMillis"` Stages []PipelineNode }
func (*PipelineRun) AbortInput ¶
func (pr *PipelineRun) AbortInput() (bool, error)
func (*PipelineRun) GetArtifacts ¶
func (pr *PipelineRun) GetArtifacts() (artifacts []PipelineArtifact, err error)
func (*PipelineRun) GetNode ¶
func (pr *PipelineRun) GetNode(id string) (node *PipelineNode, err error)
func (*PipelineRun) GetPendingInputActions ¶
func (pr *PipelineRun) GetPendingInputActions() (PIAs []PipelineInputAction, err error)
func (*PipelineRun) ProceedInput ¶
func (pr *PipelineRun) ProceedInput() (bool, error)
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 PrivateKeySource ¶
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 types.ProjectPermissionIds) error
update ProjectPermissionIds to Project pattern string means some project, like project-name/*
type ProjectRoleResponse ¶
type ProjectRoleResponse struct { RoleName string `json:"roleName"` PermissionIds types.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 (*Requester) ReadJSONResponse ¶
func (*Requester) ReadRawResponse ¶
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 *types.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 *types.Secret) *SshCredential
type Task ¶
func (*Task) GetParameters ¶
func (t *Task) GetParameters() []parameter
type TestResult ¶
type TestResult struct { Duration float64 `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 float64 `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 float64 `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 *types.Secret) *UsernamePasswordCredential
Source Files ¶
- artifact.go
- build.go
- build_history.go
- constants.go
- credentials.go
- error.go
- executor.go
- fingerprint.go
- folder.go
- interfaces.go
- jenkins.go
- job.go
- label.go
- node.go
- pipeline.go
- pipeline_internal.go
- pipeline_model_converter.go
- plugin.go
- project.go
- project_pipeline.go
- pure_request.go
- queue.go
- request.go
- role.go
- utils.go
- views.go