Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jprobinson committed Sep 9, 2016
0 parents commit 1c9e45d
Show file tree
Hide file tree
Showing 117 changed files with 23,775 additions and 0 deletions.
1 change: 1 addition & 0 deletions .drone.sec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.neAEmr1g5PwTl5FzaAc2ml-Piua8OgcTnf768zMTNsgQTscs2GmNCscQRi4HvHWGX0p5RXMUmn9PXyIisd2rYT_CFAgrLBLxN-Jm8-PvyT1DJsfhJnTO3-BVIK9R49v_uWh0gMFRpXLi-ojaCyvAsM6npjx84HW88LhNKH16gFHNEMOV4T5osTKDqQFJWdw4QGSwy26Ktu5tx26YR6MImYdh3FsgtDBKg-FvDVB5w3b9oibM8Jo9FVMYFBJsWJa1w-wt5HtGLZ62ugChW399E2NcCUMno4ldMdpXhWOBL5POh4NYrJlnqfIk3Xs19o1LDOm_fjjzKxeEePupmoSXlQ.CW8X9tt9hr178FtR.9Fv9MTjG8feIxViRAF8SY41cXCUdC5BbhQRMRjE2iPBxBIw5d_sjOaWlJJ_APQ5cdaKjXUFpRTz6lEPR57FiVesgLRLXD3ND4_eXhcmw4dFT79wKqQUlNw235JxbVUMfBaDYaK5DAWdVeNkCHgYITjkZ9eqLZpvJhHUqalqBRehrdbCDvmO8LdQSCPPtJ_AD4uDwefcBdtTXb3IwWWpW7IU6v4TVT036P-bNzNVGGotzXpcbxQJJUjw.gywITpIJJxOj-photPrKhQ
4 changes: 4 additions & 0 deletions .drone.sec.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
environment:
DOCKER_USER: #
DOCKER_EMAIL: #
DOCKER_PASS: #
33 changes: 33 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
build:
image: golang:1.7
environment:
- CGO_ENABLED=0
- GOPATH=/drone
commands:
- env
- go vet
- go test
- go build -ldflags "-s -w -X main.build=$DRONE_BUILD_NUMBER -X main.rev=$DRONE_COMMIT" -a -tags netgo

publish:
docker:
repo: jprobinson/drone-gae
tag: latest
when:
branch: master

# Hack: Use the vfs driver to get Docker-in-Docker working on CentOS
# Todo: Migrate the Drone servers to an operating system which works
# See: https://github.com/drone/drone/issues/1296
storage_driver: vfs

# Todo: The docs indicate that these should be implicit. What's up?
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL

plugin:
name: Google App Engine
desc: Manage deployments on Google App Engine
type: publish
image: jprobinson/drone-gae
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.drone.sec.yml
/drone-gae

23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:3.4

ENV GOOGLE_CLOUD_SDK_VERSION=122.0.0
ENV GOOGLE_APP_ENGINE_SDK_VERSION=1.9.40

RUN apk add --no-cache curl python

# Install the gcloud SDK
RUN curl -fsSLo google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$GOOGLE_CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN tar -xzf google-cloud-sdk.tar.gz
RUN rm google-cloud-sdk.tar.gz
RUN ./google-cloud-sdk/install.sh --quiet

# Install the app engine SDK
RUN curl -fsSLo go_appengine_sdk_linux_amd64-$GOOGLE_APP_ENGINE_SDK_VERSION.zip https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-$GOOGLE_APP_ENGINE_SDK_VERSION.zip
RUN unzip go_appengine_sdk_linux_amd64-$GOOGLE_APP_ENGINE_SDK_VERSION.zip
RUN rm go_appengine_sdk_linux_amd64-$GOOGLE_APP_ENGINE_SDK_VERSION.zip

# Clean up
RUN rm -rf ./google-cloud-sdk/.install

ADD drone-gke /bin/
ENTRYPOINT ["/bin/drone-gae"]
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# drone-gae

Manage deployments on Google App Engine via drone.

This is currently very new and unstable.
Please don't use it for anything important!


## Example

build:
image: golang:1.7
commands:
- goapp get -t
- goapp test -v -cover
when:
event:
- push
- pull_request

deploy:
gae:
action: update
project: my-gae-project
version: "$$COMMIT"
token: >
$$GOOGLE_CREDENTIALS

when:
event: push
branch: master

gae:
action: set_default_version
project: my-gae-project
version: "$$COMMIT"
token: >
$$GOOGLE_CREDENTIALS

when:
event: push
branch: master


## License

MIT.
Binary file added bin/.drone-secure.swp
Binary file not shown.
5 changes: 5 additions & 0 deletions bin/drone-secure
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail
cd $(cd `dirname "$0"`; cd ..; pwd)

drone secure --in ".drone.sec.yml" --out ".drone.sec" --yaml ".drone.yml" --repo jprobinson/drone-gae
11 changes: 11 additions & 0 deletions bin/update-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
cd $(cd `dirname "$0"`; cd ..; pwd)

# https://glide.sh
# brew install glide
glide up

# https://github.com/sgotti/glide-vc
# go get github.com/sgotti/glide-vc
glide-vc --only-code --no-tests --no-legal-files
40 changes: 40 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

import (
"fmt"
"io"
"os/exec"
"strings"
)

type Environ struct {
dir string
env []string
stdout io.Writer
stderr io.Writer
}

func NewEnviron(dir string, env []string, stdout, stderr io.Writer) *Environ {
return &Environ{
dir: dir,
env: env,
stdout: stdout,
stderr: stderr,
}
}

// Run executes the given program.
func (e *Environ) Run(name string, arg ...string) error {
cmd := exec.Command(name, arg...)
cmd.Dir = e.dir
cmd.Env = e.env
cmd.Stdout = e.stdout
cmd.Stderr = e.stderr

// TODO: Extract this
fmt.Println()
fmt.Println("$", strings.Join(cmd.Args, " "))
//--

return cmd.Run()
}
26 changes: 26 additions & 0 deletions exec_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"bytes"
"testing"

"github.com/stretchr/testify/assert"
)

func TestEnvironRun(t *testing.T) {
stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}

e := &Environ{
dir: "/tmp",
env: []string{"A=1"},
stdout: stdout,
stderr: stderr,
}

err := e.Run("/bin/echo", "hello, ae")
if assert.NoError(t, err) {
assert.Equal(t, "hello, ae\n", stdout.String())
assert.Equal(t, "", stderr.String())
}
}
20 changes: 20 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package: github.com/jprobinson/drone-gae
import:
- package: github.com/drone/drone-plugin-go
subpackages:
- plugin
Loading

0 comments on commit 1c9e45d

Please sign in to comment.