Skip to content

Commit

Permalink
chore: log known releases
Browse files Browse the repository at this point in the history
  • Loading branch information
acid-chicken committed May 22, 2024
1 parent f330bd2 commit 8266b7d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions hariko/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -124,7 +125,7 @@ func newCmd() *cobra.Command {
{
Title: "Deployment failed",
Color: ColorFailure,
Description: err.Error() + "\n```" + b.String() + "```",
Description: err.Error() + "\n```\n" + b.String() + "```",
},
},
}, st)
Expand All @@ -135,7 +136,7 @@ func newCmd() *cobra.Command {
{
Title: "Deployment succeeded",
Color: ColorSuccess,
Description: "```" + b.String() + "```",
Description: "```\n" + b.String() + "```",
Fields: []*discordgo.MessageEmbedField{
{
Name: "Name",
Expand Down Expand Up @@ -226,6 +227,21 @@ func deploy(packageName string, repositoryName string, repositoryURL string, log
})
if _, ok := actionConfig.Releases.Driver.(*driver.Memory); ok {
return nil, fmt.Errorf("storage driver could not be initialized")
} else {
releases, err := actionConfig.Releases.Driver.List(func(_ *release.Release) bool { return true })
if err != nil {
return nil, err
}
for _, release := range releases {
data, err := json.Marshal(release)
if err != nil {
log.Write([]byte(fmt.Sprintf("failed to marshal release: %s\n", err.Error())))
} else {
log.Write([]byte("detected release: "))
log.Write(data)
log.Write([]byte("\n"))
}
}
}
client := action.NewUpgrade(actionConfig)
client.Namespace = settings.Namespace()
Expand Down

0 comments on commit 8266b7d

Please sign in to comment.