|
|
@@ -1013,8 +1013,27 @@ func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
|
|
|
conf.Chart = chart
|
|
|
}
|
|
|
|
|
|
+ rel, err := agent.UpgradeRelease(conf, form.Values, app.DOConf)
|
|
|
+
|
|
|
slackInts, _ := app.Repo.SlackIntegration.ListSlackIntegrationsByProjectID(uint(projID))
|
|
|
- notifier := slack.NewSlackNotifier(slackInts...)
|
|
|
+
|
|
|
+ clusterID, err := strconv.ParseUint(vals["cluster_id"][0], 10, 64)
|
|
|
+ release, _ := app.Repo.Release.ReadRelease(uint(clusterID), name, rel.Namespace)
|
|
|
+
|
|
|
+ var notifConf *models.NotificationConfigExternal
|
|
|
+ notifConf = nil
|
|
|
+ if release != nil && release.NotificationConfig != 0 {
|
|
|
+ conf, err := app.Repo.NotificationConfig.ReadNotificationConfig(release.NotificationConfig)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ app.handleErrorInternal(err, w)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ notifConf = conf.Externalize()
|
|
|
+ }
|
|
|
+
|
|
|
+ notifier := slack.NewSlackNotifier(notifConf, slackInts...)
|
|
|
|
|
|
notifyOpts := &slack.NotifyOpts{
|
|
|
ProjectID: uint(projID),
|
|
|
@@ -1031,8 +1050,6 @@ func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
|
|
|
) + fmt.Sprintf("?project_id=%d", uint(projID)),
|
|
|
}
|
|
|
|
|
|
- rel, err := agent.UpgradeRelease(conf, form.Values, app.DOConf)
|
|
|
-
|
|
|
if err != nil {
|
|
|
notifyOpts.Status = slack.StatusFailed
|
|
|
notifyOpts.Info = err.Error()
|
|
|
@@ -1055,8 +1072,6 @@ func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
// update the github actions env if the release exists and is built from source
|
|
|
if cName := rel.Chart.Metadata.Name; cName == "job" || cName == "web" || cName == "worker" {
|
|
|
- clusterID, err := strconv.ParseUint(vals["cluster_id"][0], 10, 64)
|
|
|
-
|
|
|
if err != nil {
|
|
|
app.sendExternalError(err, http.StatusInternalServerError, HTTPError{
|
|
|
Code: ErrReleaseReadData,
|
|
|
@@ -1066,8 +1081,6 @@ func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- release, err := app.Repo.Release.ReadRelease(uint(clusterID), name, rel.Namespace)
|
|
|
-
|
|
|
if release != nil {
|
|
|
// update image repo uri if changed
|
|
|
repository := rel.Config["image"].(map[string]interface{})["repository"]
|
|
|
@@ -1241,7 +1254,21 @@ func (app *App) HandleReleaseDeployWebhook(w http.ResponseWriter, r *http.Reques
|
|
|
}
|
|
|
|
|
|
slackInts, _ := app.Repo.SlackIntegration.ListSlackIntegrationsByProjectID(uint(form.ReleaseForm.Cluster.ProjectID))
|
|
|
- notifier := slack.NewSlackNotifier(slackInts...)
|
|
|
+
|
|
|
+ var notifConf *models.NotificationConfigExternal
|
|
|
+ notifConf = nil
|
|
|
+ if release != nil && release.NotificationConfig != 0 {
|
|
|
+ conf, err := app.Repo.NotificationConfig.ReadNotificationConfig(release.NotificationConfig)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ app.handleErrorInternal(err, w)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ notifConf = conf.Externalize()
|
|
|
+ }
|
|
|
+
|
|
|
+ notifier := slack.NewSlackNotifier(notifConf, slackInts...)
|
|
|
|
|
|
notifyOpts := &slack.NotifyOpts{
|
|
|
ProjectID: uint(form.ReleaseForm.Cluster.ProjectID),
|