Java env builder with Maven (#783)

Java environment builder with support for Maven builds. Default build comman runs `mvn clean package` and picks up target/*with-dependencies.jar for function.
This commit is contained in:
Vishal
2018-07-24 15:16:21 +05:30
committed by GitHub
parent ec495fbd1d
commit 27c3a50d23
7 changed files with 152 additions and 11 deletions
+19 -8
View File
@@ -42,8 +42,9 @@ type (
// UploadRequest send from builder manager describes which
// deployment package should be upload to storage service.
UploadRequest struct {
Filename string `json:"filename"`
StorageSvcUrl string `json:"storagesvcurl"`
Filename string `json:"filename"`
StorageSvcUrl string `json:"storagesvcurl"`
ArchivePackage bool `json:"archivepackage"`
}
// UploadResponse defines the download url of an archive and
@@ -421,12 +422,22 @@ func (fetcher *Fetcher) UploadHandler(w http.ResponseWriter, r *http.Request) {
srcFilepath := filepath.Join(fetcher.sharedVolumePath, req.Filename)
dstFilepath := filepath.Join(fetcher.sharedVolumePath, zipFilename)
err = fetcher.archive(srcFilepath, dstFilepath)
if err != nil {
e := fmt.Sprintf("Error archiving zip file: %v", err)
log.Println(e)
http.Error(w, e, http.StatusInternalServerError)
return
if req.ArchivePackage {
err = fetcher.archive(srcFilepath, dstFilepath)
if err != nil {
e := fmt.Sprintf("Error archiving zip file: %v", err)
log.Println(e)
http.Error(w, e, http.StatusInternalServerError)
return
}
} else {
err = os.Rename(srcFilepath, dstFilepath)
if err != nil {
e := fmt.Sprintf("Error renaming the archive: %v", err)
log.Println(e)
http.Error(w, e, http.StatusInternalServerError)
return
}
}
log.Println("Starting upload...")