jenkins

package
v0.0.0-...-30703ad Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server         string `mapstructure: Server`
	JenkinsUser    string `mapstructure: JenkinsUser`
	Token          string `mapstructure: Token`
	ConfigPath     string
	ConfigFileName string
	ConfigFullPath string
}

Config is focused in the configuration json file

func (*Config) CheckIfExists

func (j *Config) CheckIfExists() error

CheckIfExists check if file exists

Args:

path - string

Returns

error

func (*Config) LoadConfig

func (j *Config) LoadConfig() (config Config, err error)

LoadConfig read the JSON configuration from specified file

Example file:

$HOME/.config/jenkinsctl/config.json

Args:

Returns

nil or error

func (*Config) SetConfigPath

func (j *Config) SetConfigPath(path string)

SetConfigPath set the default config path

Args:

Returns

string or error

type Jenkins

type Jenkins struct {
	Instance    *gojenkins.Jenkins
	Server      string
	JenkinsUser string
	Token       string
	Context     context.Context
}

Jenkins connection object

func (*Jenkins) AddJobToView

func (j *Jenkins) AddJobToView(viewName string, jobName string) error

AddJobToView will add a specific job to a view

func (*Jenkins) CreateJob

func (j *Jenkins) CreateJob(xmlFile string, jobName string) error

CreateJob will create a job based on XML specification

Args:

xmlFile	- Job described in XML format
jobName - Job Name

Returns:

error or nil

func (*Jenkins) CreateView

func (j *Jenkins) CreateView(viewName string, viewType string) error

CreateView will create a view

Args:

viewname - view name
viewType - view type

Returns

error or nil

func (*Jenkins) DeleteJob

func (j *Jenkins) DeleteJob(jobName string) error

DeleteJob will delete a job

Args:

jobName - job name

Returns:

error or nil

func (*Jenkins) DownloadArtifacts

func (j *Jenkins) DownloadArtifacts(jobName string, buildID int64, pathToSave string) error

DownloadArtifacts will download artifacts

Args:

jobName - job name
buildID - build ID
pathToSave - path to save artifact

Returns:

error or nil

func (*Jenkins) GetLastBuild

func (j *Jenkins) GetLastBuild(jobName string) error

GetLastBuild will get last build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) GetLastCompletedBuild

func (j *Jenkins) GetLastCompletedBuild(jobName string) error

GetLastCompletedBuild get last completed build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) GetLastFailedBuild

func (j *Jenkins) GetLastFailedBuild(jobName string) error

GetLastFailedBuild will get last failed build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) GetLastStableBuild

func (j *Jenkins) GetLastStableBuild(jobName string) error

GetLastStableBuild will get last stable build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) GetLastSuccessfulBuild

func (j *Jenkins) GetLastSuccessfulBuild(jobName string) error

GetLastSuccessfulBuild will get last failed build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) GetLastUnstableBuild

func (j *Jenkins) GetLastUnstableBuild(jobName string) error

GetLastUnstableBuild will get last unstable build

Args:

jobName - Job Name

Returns:

error or nil

func (*Jenkins) Init

func (j *Jenkins) Init(config Config) error

Init will initilialize connection with jenkins server

Args:

Returns

func (*Jenkins) JobGetConfig

func (j *Jenkins) JobGetConfig(jobName string) error

JobGetConfig get the configuration from job

Args:

jobName - job name

Returns:

error or nil

func (*Jenkins) PluginsShow

func (j *Jenkins) PluginsShow()

PluginsShow show all plugins installed and enabled

Returns

nil or error

func (*Jenkins) ServerInfo

func (j *Jenkins) ServerInfo() error

ServerInfo will show information regarding the server

Args:

func (*Jenkins) ShowAllJobs

func (j *Jenkins) ShowAllJobs() error

ShowAllJobs will show all jobs

Args:

Returns:

error or nil

func (*Jenkins) ShowBuildQueue

func (j *Jenkins) ShowBuildQueue() error

ShowBuildQueue show the Build Queue

Args:

Returns

func (*Jenkins) ShowNodes

func (j *Jenkins) ShowNodes(showStatus string) ([]string, error)

ShowNodes show all plugins installed and enabled

Args:

showStatus - show only the

Returns

code return, nil or error

func (*Jenkins) ShowStatus

func (j *Jenkins) ShowStatus(object string)

ShowStatus will show the statys of object TIP: Meaning of collors: https://github.com/jenkinsci/jenkins/blob/5e9b451a11926e5b42d4a94612ca566de058f494/core/src/main/java/hudson/model/BallColor.java#L56

func (*Jenkins) ShowViews

func (j *Jenkins) ShowViews() error

ShowViews will show all views

Args:

Returns:

error or nil

Jump to

Keyboard shortcuts

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