diff --git a/pkg/apis/devops/install/install.go b/pkg/apis/devops/install/install.go index 31cada4cf..035d6a367 100644 --- a/pkg/apis/devops/install/install.go +++ b/pkg/apis/devops/install/install.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package install import ( @@ -30,4 +30,4 @@ func init() { func Install(c *restful.Container) { urlruntime.Must(devopsv1alpha2.AddToContainer(c)) -} \ No newline at end of file +} diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index 16a65e11e..58d36287b 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package v1alpha2 import ( diff --git a/pkg/apiserver/devops/devops.go b/pkg/apiserver/devops/devops.go index 407e7cd3e..a8d473924 100644 --- a/pkg/apiserver/devops/devops.go +++ b/pkg/apiserver/devops/devops.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package devops import ( diff --git a/pkg/apiserver/tenant/tenant.go b/pkg/apiserver/tenant/tenant.go index af58bcff0..71a44b6c8 100644 --- a/pkg/apiserver/tenant/tenant.go +++ b/pkg/apiserver/tenant/tenant.go @@ -262,6 +262,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) { err := req.ReadEntity(&devops) if err != nil { + glog.Infof("%+v", err) resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err)) return } @@ -270,6 +271,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) { project, err, code := tenant.CreateDevopsProject(username, workspaceName, &devops) if err != nil { + glog.Errorf("%+v", err) resp.WriteHeaderAndEntity(code, errors.Wrap(err)) return } diff --git a/pkg/gojenkins/build.go b/pkg/gojenkins/build.go index 69aea39bc..0d8af0a5e 100644 --- a/pkg/gojenkins/build.go +++ b/pkg/gojenkins/build.go @@ -24,6 +24,12 @@ import ( "time" ) +const ( + Git = "git" + Hg = "hg" + Svn = "svc" +) + type Build struct { Raw *BuildResponse Job *Job @@ -392,7 +398,7 @@ func (b *Build) GetDuration() int64 { func (b *Build) GetRevision() string { vcs := b.Raw.ChangeSet.Kind - if vcs == "git" || vcs == "hg" { + if vcs == Git || vcs == Hg { for _, a := range b.Raw.Actions { if a.LastBuiltRevision.SHA1 != "" { return a.LastBuiltRevision.SHA1 @@ -401,7 +407,7 @@ func (b *Build) GetRevision() string { return a.MercurialRevisionNumber } } - } else if vcs == "svn" { + } else if vcs == Svn { return strconv.Itoa(b.Raw.ChangeSet.Revisions[0].Revision) } return "" @@ -409,7 +415,7 @@ func (b *Build) GetRevision() string { func (b *Build) GetRevisionBranch() string { vcs := b.Raw.ChangeSet.Kind - if vcs == "git" { + if vcs == Git { for _, a := range b.Raw.Actions { if len(a.LastBuiltRevision.Branch) > 0 && a.LastBuiltRevision.Branch[0].SHA1 != "" { return a.LastBuiltRevision.Branch[0].SHA1 diff --git a/pkg/models/devops/devops.go b/pkg/models/devops/devops.go index 41a55777d..8274d76e7 100644 --- a/pkg/models/devops/devops.go +++ b/pkg/models/devops/devops.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package devops import ( diff --git a/pkg/models/devops/jkerror.go b/pkg/models/devops/jkerror.go index 7a5294ca6..fc00e653f 100644 --- a/pkg/models/devops/jkerror.go +++ b/pkg/models/devops/jkerror.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package devops type JkError struct { diff --git a/pkg/models/devops/urlconfig.go b/pkg/models/devops/urlconfig.go index 4fc9afe6c..bbf4a657b 100644 --- a/pkg/models/devops/urlconfig.go +++ b/pkg/models/devops/urlconfig.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. - */ +*/ package devops // Some apis for Jenkins.