Skip to content

Commit c52ff8c

Browse files
authored
Update pipectl event register to support deployment trace feature (#5650)
Signed-off-by: khanhtc1202 <[email protected]>
1 parent cb5b661 commit c52ff8c

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

pkg/app/pipectl/cmd/event/register.go

+22-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ type register struct {
3535
data string
3636
labels map[string]string
3737
contexts map[string]string
38+
39+
// information of commit that triggers the event
40+
commitHash string
41+
commitTitle string
42+
commitMessage string
43+
commitURL string
44+
commitAuthor string
3845
}
3946

4047
func newRegisterCommand(root *command) *cobra.Command {
@@ -52,6 +59,12 @@ func newRegisterCommand(root *command) *cobra.Command {
5259
cmd.Flags().StringToStringVar(&r.labels, "labels", r.labels, "The list of labels for event. Format: key=value,key2=value2")
5360
cmd.Flags().StringToStringVar(&r.contexts, "contexts", r.contexts, "The list of the values for the event context. Format: key=value,key2=value2. The Key Format is [a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$")
5461

62+
cmd.Flags().StringVar(&r.commitHash, "commit-hash", r.commitHash, "The commit hash that triggers the event.")
63+
cmd.Flags().StringVar(&r.commitTitle, "commit-title", r.commitTitle, "The title of commit that triggers the event.")
64+
cmd.Flags().StringVar(&r.commitMessage, "commit-message", r.commitMessage, "The message of commit that triggers the event.")
65+
cmd.Flags().StringVar(&r.commitURL, "commit-url", r.commitURL, "The URL of commit that triggers the event.")
66+
cmd.Flags().StringVar(&r.commitAuthor, "commit-author", r.commitAuthor, "The author of commit that triggers the event.")
67+
5568
cmd.MarkFlagRequired("name")
5669
cmd.MarkFlagRequired("data")
5770

@@ -70,10 +83,15 @@ func (r *register) run(ctx context.Context, input cli.Input) error {
7083
defer cli.Close()
7184

7285
req := &apiservice.RegisterEventRequest{
73-
Name: r.name,
74-
Data: r.data,
75-
Labels: r.labels,
76-
Contexts: r.contexts,
86+
Name: r.name,
87+
Data: r.data,
88+
Labels: r.labels,
89+
Contexts: r.contexts,
90+
CommitHash: r.commitHash,
91+
CommitTitle: r.commitTitle,
92+
CommitMessage: r.commitMessage,
93+
CommitUrl: r.commitURL,
94+
CommitAuthor: r.commitAuthor,
7795
}
7896

7997
res, err := cli.RegisterEvent(ctx, req)

0 commit comments

Comments
 (0)