Drop docker from binary name for gcr, ecr and heroku

This commit is contained in:
Thomas Boerger
2019-01-21 01:38:45 +01:00
parent 76ac11d221
commit 7345afea5d
10 changed files with 12 additions and 18 deletions

46
cmd/drone-heroku/main.go Normal file
View File

@@ -0,0 +1,46 @@
package main
import (
"os"
"os/exec"
"path"
)
func main() {
var (
registry = "registry.heroku.com"
process = getenv("PLUGIN_PROCESS_TYPE")
app = getenv("PLUGIN_APP")
email = getenv("PLUGIN_EMAIL", "HEROKU_EMAIL")
key = getenv("PLUGIN_API_KEY", "HEROKU_API_KEY")
)
if process == "" {
process = "web"
}
os.Setenv("PLUGIN_REGISTRY", registry)
os.Setenv("PLUGIN_REPO", path.Join(registry, app, process))
os.Setenv("DOCKER_PASSWORD", key)
os.Setenv("DOCKER_USERNAME", email)
os.Setenv("DOCKER_EMAIL", email)
cmd := exec.Command("drone-docker")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
os.Exit(1)
}
}
func getenv(key ...string) (s string) {
for _, k := range key {
s = os.Getenv(k)
if s != "" {
return
}
}
return
}