mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-06 08:16:19 +02:00
Merge pull request #1116 from PermissionData/mesos-marathon
Mesos marathon
This commit is contained in:
commit
d350ff8826
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/drone/drone/plugin/deploy/deis"
|
"github.com/drone/drone/plugin/deploy/deis"
|
||||||
"github.com/drone/drone/plugin/deploy/git"
|
"github.com/drone/drone/plugin/deploy/git"
|
||||||
"github.com/drone/drone/plugin/deploy/heroku"
|
"github.com/drone/drone/plugin/deploy/heroku"
|
||||||
|
"github.com/drone/drone/plugin/deploy/marathon"
|
||||||
"github.com/drone/drone/plugin/deploy/modulus"
|
"github.com/drone/drone/plugin/deploy/modulus"
|
||||||
"github.com/drone/drone/plugin/deploy/nodejitsu"
|
"github.com/drone/drone/plugin/deploy/nodejitsu"
|
||||||
"github.com/drone/drone/plugin/deploy/tsuru"
|
"github.com/drone/drone/plugin/deploy/tsuru"
|
||||||
@ -26,6 +27,7 @@ type Deploy struct {
|
|||||||
SSH *SSH `yaml:"ssh,omitempty"`
|
SSH *SSH `yaml:"ssh,omitempty"`
|
||||||
Tsuru *tsuru.Tsuru `yaml:"tsuru,omitempty"`
|
Tsuru *tsuru.Tsuru `yaml:"tsuru,omitempty"`
|
||||||
Bash *Bash `yaml:"bash,omitempty"`
|
Bash *Bash `yaml:"bash,omitempty"`
|
||||||
|
Marathon *marathon.Marathon `yaml:"marathon,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Deploy) Write(f *buildfile.Buildfile, r *repo.Repo) {
|
func (d *Deploy) Write(f *buildfile.Buildfile, r *repo.Repo) {
|
||||||
@ -57,6 +59,9 @@ func (d *Deploy) Write(f *buildfile.Buildfile, r *repo.Repo) {
|
|||||||
if d.Bash != nil && match(d.Bash.GetCondition(), r) {
|
if d.Bash != nil && match(d.Bash.GetCondition(), r) {
|
||||||
d.Bash.Write(f)
|
d.Bash.Write(f)
|
||||||
}
|
}
|
||||||
|
if d.Marathon != nil && match(d.Marathon.GetCondition(), r) {
|
||||||
|
d.Marathon.Write(f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func match(c *condition.Condition, r *repo.Repo) bool {
|
func match(c *condition.Condition, r *repo.Repo) bool {
|
||||||
|
39
plugin/deploy/marathon/marathon.go
Normal file
39
plugin/deploy/marathon/marathon.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package marathon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/drone/drone/plugin/condition"
|
||||||
|
"github.com/drone/drone/shared/build/buildfile"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Marathon struct {
|
||||||
|
//Hostname for the Marathon Master
|
||||||
|
Host string `yaml:"host,omitempty"`
|
||||||
|
|
||||||
|
// The app config for marathon
|
||||||
|
//https://mesosphere.github.io/marathon/docs/rest-api.html#post-v2-apps
|
||||||
|
// Examples:
|
||||||
|
// /path/to/file
|
||||||
|
// /path/to/*.txt
|
||||||
|
// /path/to/*/*.txt
|
||||||
|
// /path/to/**
|
||||||
|
ConfigFile string `yaml:"config_file,omitempty"`
|
||||||
|
Condition *condition.Condition `yaml:"when,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Marathon) Write(f *buildfile.Buildfile) {
|
||||||
|
// debugging purposes so we can see if / where something is failing
|
||||||
|
f.WriteCmdSilent("echo 'deploying to Marathon ...'")
|
||||||
|
|
||||||
|
post := fmt.Sprintf(
|
||||||
|
"curl -X POST -d @%s http://%s/v2/apps --header \"Content-Type:application/json\"",
|
||||||
|
m.ConfigFile,
|
||||||
|
m.Host,
|
||||||
|
)
|
||||||
|
f.WriteCmdSilent(post)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Marathon) GetCondition() *condition.Condition {
|
||||||
|
return m.Condition
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user