From 921341d8ce5b0072bdf229348fb8b137051c98fd Mon Sep 17 00:00:00 2001 From: shaowenchen Date: Tue, 2 Mar 2021 15:11:12 +0800 Subject: [PATCH] fix: pipeline sync annotations Signed-off-by: shaowenchen --- pkg/kapis/devops/v1alpha2/devops.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/kapis/devops/v1alpha2/devops.go b/pkg/kapis/devops/v1alpha2/devops.go index d845e0b5..c8039bd1 100644 --- a/pkg/kapis/devops/v1alpha2/devops.go +++ b/pkg/kapis/devops/v1alpha2/devops.go @@ -20,6 +20,9 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "strings" + "github.com/emicklei/go-restful" "k8s.io/apiserver/pkg/authentication/user" log "k8s.io/klog" @@ -33,8 +36,6 @@ import ( "kubesphere.io/kubesphere/pkg/server/params" clientDevOps "kubesphere.io/kubesphere/pkg/simple/client/devops" "kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins" - "net/http" - "strings" ) const jenkinsHeaderPre = "X-" @@ -131,7 +132,10 @@ func (h *ProjectPipelineHandler) ListPipelines(req *restful.Request, resp *restf } else { for i, _ := range res.Items { if index, ok := pipelineMap[res.Items[i].Name]; ok { + // keep annotations field of pipelineList + annotations := pipelineList.Items[index].Annotations pipelineList.Items[index] = res.Items[i] + pipelineList.Items[index].Annotations = annotations } } } -- GitLab