Skip to content

Commit b54950c

Browse files
authored
fix: order provisioner keys by creation date (coder#15125)
Closes coder/internal#110 The flake reported in the issue has already been fixed by coder#14875, but this further covers that we return a list the same order every time.
1 parent 5f640eb commit b54950c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

enterprise/coderd/provisionerkeys.go

+5
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,10 @@ func convertProvisionerKeys(dbKeys []database.ProvisionerKey) []codersdk.Provisi
212212
// HashedSecret - never include the access token in the API response
213213
})
214214
}
215+
216+
slices.SortFunc(keys, func(key1, key2 codersdk.ProvisionerKey) int {
217+
return key1.CreatedAt.Compare(key2.CreatedAt)
218+
})
219+
215220
return keys
216221
}

0 commit comments

Comments
 (0)