add devops project controller

Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
runzexia
2020-03-18 14:48:41 +08:00
parent 0a07e5f652
commit 93461cfb0b
40 changed files with 1487 additions and 225 deletions

View File

@@ -17,13 +17,11 @@ package jenkins
import (
"compress/gzip"
"encoding/json"
"github.com/asaskevich/govalidator"
"io"
"io/ioutil"
"k8s.io/klog"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"unicode/utf8"
@@ -131,16 +129,3 @@ func (t *JenkinsBlueTime) UnmarshalJSON(b []byte) error {
func (t JenkinsBlueTime) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(t))
}
func GetJenkinsStatusCode(jenkinsErr error) int {
if code, err := strconv.Atoi(jenkinsErr.Error()); err == nil {
message := http.StatusText(code)
if !govalidator.IsNull(message) {
return code
}
}
if jErr, ok := jenkinsErr.(*ErrorResponse); ok {
return jErr.Response.StatusCode
}
return http.StatusInternalServerError
}