提交 955d20fe 编写于 作者: R runzexia 提交者: zryfish

update

Signed-off-by: Nrunzexia <runzexia@yunify.com>
上级 68809bcc
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package install package install
import ( import (
...@@ -30,4 +30,4 @@ func init() { ...@@ -30,4 +30,4 @@ func init() {
func Install(c *restful.Container) { func Install(c *restful.Container) {
urlruntime.Must(devopsv1alpha2.AddToContainer(c)) urlruntime.Must(devopsv1alpha2.AddToContainer(c))
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package v1alpha2 package v1alpha2
import ( import (
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package devops package devops
import ( import (
......
...@@ -262,6 +262,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) { ...@@ -262,6 +262,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) {
err := req.ReadEntity(&devops) err := req.ReadEntity(&devops)
if err != nil { if err != nil {
glog.Infof("%+v", err)
resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err)) resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err))
return return
} }
...@@ -270,6 +271,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) { ...@@ -270,6 +271,7 @@ func CreateDevopsProject(req *restful.Request, resp *restful.Response) {
project, err, code := tenant.CreateDevopsProject(username, workspaceName, &devops) project, err, code := tenant.CreateDevopsProject(username, workspaceName, &devops)
if err != nil { if err != nil {
glog.Errorf("%+v", err)
resp.WriteHeaderAndEntity(code, errors.Wrap(err)) resp.WriteHeaderAndEntity(code, errors.Wrap(err))
return return
} }
......
...@@ -24,6 +24,12 @@ import ( ...@@ -24,6 +24,12 @@ import (
"time" "time"
) )
const (
Git = "git"
Hg = "hg"
Svn = "svc"
)
type Build struct { type Build struct {
Raw *BuildResponse Raw *BuildResponse
Job *Job Job *Job
...@@ -392,7 +398,7 @@ func (b *Build) GetDuration() int64 { ...@@ -392,7 +398,7 @@ func (b *Build) GetDuration() int64 {
func (b *Build) GetRevision() string { func (b *Build) GetRevision() string {
vcs := b.Raw.ChangeSet.Kind vcs := b.Raw.ChangeSet.Kind
if vcs == "git" || vcs == "hg" { if vcs == Git || vcs == Hg {
for _, a := range b.Raw.Actions { for _, a := range b.Raw.Actions {
if a.LastBuiltRevision.SHA1 != "" { if a.LastBuiltRevision.SHA1 != "" {
return a.LastBuiltRevision.SHA1 return a.LastBuiltRevision.SHA1
...@@ -401,7 +407,7 @@ func (b *Build) GetRevision() string { ...@@ -401,7 +407,7 @@ func (b *Build) GetRevision() string {
return a.MercurialRevisionNumber return a.MercurialRevisionNumber
} }
} }
} else if vcs == "svn" { } else if vcs == Svn {
return strconv.Itoa(b.Raw.ChangeSet.Revisions[0].Revision) return strconv.Itoa(b.Raw.ChangeSet.Revisions[0].Revision)
} }
return "" return ""
...@@ -409,7 +415,7 @@ func (b *Build) GetRevision() string { ...@@ -409,7 +415,7 @@ func (b *Build) GetRevision() string {
func (b *Build) GetRevisionBranch() string { func (b *Build) GetRevisionBranch() string {
vcs := b.Raw.ChangeSet.Kind vcs := b.Raw.ChangeSet.Kind
if vcs == "git" { if vcs == Git {
for _, a := range b.Raw.Actions { for _, a := range b.Raw.Actions {
if len(a.LastBuiltRevision.Branch) > 0 && a.LastBuiltRevision.Branch[0].SHA1 != "" { if len(a.LastBuiltRevision.Branch) > 0 && a.LastBuiltRevision.Branch[0].SHA1 != "" {
return a.LastBuiltRevision.Branch[0].SHA1 return a.LastBuiltRevision.Branch[0].SHA1
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package devops package devops
import ( import (
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package devops package devops
type JkError struct { type JkError struct {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package devops package devops
// Some apis for Jenkins. // Some apis for Jenkins.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册