Skip to content

Commit

Permalink
replace it with the new Jenkins client (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzmuer authored Mar 17, 2022
1 parent aff7f5e commit b617eff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/apiserver/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
v1 "k8s.io/api/core/v1"
"kubesphere.io/devops/pkg/client/cache"
"kubesphere.io/devops/pkg/client/devops/jclient"
"kubesphere.io/devops/pkg/client/sonarqube"
"sigs.k8s.io/controller-runtime/pkg/manager"

Expand All @@ -37,7 +38,6 @@ import (
"net/http"
"strings"

"kubesphere.io/devops/pkg/client/devops/jenkins"
"kubesphere.io/devops/pkg/client/k8s"
"kubesphere.io/devops/pkg/client/s3"
fakes3 "kubesphere.io/devops/pkg/client/s3/fake"
Expand Down Expand Up @@ -111,7 +111,7 @@ func (s *ServerRunOptions) NewAPIServer(stopCh <-chan struct{}) (*apiserver.APIS
}

if s.JenkinsOptions.Host != "" {
devopsClient, err := jenkins.NewDevopsClient(s.JenkinsOptions)
devopsClient, err := jclient.NewJenkinsClient(s.JenkinsOptions)
if err != nil {
return nil, fmt.Errorf("failed to connect to jenkins, please check jenkins status, error: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/devops/jclient/jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// JenkinsClient represents a client of Jenkins
type JenkinsClient struct {
Core core.JenkinsCore
jenkins devops.Interface // For refactor purpose only
jenkins *jenkins.Jenkins // For refactor purpose only
}

// ApplyNewSource apply a new source
Expand Down
3 changes: 1 addition & 2 deletions pkg/client/devops/jenkins/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ limitations under the License.
package jenkins

import (
"kubesphere.io/devops/pkg/client/devops"
"net/http"
)

func NewDevopsClient(options *Options) (devops.Interface, error) {
func NewDevopsClient(options *Options) (*Jenkins, error) {
// we have to create http client with no redirection
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
Expand Down

0 comments on commit b617eff

Please sign in to comment.