Skip to content

Commit ed16366

Browse files
committed
Merge branch 'main' of github.com:brevdev/cloud into dishankj-max/BREV-2357
2 parents 1a18755 + 4570d27 commit ed16366

8 files changed

Lines changed: 58 additions & 27 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ GOINSTALL=$(GOCMD) install
2727
GOSEC=gosec
2828

2929
# Third party tools
30-
ARTIFACT_GOLINT=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
30+
ARTIFACT_GOLINT=github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
3131
ARTIFACT_GOSEC=github.com/securego/gosec/v2/cmd/gosec@v2.22.8
3232
ARTIFACT_GOFUMPT=mvdan.cc/gofumpt@v0.9.2
3333

v1/providers/nebius/instance.go

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -706,22 +706,38 @@ func (c *NebiusClient) ListInstances(ctx context.Context, args v1.ListInstancesA
706706
// Collect instances from all projects
707707
allNebiusInstances := make([]*compute.Instance, 0)
708708
for projectID := range projectToRegion {
709-
response, err := c.sdk.Services().Compute().V1().Instance().List(ctx, &compute.ListInstancesRequest{
710-
ParentId: projectID,
711-
})
712-
if err != nil {
713-
c.logger.Error(ctx, fmt.Errorf("failed to list instances in project %s: %w", projectID, err),
714-
v1.LogField("projectID", projectID))
715-
// Continue to next project instead of failing completely
716-
continue
717-
}
709+
var pageToken string
710+
for {
711+
response, err := c.sdk.Services().Compute().V1().Instance().List(ctx, &compute.ListInstancesRequest{
712+
ParentId: projectID,
713+
PageSize: 100,
714+
PageToken: pageToken,
715+
})
716+
if err != nil {
717+
c.logger.Error(ctx, fmt.Errorf("failed to list instances in project %s: %w", projectID, err),
718+
v1.LogField("projectID", projectID))
719+
// Continue to next project instead of failing completely
720+
break
721+
}
718722

719-
if response != nil && response.Items != nil {
720-
c.logger.Info(ctx, "found instances in project",
721-
v1.LogField("projectID", projectID),
722-
v1.LogField("region", projectToRegion[projectID]),
723-
v1.LogField("count", len(response.Items)))
724-
allNebiusInstances = append(allNebiusInstances, response.Items...)
723+
// If the response is nil, we've reached the end of the list
724+
if response == nil {
725+
break
726+
}
727+
728+
if len(response.Items) > 0 {
729+
c.logger.Info(ctx, "found instances in project",
730+
v1.LogField("projectID", projectID),
731+
v1.LogField("region", projectToRegion[projectID]),
732+
v1.LogField("count", len(response.Items)),
733+
v1.LogField("page", pageToken))
734+
allNebiusInstances = append(allNebiusInstances, response.Items...)
735+
}
736+
737+
pageToken = response.GetNextPageToken()
738+
if pageToken == "" {
739+
break
740+
}
725741
}
726742
}
727743

v1/providers/nebius/integration_test.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,22 @@ func TestIntegration_InstanceLifecycle(t *testing.T) {
332332
t.Log("WARNING: No public IP available, skipping SSH connectivity test")
333333
}
334334

335-
// Step 3: List instances (currently not implemented)
335+
// Step 3: List instances and verify the created instance is present
336336
t.Log("Listing instances...")
337337
instances, err := client.ListInstances(ctx, v1.ListInstancesArgs{})
338-
// This is expected to fail with current implementation
339-
if err != nil {
340-
t.Logf("ListInstances failed as expected: %v", err)
341-
assert.Contains(t, err.Error(), "implementation pending")
342-
} else {
343-
t.Logf("Found %d instances", len(instances))
338+
require.NoError(t, err, "ListInstances should succeed")
339+
t.Logf("Found %d instances", len(instances))
340+
341+
// Verify the instance we just created is in the list
342+
var foundCreatedInstance bool
343+
for _, inst := range instances {
344+
if inst.CloudID == instanceCloudID {
345+
foundCreatedInstance = true
346+
t.Logf("✓ Found created instance %s in list", instanceCloudID)
347+
break
348+
}
344349
}
350+
assert.True(t, foundCreatedInstance, "Created instance should be found in ListInstances result")
345351

346352
// Step 4: Stop instance
347353
t.Logf("Stopping instance: %s", instanceCloudID)

v1/providers/shadeform/gen/shadeform/api/openapi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,7 @@ components:
17391739
- fpt
17401740
- hydra
17411741
- amaya
1742+
- verda
17421743
example: hyperstack
17431744
type: string
17441745
Region:

v1/providers/shadeform/gen/shadeform/docs/Cloud.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
* `AMAYA` (value: `"amaya"`)
5757

58+
* `VERDA` (value: `"verda"`)
59+
5860

5961
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
6062

v1/providers/shadeform/gen/shadeform/model_cloud.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v1/providers/shadeform/instance.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ func (c *ShadeformClient) ListInstances(ctx context.Context, _ v1.ListInstancesA
253253
for _, instance := range resp.Instances {
254254
singleInstance, err := c.convertShadeformInstanceToV1Instance(instance)
255255
if err != nil {
256-
return nil, errors.WrapAndTrace(err)
256+
c.logger.Warn(ctx, "skipping instance without refID tag",
257+
v1.LogField("instanceID", instance.Id),
258+
v1.LogField("instanceName", instance.Name),
259+
v1.LogField("error", err.Error()))
260+
continue
257261
}
258262
instances = append(instances, *singleInstance)
259263
}
@@ -357,13 +361,13 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance
357361

358362
refID, found := tags[refIDTagName]
359363
if !found {
360-
return nil, errors.WrapAndTrace(errors.New("could not find refID tag"))
364+
return nil, fmt.Errorf("instance missing refID tag: instanceID=%s, instanceName=%s", shadeformInstance.Id, shadeformInstance.Name)
361365
}
362366
delete(tags, refIDTagName)
363367

364368
cloudCredRefID, found := tags[cloudCredRefIDTagName]
365369
if !found {
366-
return nil, errors.WrapAndTrace(errors.New("could not find cloudCredRefID tag"))
370+
return nil, fmt.Errorf("instance missing cloudCredRefID tag: instanceID=%s, instanceName=%s", shadeformInstance.Id, shadeformInstance.Name)
367371
}
368372
delete(tags, cloudCredRefIDTagName)
369373

v1/providers/shadeform/validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestValidationFunctions(t *testing.T) {
2626

2727
config := validation.ProviderConfig{
2828
Credential: NewShadeformCredential("validation-test", apiKey),
29-
StableIDs: []v1.InstanceTypeID{"datacrunch_B200_helsinki-finland-5", "massedcompute_L40_desmoines-usa-1"},
29+
StableIDs: []v1.InstanceTypeID{"verda_B200_helsinki-finland-5", "massedcompute_L40_desmoines-usa-1"},
3030
}
3131

3232
validation.RunValidationSuite(t, config)

0 commit comments

Comments
 (0)