projects

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

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

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

Documentation

Index

Constants

View Source
const (
	SonarAnalysisActionClass = "hudson.plugins.sonar.action.SonarAnalysisAction"
	SonarMetricKeys          = "" /* 432-byte string literal not displayed */
	SonarAdditionalFields    = "metrics,periods"
)
View Source
const (
	CredentialTypeUsernamePassword = "username_password"
	CredentialTypeSsh              = "ssh"
	CredentialTypeSecretText       = "secret_text"
	CredentialTypeKubeConfig       = "kubeconfig"
)
View Source
const (
	JenkinsJobPipeline            = "pipeline"
	JenkinsJobMultiBranchPipeline = "multi-branch-pipeline"
)
View Source
const (
	ProjectOwner      = "owner"
	ProjectMaintainer = "maintainer"
	ProjectDeveloper  = "developer"
	ProjectReporter   = "reporter"
)

Variables

View Source
var CredentialTypeMap = map[string]string{
	"SSH Username with private key":         CredentialTypeSsh,
	"Username with password":                CredentialTypeUsernamePassword,
	"Secret text":                           CredentialTypeSecretText,
	"Kubernetes configuration (kubeconfig)": CredentialTypeKubeConfig,
}
View Source
var DefaultRoles = []*Role{
	{
		Name:        ProjectOwner,
		Description: "Owner have access to do all the operations of a DevOps project and own the highest permissions as well.",
	},
	{
		Name:        ProjectMaintainer,
		Description: "Maintainer have access to manage pipeline and credential configuration in a DevOps project.",
	},
	{
		Name:        ProjectDeveloper,
		Description: "Developer is able to view and trigger the pipeline.",
	},
	{
		Name:        ProjectReporter,
		Description: "Reporter is only allowed to view the status of the pipeline.",
	},
}
View Source
var JenkinsOwnerProjectPermissionIds = &gojenkins.ProjectPermissionIds{
	CredentialCreate:        true,
	CredentialDelete:        true,
	CredentialManageDomains: true,
	CredentialUpdate:        true,
	CredentialView:          true,
	ItemBuild:               true,
	ItemCancel:              true,
	ItemConfigure:           true,
	ItemCreate:              true,
	ItemDelete:              true,
	ItemDiscover:            true,
	ItemMove:                true,
	ItemRead:                true,
	ItemWorkspace:           true,
	RunDelete:               true,
	RunReplay:               true,
	RunUpdate:               true,
	SCMTag:                  true,
}
View Source
var JenkinsPipelinePermissionMap = map[string]gojenkins.ProjectPermissionIds{
	ProjectOwner: gojenkins.ProjectPermissionIds{
		CredentialCreate:        true,
		CredentialDelete:        true,
		CredentialManageDomains: true,
		CredentialUpdate:        true,
		CredentialView:          true,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           true,
		ItemCreate:              true,
		ItemDelete:              true,
		ItemDiscover:            true,
		ItemMove:                true,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  true,
	},
	ProjectMaintainer: gojenkins.ProjectPermissionIds{
		CredentialCreate:        true,
		CredentialDelete:        true,
		CredentialManageDomains: true,
		CredentialUpdate:        true,
		CredentialView:          true,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           true,
		ItemCreate:              true,
		ItemDelete:              true,
		ItemDiscover:            true,
		ItemMove:                true,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  true,
	},
	ProjectDeveloper: gojenkins.ProjectPermissionIds{
		CredentialCreate:        false,
		CredentialDelete:        false,
		CredentialManageDomains: false,
		CredentialUpdate:        false,
		CredentialView:          false,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           false,
		ItemCreate:              false,
		ItemDelete:              false,
		ItemDiscover:            true,
		ItemMove:                false,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  false,
	},
	ProjectReporter: gojenkins.ProjectPermissionIds{
		CredentialCreate:        false,
		CredentialDelete:        false,
		CredentialManageDomains: false,
		CredentialUpdate:        false,
		CredentialView:          false,
		ItemBuild:               false,
		ItemCancel:              false,
		ItemConfigure:           false,
		ItemCreate:              false,
		ItemDelete:              false,
		ItemDiscover:            true,
		ItemMove:                false,
		ItemRead:                true,
		ItemWorkspace:           false,
		RunDelete:               false,
		RunReplay:               false,
		RunUpdate:               false,
		SCMTag:                  false,
	},
}
View Source
var JenkinsProjectPermissionMap = map[string]gojenkins.ProjectPermissionIds{
	ProjectOwner: gojenkins.ProjectPermissionIds{
		CredentialCreate:        true,
		CredentialDelete:        true,
		CredentialManageDomains: true,
		CredentialUpdate:        true,
		CredentialView:          true,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           true,
		ItemCreate:              true,
		ItemDelete:              true,
		ItemDiscover:            true,
		ItemMove:                true,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  true,
	},
	ProjectMaintainer: gojenkins.ProjectPermissionIds{
		CredentialCreate:        true,
		CredentialDelete:        true,
		CredentialManageDomains: true,
		CredentialUpdate:        true,
		CredentialView:          true,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           false,
		ItemCreate:              true,
		ItemDelete:              false,
		ItemDiscover:            true,
		ItemMove:                false,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  true,
	},
	ProjectDeveloper: gojenkins.ProjectPermissionIds{
		CredentialCreate:        false,
		CredentialDelete:        false,
		CredentialManageDomains: false,
		CredentialUpdate:        false,
		CredentialView:          false,
		ItemBuild:               true,
		ItemCancel:              true,
		ItemConfigure:           false,
		ItemCreate:              false,
		ItemDelete:              false,
		ItemDiscover:            true,
		ItemMove:                false,
		ItemRead:                true,
		ItemWorkspace:           true,
		RunDelete:               true,
		RunReplay:               true,
		RunUpdate:               true,
		SCMTag:                  false,
	},
	ProjectReporter: gojenkins.ProjectPermissionIds{
		CredentialCreate:        false,
		CredentialDelete:        false,
		CredentialManageDomains: false,
		CredentialUpdate:        false,
		CredentialView:          false,
		ItemBuild:               false,
		ItemCancel:              false,
		ItemConfigure:           false,
		ItemCreate:              false,
		ItemDelete:              false,
		ItemDiscover:            true,
		ItemMove:                false,
		ItemRead:                true,
		ItemWorkspace:           false,
		RunDelete:               false,
		RunReplay:               false,
		RunUpdate:               false,
		SCMTag:                  false,
	},
}
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 GetPipelineRoleName

func GetPipelineRoleName(projectId, role string) string

func GetPipelineRolePattern

func GetPipelineRolePattern(projectId string) string

func GetProjectRoleName

func GetProjectRoleName(projectId, role string) string

func GetProjectRolePattern

func GetProjectRolePattern(projectId string) string

Types

type AddProjectMemberRequest

type AddProjectMemberRequest struct {
	Username string `json:"username"`
	Role     string `json:"role"`
}

type CopySshCredentialRequest

type CopySshCredentialRequest struct {
	Id string `json:"id"`
}

type CreateProjectRequest

type CreateProjectRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Extra       string `json:"extra"`
}

type CredentialRequest

type CredentialRequest struct {
	Type    string                 `json:"type"`
	Domain  string                 `json:"domain"`
	Content map[string]interface{} `json:"content"`
}

type CredentialResponse

type CredentialResponse struct {
	Id          string `json:"id"`
	Type        string `json:"type"`
	DisplayName string `json:"display_name"`
	Fingerprint *struct {
		FileName string `json:"file_name,omitempty"`
		Hash     string `json:"hash,omitempty"`
		Usage    []*struct {
			Name   string `json:"name,omitempty"`
			Ranges struct {
				Ranges []*struct {
					Start int `json:"start"`
					End   int `json:"end"`
				} `json:"ranges"`
			} `json:"ranges"`
		} `json:"usage,omitempty"`
	} `json:"fingerprint,omitempty"`
	Description string                 `json:"description"`
	Domain      string                 `json:"domain"`
	CreateTime  *time.Time             `json:"create_time,omitempty"`
	Creator     string                 `json:"creator,omitempty"`
	Content     map[string]interface{} `json:"content"`
}

type DeleteCredentialRequest

type DeleteCredentialRequest struct {
	Domain string `json:"domain"`
}

type DiscarderProperty

type DiscarderProperty struct {
	DaysToKeep string `json:"days_to_keep" mapstructure:"days_to_keep"`
	NumToKeep  string `json:"num_to_keep" mapstructure:"num_to_keep"`
}

type GitCloneOption

type GitCloneOption struct {
	Shallow bool `json:"shallow" mapstructure:"shallow"`
	Timeout int  `json:"timeout,omitempty" mapstructure:"timeout"`
	Depth   int  `json:"depth,omitempty" mapstructure:"depth"`
}

type GitSource

type GitSource struct {
	Url              string          `json:"url,omitempty" mapstructure:"url"`
	CredentialId     string          `json:"credential_id,omitempty" mapstructure:"credential_id"`
	DiscoverBranches bool            `json:"discover_branches,omitempty" mapstructure:"discover_branches"`
	CloneOption      *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"`
	RegexFilter      string          `json:"regex_filter,omitempty" mapstructure:"regex_filter"`
}

type GithubDiscoverPRFromForks

type GithubDiscoverPRFromForks struct {
	Strategy int `json:"strategy" mapstructure:"strategy"`
	Trust    int `json:"trust" mapstructure:"trust"`
}

type GithubSource

type GithubSource struct {
	Owner                string                     `json:"owner,omitempty" mapstructure:"owner"`
	Repo                 string                     `json:"repo,omitempty" mapstructure:"repo"`
	CredentialId         string                     `json:"credential_id,omitempty" mapstructure:"credential_id"`
	ApiUri               string                     `json:"api_uri,omitempty" mapstructure:"api_uri"`
	DiscoverBranches     int                        `json:"discover_branches,omitempty" mapstructure:"discover_branches"`
	DiscoverPRFromOrigin int                        `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin"`
	DiscoverPRFromForks  *GithubDiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks"`
	CloneOption          *GitCloneOption            `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"`
	RegexFilter          string                     `json:"regex_filter,omitempty" mapstructure:"regex_filter"`
}

type JenkinsJobRequest

type JenkinsJobRequest struct {
	Type   string                 `json:"type"`
	Define map[string]interface{} `json:"define"`
}

type KubeconfigCredentialRequest

type KubeconfigCredentialRequest struct {
	Id          string `json:"id"`
	Content     string `json:"content"`
	Description string `json:"description"`
}

type MultiBranchPipeline

type MultiBranchPipeline struct {
	Name         string             `json:"name"`
	Description  string             `json:"description"`
	Discarder    *DiscarderProperty `json:"discarder"`
	TimerTrigger *TimerTrigger      `json:"timer_trigger" mapstructure:"timer_trigger"`
	Source       *Source            `json:"source"`
	ScriptPath   string             `json:"script_path" mapstructure:"script_path"`
}

type Parameter

type Parameter struct {
	Name         string `json:"name"`
	DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value"`
	Type         string `json:"type"`
	Description  string `json:"description"`
}

type Pipeline

type Pipeline struct {
	Name              string             `json:"name"`
	Description       string             `json:"description"`
	Discarder         *DiscarderProperty `json:"discarder"`
	Parameters        []*Parameter       `json:"parameters"`
	DisableConcurrent bool               `json:"disable_concurrent" mapstructure:"disable_concurrent"`
	TimerTrigger      *TimerTrigger      `json:"timer_trigger" mapstructure:"timer_trigger"`
	RemoteTrigger     *RemoteTrigger     `json:"remote_trigger" mapstructure:"remote_trigger"`
	Jenkinsfile       string             `json:"jenkinsfile"`
}

type ProjectRoleResponse

type ProjectRoleResponse struct {
	ProjectRole *gojenkins.ProjectRole
	Err         error
}

type ProjectService

type ProjectService struct {
	Ds *ds.Ds
}

func (*ProjectService) AddProjectMemberHandler

func (s *ProjectService) AddProjectMemberHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) CreateCredentialHandler

func (s *ProjectService) CreateCredentialHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) CreatePipelineHandler

func (s *ProjectService) CreatePipelineHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) CreateProjectHandler

func (s *ProjectService) CreateProjectHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) DeleteCredentialHandler

func (s *ProjectService) DeleteCredentialHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) DeleteMemberHandler

func (s *ProjectService) DeleteMemberHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) DeletePipelineHandler

func (s *ProjectService) DeletePipelineHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) DeleteProjectHandler

func (s *ProjectService) DeleteProjectHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetCredentialHandler

func (s *ProjectService) GetCredentialHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetCredentialsHandler

func (s *ProjectService) GetCredentialsHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetMemberHandler

func (s *ProjectService) GetMemberHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetMembersHandler

func (s *ProjectService) GetMembersHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetMultiBranchPipelineSonarHandler

func (s *ProjectService) GetMultiBranchPipelineSonarHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetPipelineHandler

func (s *ProjectService) GetPipelineHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetPipelineScmHandler

func (s *ProjectService) GetPipelineScmHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetPipelineSonarHandler

func (s *ProjectService) GetPipelineSonarHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetProjectDefaultRolesHandler

func (s *ProjectService) GetProjectDefaultRolesHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetProjectHandler

func (s *ProjectService) GetProjectHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) GetProjectsHandler

func (s *ProjectService) GetProjectsHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) UpdateCredentialHandler

func (s *ProjectService) UpdateCredentialHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) UpdateMemberHandler

func (s *ProjectService) UpdateMemberHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) UpdatePipelineHandler

func (s *ProjectService) UpdatePipelineHandler(w rest.ResponseWriter, r *rest.Request)

func (*ProjectService) UpdateProjectHandler

func (s *ProjectService) UpdateProjectHandler(w rest.ResponseWriter, r *rest.Request)

type RemoteTrigger

type RemoteTrigger struct {
	Token string `json:"token"`
}

type Role

type Role struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type ScmInfo

type ScmInfo struct {
	Type   string `json:"type"`
	Repo   string `json:"repo"`
	ApiUri string `json:"api_uri,omitempty"`
	Path   string `json:"path"`
}

type SecretTextCredentialRequest

type SecretTextCredentialRequest struct {
	Id          string `json:"id"`
	Secret      string `json:"secret"`
	Description string `json:"description"`
}

type SingleSvnSource

type SingleSvnSource struct {
	Remote       string `json:"remote,omitempty"`
	CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
}

type SonarStatus

type SonarStatus struct {
	Measures      *sonargo.MeasuresComponentObject `json:"measures,omitempty"`
	Issues        *sonargo.IssuesSearchObject      `json:"issues,omitempty"`
	JenkinsAction *gojenkins.GeneralObj            `json:"jenkinsAction,omitempty"`
	Task          *sonargo.CeTaskObject            `json:"task,omitempty"`
}

type Source

type Source struct {
	Type   string                 `json:"type"`
	Define map[string]interface{} `json:"define"`
}

type SshCredentialRequest

type SshCredentialRequest struct {
	Id          string `json:"id"`
	Username    string `json:"username"`
	Passphrase  string `json:"passphrase"`
	PrivateKey  string `json:"private_key" mapstructure:"private_key"`
	Description string `json:"description"`
}

type SvnSource

type SvnSource struct {
	Remote       string `json:"remote,omitempty"`
	CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
	Includes     string `json:"includes,omitempty"`
	Excludes     string `json:"excludes,omitempty"`
}

type TimerTrigger

type TimerTrigger struct {
	// user in no scm job
	Cron string `json:"cron,omitempty"`

	// use in multi-branch job
	Interval string `json:"interval,omitempty"`
}

type UpdateProjectMemberRequest

type UpdateProjectMemberRequest struct {
	Role string `json:"role"`
}

type UpdateProjectRequest

type UpdateProjectRequest struct {
	Description string `json:"description"`
	Extra       string `json:"extra"`
}

type UsernamePasswordCredentialRequest

type UsernamePasswordCredentialRequest struct {
	Id          string `json:"id"`
	Username    string `json:"username"`
	Password    string `json:"password,omitempty"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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