-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema migration tool which supports both pure SQL migration files and go migrations (for more complex operations which require back-filling and manipulating previous entries). Based on github.com/pressly/goose. Every migration is executed within a transaction. SQL migrations offer the possibility to turn off transactions, while golang migrations by default receive a *sql.Tx object. At the moment, this cannot be changed.
- Loading branch information
1 parent
5efe844
commit c6ac0fb
Showing
21 changed files
with
967 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
coverage: | ||
status: | ||
patch: | ||
default: | ||
target: 30% | ||
project: | ||
default: | ||
target: auto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
package plugins | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/facebookincubator/contest/pkg/pluginregistry" | ||
|
||
"github.com/facebookincubator/contest/pkg/job" | ||
"github.com/facebookincubator/contest/pkg/target" | ||
"github.com/facebookincubator/contest/pkg/test" | ||
|
||
"github.com/facebookincubator/contest/plugins/reporters/noop" | ||
"github.com/facebookincubator/contest/plugins/reporters/targetsuccess" | ||
"github.com/facebookincubator/contest/plugins/targetmanagers/csvtargetmanager" | ||
"github.com/facebookincubator/contest/plugins/targetmanagers/targetlist" | ||
"github.com/facebookincubator/contest/plugins/testfetchers/literal" | ||
"github.com/facebookincubator/contest/plugins/testfetchers/uri" | ||
"github.com/facebookincubator/contest/plugins/teststeps/cmd" | ||
"github.com/facebookincubator/contest/plugins/teststeps/echo" | ||
"github.com/facebookincubator/contest/plugins/teststeps/example" | ||
"github.com/facebookincubator/contest/plugins/teststeps/randecho" | ||
"github.com/facebookincubator/contest/plugins/teststeps/slowecho" | ||
"github.com/facebookincubator/contest/plugins/teststeps/sshcmd" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
var targetManagers = []target.TargetManagerLoader{ | ||
csvtargetmanager.Load, | ||
targetlist.Load, | ||
} | ||
|
||
var testFetchers = []test.TestFetcherLoader{ | ||
uri.Load, | ||
literal.Load, | ||
} | ||
|
||
var testSteps = []test.TestStepLoader{ | ||
echo.Load, | ||
slowecho.Load, | ||
example.Load, | ||
cmd.Load, | ||
sshcmd.Load, | ||
randecho.Load, | ||
} | ||
|
||
var reporters = []job.ReporterLoader{ | ||
targetsuccess.Load, | ||
noop.Load, | ||
} | ||
|
||
// user-defined functions that will be made available to plugins for advanced | ||
// expressions in config parameters. | ||
var userFunctions = map[string]interface{}{ | ||
// sample function to prove that function registration works. | ||
"do_nothing": func(a ...string) (string, error) { | ||
if len(a) == 0 { | ||
return "", errors.New("do_nothing: no arg specified") | ||
} | ||
return a[0], nil | ||
}, | ||
} | ||
|
||
// Init initializes the plugin registry | ||
func Init(pluginRegistry *pluginregistry.PluginRegistry, log *logrus.Entry) { | ||
|
||
// Register TargetManager plugins | ||
for _, tmloader := range targetManagers { | ||
if err := pluginRegistry.RegisterTargetManager(tmloader()); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
// Register TestFetcher plugins | ||
for _, tfloader := range testFetchers { | ||
if err := pluginRegistry.RegisterTestFetcher(tfloader()); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
// Register TestStep plugins | ||
for _, tsloader := range testSteps { | ||
if err := pluginRegistry.RegisterTestStep(tsloader()); err != nil { | ||
log.Fatal(err) | ||
|
||
} | ||
} | ||
|
||
// Register Reporter plugins | ||
for _, rfloader := range reporters { | ||
if err := pluginRegistry.RegisterReporter(rfloader()); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
// user-defined function registration | ||
for name, fn := range userFunctions { | ||
if err := test.RegisterFunction(name, fn); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- +goose Up | ||
ALTER TABLE jobs ADD COLUMN extended_descriptor text; | ||
|
||
-- +goose Down | ||
ALTER TABLE jobs DROP COLUMN extended_descriptor; |
Oops, something went wrong.