Skip to content

Commit

Permalink
ability to customize yaml path
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Mar 19, 2017
1 parent b100401 commit 6246b32
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
2 changes: 0 additions & 2 deletions model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package model
// Config defines system configuration parameters.
type Config struct {
Open bool // Enables open registration
Yaml string // Customize the Yaml configuration file name
Shasum string // Customize the Yaml checksum file name
Secret string // Secret token used to authenticate agents
Admins map[string]bool // Administrative users
Orgs map[string]bool // Organization whitelist
Expand Down
6 changes: 2 additions & 4 deletions server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ func PostApproval(c *gin.Context) {
//

// fetch the build file from the database
cfg := ToConfig(c)
raw, err := remote_.File(user, repo, build, cfg.Yaml)
raw, err := remote_.File(user, repo, build, repo.Config)
if err != nil {
logrus.Errorf("failure to get build config for %s. %s", repo.FullName, err)
c.AbortWithError(404, err)
Expand Down Expand Up @@ -398,8 +397,7 @@ func PostBuild(c *gin.Context) {
}

// fetch the .drone.yml file from the database
cfg := ToConfig(c)
raw, err := remote_.File(user, repo, build, cfg.Yaml)
raw, err := remote_.File(user, repo, build, repo.Config)
if err != nil {
logrus.Errorf("failure to get build config for %s. %s", repo.FullName, err)
c.AbortWithError(404, err)
Expand Down
5 changes: 2 additions & 3 deletions server/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ func PostHook(c *gin.Context) {
}

// fetch the build file from the database
cfg := ToConfig(c)
raw, err := remote_.File(user, repo, build, cfg.Yaml)
raw, err := remote_.File(user, repo, build, repo.Config)
if err != nil {
logrus.Errorf("failure to get build config for %s. %s", repo.FullName, err)
c.AbortWithError(404, err)
Expand Down Expand Up @@ -177,7 +176,7 @@ func PostHook(c *gin.Context) {
}

if build.Event == model.EventPull && mustApprove {
old, ferr := remote_.FileRef(user, repo, build.Branch, cfg.Yaml)
old, ferr := remote_.FileRef(user, repo, build.Branch, repo.Config)
if ferr != nil {
build.Status = model.StatusBlocked
logrus.Debugf("cannot fetch base yaml: status: blocked")
Expand Down
1 change: 1 addition & 0 deletions server/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func PostRepo(c *gin.Context) {
r.UserID = user.ID
r.AllowPush = true
r.AllowPull = true
r.Config = ".drone.yml"
r.Timeout = 60 // 1 hour default build time
r.Hash = base32.StdEncoding.EncodeToString(
securecookie.GenerateRandomKey(32),
Expand Down
2 changes: 1 addition & 1 deletion store/datastore/ddl/mysql/12.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ALTER TABLE builds ADD COLUMN build_sender VARCHAR(255);
ALTER TABLE builds ADD COLUMN build_reviewer VARCHAR(255);
ALTER TABLE builds ADD COLUMN build_reviewed INTEGER;

UPDATE repos SET repo_config_path = '';
UPDATE repos SET repo_config_path = '.drone.yml';
UPDATE builds SET build_reviewer = '';
UPDATE builds SET build_reviewed = 0;
UPDATE builds SET build_sender = '';
Expand Down
2 changes: 1 addition & 1 deletion store/datastore/ddl/postgres/12.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ALTER TABLE builds ADD COLUMN build_reviewer VARCHAR(255);
ALTER TABLE builds ADD COLUMN build_reviewed INTEGER;
ALTER TABLE builds ADD COLUMN build_sender VARCHAR(255);

UPDATE repos SET repo_config_path = '';
UPDATE repos SET repo_config_path = '.drone.yml';
UPDATE builds SET build_reviewer = '';
UPDATE builds SET build_reviewed = 0;
UPDATE builds SET build_sender = '';
Expand Down
2 changes: 1 addition & 1 deletion store/datastore/ddl/sqlite3/12.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ALTER TABLE builds ADD COLUMN build_reviewer TEXT;
ALTER TABLE builds ADD COLUMN build_reviewed INTEGER;
ALTER TABLE builds ADD COLUMN build_sender TEXT;

UPDATE repos SET repo_config_path = '';
UPDATE repos SET repo_config_path = '.drone.yml';
UPDATE builds SET build_reviewer = '';
UPDATE builds SET build_reviewed = 0;
UPDATE builds SET build_sender = '';
Expand Down

0 comments on commit 6246b32

Please sign in to comment.