diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..806f0a1 --- /dev/null +++ b/Readme.md @@ -0,0 +1,16 @@ +# Simple Git Deploy + +# Troubleshooting + +### Not Cloning - the script runs pretty fast but wont clone + +Check the permissions of your keyfile. They should be 600, otherwise the ssh-agent will ignore the keyfile and won't clone. + +``` +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ WARNING: UNPROTECTED PRIVATE KEY FILE! @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +Permissions 0664 for '/home/konrad/Schreibtisch/life-wob/life-deploy' are too open. +It is required that your private key files are NOT accessible by others. +This private key will be ignored. +``` \ No newline at end of file diff --git a/bin/goimports b/bin/goimports new file mode 100755 index 0000000..c5969af Binary files /dev/null and b/bin/goimports differ diff --git a/pkg/linux_amd64/github.com/go-ini/ini.a b/pkg/linux_amd64/github.com/go-ini/ini.a new file mode 100644 index 0000000..7c3ff54 Binary files /dev/null and b/pkg/linux_amd64/github.com/go-ini/ini.a differ diff --git a/pkg/linux_amd64/golang.org/x/tools/go/ast/astutil.a b/pkg/linux_amd64/golang.org/x/tools/go/ast/astutil.a new file mode 100644 index 0000000..3d6bcf1 Binary files /dev/null and b/pkg/linux_amd64/golang.org/x/tools/go/ast/astutil.a differ diff --git a/pkg/linux_amd64/golang.org/x/tools/imports.a b/pkg/linux_amd64/golang.org/x/tools/imports.a new file mode 100644 index 0000000..85fd01f Binary files /dev/null and b/pkg/linux_amd64/golang.org/x/tools/imports.a differ diff --git a/src/Simple-Git-Deploy/config.ini b/src/Simple-Git-Deploy/config.ini new file mode 100644 index 0000000..7bfd125 --- /dev/null +++ b/src/Simple-Git-Deploy/config.ini @@ -0,0 +1,5 @@ +ssh_key=/home/konrad/Schreibtisch/life-wob/life-deploy +git_url=ssh://git@git.mowie.cc:9022/Websites/Life-Homepage.git +deploy_dir=/home/konrad/Schreibtisch/life-wob/html +container_name= +secret= \ No newline at end of file diff --git a/src/Simple-Git-Deploy/main.go b/src/Simple-Git-Deploy/main.go index 950716b..39bbe36 100644 --- a/src/Simple-Git-Deploy/main.go +++ b/src/Simple-Git-Deploy/main.go @@ -3,13 +3,36 @@ package main import ( "fmt" "os/exec" + + "github.com/go-ini/ini" "log" ) -func main() { - cmd, err := exec.Command( "/bin/bash", "cmd.sh").Output() - if err != nil { - log.Fatal(err) - } - fmt.Printf("%s\n", cmd) +type Config struct { + SSH_Key string + Git_url string + Deploy_dir string + Container_name string + Secret string +} + +func main() { + //Init Config + cfg, _ := ini.Load("config.ini") + var Conf Config + Conf.SSH_Key = cfg.Section("").Key("ssh_key").String() + Conf.Deploy_dir = cfg.Section("").Key("deploy_dir").String() + Conf.Git_url = cfg.Section("").Key("git_url").String() + Conf.Container_name = cfg.Section("").Key("container_name").String() + Conf.Secret = cfg.Section("").Key("secret").String() + + if Conf.Git_url != "" && Conf.Deploy_dir != "" && Conf.SSH_Key != "" { + cmd, err := exec.Command("/bin/bash", "deploy.sh", "-k", Conf.SSH_Key, "-g", Conf.Git_url, "-d", Conf.Deploy_dir, "-c", Conf.Container_name).Output() + if err != nil { + log.Fatal(err) + } + fmt.Printf("%s\n", cmd) + } else { + fmt.Println("You must provide at least a Git-Url, Deploy-Dir and SSH-Key!") + } } diff --git a/src/github.com/go-ini/ini b/src/github.com/go-ini/ini new file mode 160000 index 0000000..e7fea39 --- /dev/null +++ b/src/github.com/go-ini/ini @@ -0,0 +1 @@ +Subproject commit e7fea39b01aea8d5671f6858f0532f56e8bff3a5 diff --git a/src/golang.org/x/tools b/src/golang.org/x/tools new file mode 160000 index 0000000..2382e39 --- /dev/null +++ b/src/golang.org/x/tools @@ -0,0 +1 @@ +Subproject commit 2382e3994d48b1d22acc2c86bcad0a2aff028e32