Merge pull request #491 from fission/ciImprovements

CI modifications
This commit is contained in:
smruthi2187
2018-02-09 19:00:19 -08:00
committed by GitHub
26 changed files with 442 additions and 169 deletions
+23 -1
View File
@@ -10,15 +10,32 @@ import (
"net/http"
"net/url"
"os"
"os/signal"
"runtime/debug"
"strconv"
"syscall"
"time"
"github.com/fission/fission"
"github.com/fission/fission/environments/fetcher"
)
func dumpStackTrace() {
debug.PrintStack()
}
// Usage: fetcher <shared volume path>
func main() {
// register signal handler for dumping stack trace.
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
go func() {
<-c
log.Println("Received SIGTERM : Dumping stack trace")
dumpStackTrace()
os.Exit(1)
}()
flag.Usage = fetcherUsage
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup")
fetchPayload := flag.String("fetch-request", "", "JSON Payload for fetch request")
@@ -42,7 +59,10 @@ func main() {
}
}
fetcher := fetcher.MakeFetcher(dir, *secretDir, *configDir)
fetcher, err := fetcher.MakeFetcher(dir, *secretDir, *configDir)
if err != nil {
log.Fatalf("Error making fetcher: %v", err)
}
if *specializeOnStart {
specializePod(fetcher, fetchPayload, loadPayload)
@@ -54,6 +74,8 @@ func main() {
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
log.Println("Fetcher ready to receive requests")
http.ListenAndServe(":8000", mux)
}
+3 -3
View File
@@ -74,14 +74,14 @@ func makeVolumeDir(dirPath string) {
}
}
func MakeFetcher(sharedVolumePath string, sharedSecretPath string, sharedConfigPath string) *Fetcher {
func MakeFetcher(sharedVolumePath string, sharedSecretPath string, sharedConfigPath string) (*Fetcher, error) {
makeVolumeDir(sharedVolumePath)
makeVolumeDir(sharedSecretPath)
makeVolumeDir(sharedConfigPath)
fissionClient, kubeClient, _, err := crd.MakeFissionClient()
if err != nil {
return nil
return nil, err
}
return &Fetcher{
sharedVolumePath: sharedVolumePath,
@@ -89,7 +89,7 @@ func MakeFetcher(sharedVolumePath string, sharedSecretPath string, sharedConfigP
sharedConfigPath: sharedConfigPath,
fissionClient: fissionClient,
kubeClient: kubeClient,
}
}, nil
}
func downloadUrl(url string, localPath string) error {