Skip to content

Commit e458ad5

Browse files
Log workflow key when listing JD nodes (#515)
Quality of life improvement: we need to know the workflow key of the nodes after they are connected to JD to then configure the capabilities registry. This PR addresses that request by logging the `WorkflowKey` when list JD nodes.
1 parent 8dcdd1c commit e458ad5

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

.changeset/wicked-dodos-know.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": patch
3+
---
4+
5+
Add extra info(workflow key and p2p key bundles) when logging JD nodes on a table format.

engine/cld/legacy/cli/commands/jd_helper.go

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func writeNodeTable(nodes []*nodev1.Node) {
153153
for _, node := range nodes {
154154
labelsString := &strings.Builder{}
155155
labelsTable := tablewriter.NewWriter(labelsString)
156-
labels := [][]string{}
156+
var labels [][]string
157157
for _, label := range node.Labels {
158158
labels = append(labels, []string{label.Key, *label.Value})
159159
}
@@ -170,12 +170,37 @@ func writeNodeTable(nodes []*nodev1.Node) {
170170
{"ID", node.Id},
171171
{"Name", node.Name},
172172
{"CSA", node.PublicKey},
173-
{"Enabled", strconv.FormatBool(node.IsEnabled)},
174-
{"Connected", strconv.FormatBool(node.IsConnected)},
175-
{"Labels", labelsString.String()},
176-
{"Created at", node.CreatedAt.AsTime().Format(time.RFC3339)},
177-
{"Updated at", node.UpdatedAt.AsTime().Format(time.RFC3339)},
178173
}
174+
if node.WorkflowKey != nil {
175+
data = append(data, []string{"WorkflowKey", *node.WorkflowKey})
176+
}
177+
178+
if len(node.P2PKeyBundles) > 0 {
179+
p2pBuilder := &strings.Builder{}
180+
p2pTable := tablewriter.NewWriter(p2pBuilder)
181+
var p2pData [][]string
182+
for _, p2p := range node.P2PKeyBundles {
183+
p2pData = append(p2pData, []string{"Peer ID", p2p.PeerId})
184+
p2pData = append(p2pData, []string{"Public Key", p2p.PublicKey})
185+
}
186+
p2pTable.SetBorders(tablewriter.Border{
187+
Left: false,
188+
Right: false,
189+
Top: true,
190+
Bottom: true,
191+
})
192+
p2pTable.AppendBulk(p2pData)
193+
p2pTable.Render()
194+
data = append(data, []string{"P2P Key Bundles", p2pBuilder.String()})
195+
}
196+
197+
data = append(data,
198+
[]string{"Enabled", strconv.FormatBool(node.IsEnabled)},
199+
[]string{"Connected", strconv.FormatBool(node.IsConnected)},
200+
[]string{"Labels", labelsString.String()},
201+
[]string{"Created at", node.CreatedAt.AsTime().Format(time.RFC3339)},
202+
[]string{"Updated at", node.UpdatedAt.AsTime().Format(time.RFC3339)},
203+
)
179204
table := tablewriter.NewWriter(os.Stdout)
180205
table.SetAutoWrapText(false)
181206
table.AppendBulk(data)

0 commit comments

Comments
 (0)