Skip to content

Commit

Permalink
Fix cmgrd artifact fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
John E. Rollinson committed Jan 12, 2021
1 parent e12bf55 commit 38b6425
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/cmgrd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type state struct {
mgr *cmgr.Manager
}

var artifact_dir string

func main() {
var iface string
var port int
Expand All @@ -36,6 +38,10 @@ func main() {
os.Exit(0)
}

artifact_dir, _ = os.LookupEnv(cmgr.ARTIFACT_DIR_ENV)
if artifact_dir == "" {
artifact_dir = "."
}
mgr := cmgr.NewManager(cmgr.INFO)
if mgr == nil {
log.Fatal("failed to initialize cmgr library")
Expand Down Expand Up @@ -285,7 +291,7 @@ func (s state) artifactsHandler(w http.ResponseWriter, r *http.Request) {
return
}

f, err := os.Open(fmt.Sprintf("%d.tar.gz", build))
f, err := os.Open(fmt.Sprintf("%s/%d.tar.gz", artifact_dir, build))

if err != nil {
w.WriteHeader(http.StatusInternalServerError)
Expand Down

0 comments on commit 38b6425

Please sign in to comment.