From c9b8e011f5208791e653f6fe1b04d5c02fe00c03 Mon Sep 17 00:00:00 2001 From: bdd Date: Mon, 8 Jun 2015 09:18:22 -0400 Subject: [PATCH 1/7] Lint pool.go Second value can be omitted from range. Loop is equivalent. --- server/worker/pool/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/worker/pool/pool.go b/server/worker/pool/pool.go index e2f3d91f6..070557468 100644 --- a/server/worker/pool/pool.go +++ b/server/worker/pool/pool.go @@ -64,7 +64,7 @@ func (p *Pool) List() []worker.Worker { defer p.Unlock() var workers []worker.Worker - for w, _ := range p.workers { + for w := range p.workers { workers = append(workers, w) } return workers From eb1af7162cdfb939ef3b45a494a29498bf6e2ed3 Mon Sep 17 00:00:00 2001 From: David Windell Date: Tue, 23 Jun 2015 21:59:45 +0100 Subject: [PATCH 2/7] Remove docker target from Dockerfile Fixes failing builds --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ec503c61..95d563c95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /gopath/src/github.com/drone/drone RUN apt-get update RUN apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null -RUN make docker deps build embed install +RUN make deps build embed install EXPOSE 80 VOLUME ["/var/lib/drone"] From e39b89957d64bc82184182c965bba0ca74ac8dda Mon Sep 17 00:00:00 2001 From: Kohei Suzuki Date: Sat, 20 Jun 2015 21:34:46 +0900 Subject: [PATCH 3/7] Correct VolumesFrom definition Fixes #1068 . --- shared/build/docker/structs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/build/docker/structs.go b/shared/build/docker/structs.go index d30282f9c..0d3388999 100644 --- a/shared/build/docker/structs.go +++ b/shared/build/docker/structs.go @@ -133,7 +133,7 @@ type Config struct { Dns []string Image string // Name of the image as it was passed by the operator (eg. could be symbolic) Volumes map[string]struct{} - VolumesFrom string + VolumesFrom []string WorkingDir string Entrypoint []string NetworkDisabled bool From c13685c9a3cd4f594a32ceae3b6dffaf419c6059 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 2 Jul 2015 14:50:17 -0700 Subject: [PATCH 4/7] Enable pseudo tty setting --- shared/build/script/docker.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shared/build/script/docker.go b/shared/build/script/docker.go index 185c293e0..c06e9e4d2 100644 --- a/shared/build/script/docker.go +++ b/shared/build/script/docker.go @@ -14,6 +14,9 @@ type Docker struct { // Hostname (also known as `--hostname` option) // Could be set only if Docker is running in privileged mode Hostname *string `yaml:"hostname,omitempty"` + + // Allocate a pseudo-TTY (also known as `--tty` option) + TTY bool `yaml:"tty,omitempty"` } // DockerNetworkMode returns DefaultNetworkMode @@ -37,3 +40,12 @@ func DockerHostname(d *Docker) string { } return *d.Hostname } + +// DockerTty returns true if the build +// should allocate a pseudo tty +func DockerTty(d *Docker) string { + if d == nil { + return false + } + return d.TTY +} From 80e8b01f243dbc9913c417eb6dcbd4eaee9dceea Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 2 Jul 2015 15:10:34 -0700 Subject: [PATCH 5/7] added tty flag --- shared/build/build.go | 1 + shared/build/script/docker.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/build/build.go b/shared/build/build.go index cb2f60fa6..0a0265ab4 100644 --- a/shared/build/build.go +++ b/shared/build/build.go @@ -322,6 +322,7 @@ func (b *Builder) run() error { AttachStdin: false, AttachStdout: true, AttachStderr: true, + Tty: script.DockerTty(b.Build.Docker), } // configure if Docker should run in privileged mode diff --git a/shared/build/script/docker.go b/shared/build/script/docker.go index c06e9e4d2..a61967922 100644 --- a/shared/build/script/docker.go +++ b/shared/build/script/docker.go @@ -43,7 +43,7 @@ func DockerHostname(d *Docker) string { // DockerTty returns true if the build // should allocate a pseudo tty -func DockerTty(d *Docker) string { +func DockerTty(d *Docker) bool { if d == nil { return false } From 4bcf83bcd0e6dcd84ad5ab661f11527ffef74cc8 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 5 Jul 2015 22:06:54 -0300 Subject: [PATCH 6/7] small typo fix --- server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.go b/server/main.go index bd5e0bca6..d45b2d39b 100644 --- a/server/main.go +++ b/server/main.go @@ -34,7 +34,7 @@ import ( ) const ( - DockerTLSWarning = `WARINING: Docker TLS cert or key not given, this may cause a build errors` + DockerTLSWarning = `WARNING: Docker TLS cert or key not given, this may cause a build errors` ) var ( From b5ce379941e21cd8983e2f9547d5ca52c3bb8f3a Mon Sep 17 00:00:00 2001 From: Dwayne Jones Date: Thu, 30 Jul 2015 16:58:33 -0400 Subject: [PATCH 7/7] Start of plugin --- plugin/deploy/deployment.go | 5 ++++ plugin/deploy/marathon/marathon.go | 39 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 plugin/deploy/marathon/marathon.go diff --git a/plugin/deploy/deployment.go b/plugin/deploy/deployment.go index 198c71a27..20c19c09f 100644 --- a/plugin/deploy/deployment.go +++ b/plugin/deploy/deployment.go @@ -8,6 +8,7 @@ import ( "github.com/drone/drone/plugin/deploy/deis" "github.com/drone/drone/plugin/deploy/git" "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/nodejitsu" "github.com/drone/drone/plugin/deploy/tsuru" @@ -26,6 +27,7 @@ type Deploy struct { SSH *SSH `yaml:"ssh,omitempty"` Tsuru *tsuru.Tsuru `yaml:"tsuru,omitempty"` Bash *Bash `yaml:"bash,omitempty"` + Marathon *marathon.Marathon `yaml:"marathon,omitempty"` } 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) { 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 { diff --git a/plugin/deploy/marathon/marathon.go b/plugin/deploy/marathon/marathon.go new file mode 100644 index 000000000..b55000a68 --- /dev/null +++ b/plugin/deploy/marathon/marathon.go @@ -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 +}