-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zufar Dhiyaullhaq <[email protected]>
- Loading branch information
1 parent
eed714d
commit 8ec842f
Showing
12 changed files
with
84 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
apiVersion: v1 | ||
entries: | ||
istio-upgrade-worker: | ||
- apiVersion: v2 | ||
appVersion: 1.1.0 | ||
created: "2024-10-09T18:57:08.469686+07:00" | ||
digest: 3ef20783cc1231f3e6ec8a4e53667ec59ad8bd838cd0c99f679bf45d8fa6c183 | ||
home: https://github.com/gopaytech/istio-upgrade-worker | ||
maintainers: | ||
- email: [email protected] | ||
name: Zufar Dhiyaulhaq | ||
url: https://zufardhiyaulhaq.com | ||
name: istio-upgrade-worker | ||
type: application | ||
urls: | ||
- istio-upgrade-worker-1.1.0.tgz | ||
version: 1.1.0 | ||
- apiVersion: v2 | ||
appVersion: 1.0.0 | ||
created: "2024-10-04T14:53:02.46348+07:00" | ||
created: "2024-10-09T18:57:08.469351+07:00" | ||
digest: 6385974636e6b37cb53188476bdc4585fb84ed9e1a24d431d2a4b2d8612ba7e1 | ||
home: https://github.com/gopaytech/istio-upgrade-worker | ||
maintainers: | ||
|
@@ -15,4 +29,4 @@ entries: | |
urls: | ||
- istio-upgrade-worker-1.0.0.tgz | ||
version: 1.0.0 | ||
generated: "2024-10-04T14:53:02.462735+07:00" | ||
generated: "2024-10-09T18:57:08.468845+07:00" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package lark | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
golark "github.com/go-lark/lark" | ||
"github.com/gopaytech/istio-upgrade-worker/settings" | ||
"github.com/gopaytech/istio-upgrade-worker/types" | ||
) | ||
|
||
func NewNotificationLark(settings settings.Settings) Lark { | ||
return Lark{ | ||
Settings: settings, | ||
} | ||
} | ||
|
||
type Lark struct { | ||
Settings settings.Settings | ||
} | ||
|
||
func (s Lark) Send(ctx context.Context, upgrade types.Notification) error { | ||
bot := golark.NewNotificationBot(s.Settings.NotificationLarkWebhook) | ||
content := golark.NewPostBuilder(). | ||
Title(upgrade.Title). | ||
TextTag(upgrade.Message, 1, true). | ||
Render() | ||
buffer := golark.NewMsgBuffer(golark.MsgPost).Post(content).Build() | ||
|
||
_, err := bot.PostMessage(buffer) | ||
if err != nil { | ||
log.Printf("failed to send slack notification: %v\n", err.Error()) | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters