implement compose secret syntax

This commit is contained in:
Brad Rydzewski
2017-04-10 12:39:50 +02:00
parent 4502e5a256
commit b10a074b57
13 changed files with 132 additions and 76 deletions

View File

@@ -1,10 +0,0 @@
package model
type Agent struct {
ID int64 `json:"id" meddler:"agent_id,pk"`
Address string `json:"address" meddler:"agent_addr"`
Platform string `json:"platform" meddler:"agent_platform"`
Capacity int `json:"capacity" meddler:"agent_capacity"`
Created int64 `json:"created_at" meddler:"agent_created"`
Updated int64 `json:"updated_at" meddler:"agent_updated"`
}

17
model/approval.go Normal file
View File

@@ -0,0 +1,17 @@
package model
type (
// ApprovalStore persists approved committers to storage.
ApprovalStore interface {
Approve(*Repo) error
}
// Approval represents an approved committer.
Approval struct {
Username string `json:"username" meddler:"approval_username"`
Approved bool `json:"approved" meddler:"approval_approved"`
Comments string `json:"comments" meddler:"approval_comments"`
CreatedBy string `json:"created_by" meddler:"approval_created_by"`
CreatedAt int64 `json:"created_at" meddler:"approval_created_at"`
}
)

23
model/gate.go Normal file
View File

@@ -0,0 +1,23 @@
package model
// Gated indicates a build is gated and requires approval to proceed. It also
// includes the reason the build was gated.
type Gated struct {
Gated bool `json:"gated"`
Reason string `json:"reason"`
}
// GateService defines a service for gating builds.
type GateService interface {
Gated(*User, *Repo, *Build) (*Gated, error)
}
type gateService struct{}
func (s *gateService) Gated(owner *User, repo *Repo, build *Build) (*Gated, error) {
g := new(Gated)
if repo.IsPrivate && build.Event == EventPull && build.Sender != owner.Login {
g.Gated = true
}
return g, nil
}

View File

@@ -1,17 +0,0 @@
package model
// // swagger:model job
// type Job struct {
// ID int64 `json:"id" meddler:"job_id,pk"`
// BuildID int64 `json:"-" meddler:"job_build_id"`
// NodeID int64 `json:"-" meddler:"job_node_id"`
// Number int `json:"number" meddler:"job_number"`
// Error string `json:"error" meddler:"job_error"`
// Status string `json:"status" meddler:"job_status"`
// ExitCode int `json:"exit_code" meddler:"job_exit_code"`
// Enqueued int64 `json:"enqueued_at" meddler:"job_enqueued"`
// Started int64 `json:"started_at" meddler:"job_started"`
// Finished int64 `json:"finished_at" meddler:"job_finished"`
//
// Environment map[string]string `json:"environment" meddler:"job_environment,json"`
// }