mirror of
https://github.com/jenkinsci/kubernetes-operator.git
synced 2026-09-30 13:15:52 +02:00
Fix get Jenkins plugins through Jenkins API
(cherry picked from commit 6de21202e8)
This commit is contained in:
@@ -172,3 +172,17 @@ func (jenkins *jenkins) GetNodeSecret(name string) (string, error) {
|
||||
|
||||
return result["secret"], nil
|
||||
}
|
||||
|
||||
// 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 *jenkins) GetPlugins(depth int) (*gojenkins.Plugins, error) {
|
||||
p := gojenkins.Plugins{Jenkins: &jenkins.Jenkins, Raw: new(gojenkins.PluginResponse), Base: "/pluginManager", Depth: depth}
|
||||
statusCode, err := p.Poll()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if statusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("invalid status code returned: %d", statusCode)
|
||||
}
|
||||
return &p, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user