Skip to content

feat(instance): migrate private-nic to v2 private-network-interface - #6157

Merged
Mia-Cross merged 4 commits into
mainfrom
instance_V2_private_nic
Nov 2, 2026
Merged

Mia-Cross merged 4 commits into
mainfrom
instance_V2_private_nic

Conversation

@Mia-Cross

Copy link
Copy Markdown
Contributor

This PR add support for private-network-interface, the API v2 equivalent of a private-nic.
It also deprecates private-nic commands.

@Mia-Cross Mia-Cross self-assigned this Sep 8, 2026
@Mia-Cross Mia-Cross added enhancement instance Instance issues, bugs and feature requests priority:high New features labels Sep 8, 2026
@github-actions github-actions Bot added the load-balancer Load-balancer issues, bugs and feature requests label Sep 8, 2026
@codecov-commenter

codecov-commenter commented Sep 8, 2026 •

Copy link
Copy Markdown

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2589 4 2585 17
View the top 3 failed test(s) by shortest run time
github.com/scaleway/scaleway-cli/v2/internal/namespaces/instance/v2alpha1::Test_PrivateNetworkInterface_Get
Stack Traces | 0s run time
=== RUN   Test_PrivateNetworkInterface_Get
--- FAIL: Test_PrivateNetworkInterface_Get (0.00s)
github.com/scaleway/scaleway-cli/v2/cmd/scw::Test_WebValidateTemplatesVariables
Stack Traces | 0.02s run time
=== RUN   Test_WebValidateTemplatesVariables
    web_test.go:71: {scw instance private-network-interface list template: :1:61: executing "" at <.ServerID>: can't evaluate field ServerID in type *instance.ListPrivateNetworkInterfacesRequest}
--- FAIL: Test_WebValidateTemplatesVariables (0.02s)
github.com/scaleway/scaleway-cli/v2/internal/namespaces/instance/v2alpha1::Test_PrivateNetworkInterface_Get/From_MAC_address
Stack Traces | 0.04s run time
=== RUN   Test_PrivateNetworkInterface_Get/From_MAC_address
=== PAUSE Test_PrivateNetworkInterface_Get/From_MAC_address
=== CONT  Test_PrivateNetworkInterface_Get/From_MAC_address
skipping root volume validation
    custom_private_network_interface_test.go:230: 
        	Error Trace:	.../scaleway-cli/core/testing.go:703
        	            				.../scaleway-cli/core/testing.go:694
        	            				.../scaleway-cli/core/testing.go:524
        	Error:      	Not equal: 
        	            	expected: 0
        	            	actual  : 1
        	Test:       	Test_PrivateNetworkInterface_Get/From_MAC_address
        	Messages:   	Invalid exit code
        	            	scaleway-sdk-go: error executing request: Get "https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno": requested interaction not found
    custom_private_network_interface_test.go:230: 
        	Error Trace:	.../scaleway-cli/core/testing.go:781
        	            				.../scaleway-cli/core/testing.go:694
        	            				.../scaleway-cli/core/testing.go:524
        	Error:      	Not equal: 
        	            	expected: "🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲\n🟩🟩🟩 STDOUT️ 🟩🟩🟩️\nID                88c017e2-ac41-45a6-810d-718fc8b5e746\nPrivateNetworkID  6f108c1c-08ce-4556-ac71-3678a6ec14fe\nProjectID         fa1e3217-dc80-42ac-85c3-3f034b78b552\nServerID          0f223b66-e543-4b56-b85b-6e36a17321bd\nMacAddress        02:00:00:18:bb:82\nStatus            available\nIPIDs.0           6d34259a-5a94-4589-b627-7c4d17b92947\nIPIDs.1           f882dc5e-7f46-4f07-af7c-5269b670d050\nCreatedAt         few seconds ago\nUpdatedAt         few seconds ago\n🟩🟩🟩 JSON STDOUT 🟩🟩🟩\n{\n  \"id\": \"88c017e2-ac41-45a6-810d-718fc8b5e746\",\n  \"private_network_id\": \"6f108c1c-08ce-4556-ac71-3678a6ec14fe\",\n  \"project_id\": \"fa1e3217-dc80-42ac-85c3-3f034b78b552\",\n  \"server_id\": \"0f223b66-e543-4b56-b85b-6e36a17321bd\",\n  \"mac_address\": \"02:00:00:18:bb:82\",\n  \"status\": \"available\",\n  \"ip_ids\": [\n    \"6d34259a-5a94-4589-b627-7c4d17b92947\",\n    \"f882dc5e-7f46-4f07-af7c-5269b670d050\"\n  ],\n  \"tags\": [],\n  \"created_at\": \"1970-01-01T00:00:00.0Z\",\n  \"updated_at\": \"1970-01-01T00:00:00.0Z\"\n}\n"
        	            	actual  : "🎲🎲🎲 EXIT CODE: 1 🎲🎲🎲\n🟥🟥🟥 STDERR️️ 🟥🟥🟥️\nscaleway-sdk-go: error executing request: Get \"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\": requested interaction not found\n🟥🟥🟥 JSON STDERR 🟥🟥🟥\n{\n  \"error\": \"scaleway-sdk-go: error executing request: Get \\\"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\\\": requested interaction not found\"\n}\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,28 +1,7 @@
        	            	-🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
        	            	-🟩🟩🟩 STDOUT️ 🟩🟩🟩️
        	            	-ID                88c017e2-ac41-45a6-810d-718fc8b5e746
        	            	-PrivateNetworkID  6f108c1c-08ce-4556-ac71-3678a6ec14fe
        	            	-ProjectID         fa1e3217-dc80-42ac-85c3-3f034b78b552
        	            	-ServerID          0f223b66-e543-4b56-b85b-6e36a17321bd
        	            	-MacAddress        02:00:00:18:bb:82
        	            	-Status            available
        	            	-IPIDs.0           6d34259a-5a94-4589-b627-7c4d17b92947
        	            	-IPIDs.1           f882dc5e-7f46-4f07-af7c-5269b670d050
        	            	-CreatedAt         few seconds ago
        	            	-UpdatedAt         few seconds ago
        	            	-🟩🟩🟩 JSON STDOUT 🟩🟩🟩
        	            	+🎲🎲🎲 EXIT CODE: 1 🎲🎲🎲
        	            	+🟥🟥🟥 STDERR️️ 🟥🟥🟥️
        	            	+scaleway-sdk-go: error executing request: Get "https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno": requested interaction not found
        	            	+🟥🟥🟥 JSON STDERR 🟥🟥🟥
        	            	 {
        	            	-  "id": "88c017e2-ac41-45a6-810d-718fc8b5e746",
        	            	-  "private_network_id": "6f108c1c-08ce-4556-ac71-3678a6ec14fe",
        	            	-  "project_id": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
        	            	-  "server_id": "0f223b66-e543-4b56-b85b-6e36a17321bd",
        	            	-  "mac_address": "02:00:00:18:bb:82",
        	            	-  "status": "available",
        	            	-  "ip_ids": [
        	            	-    "6d34259a-5a94-4589-b627-7c4d17b92947",
        	            	-    "f882dc5e-7f46-4f07-af7c-5269b670d050"
        	            	-  ],
        	            	-  "tags": [],
        	            	-  "created_at": "1970-01-01T00:00:00.0Z",
        	            	-  "updated_at": "1970-01-01T00:00:00.0Z"
        	            	+  "error": "scaleway-sdk-go: error executing request: Get \"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\": requested interaction not found"
        	            	 }
        	Test:       	Test_PrivateNetworkInterface_Get/From_MAC_address
--- FAIL: Test_PrivateNetworkInterface_Get/From_MAC_address (0.04s)
skipping root volume validation
github.com/scaleway/scaleway-cli/v2/internal/namespaces/instance/v2alpha1::Test_PrivateNetworkInterface_Get/From_ID
Stack Traces | 0.05s run time
=== RUN   Test_PrivateNetworkInterface_Get/From_ID
=== PAUSE Test_PrivateNetworkInterface_Get/From_ID
=== CONT  Test_PrivateNetworkInterface_Get/From_ID
    custom_private_network_interface_test.go:212: 
        	Error Trace:	.../scaleway-cli/core/testing.go:703
        	            				.../scaleway-cli/core/testing.go:694
        	            				.../scaleway-cli/core/testing.go:524
        	Error:      	Not equal: 
        	            	expected: 0
        	            	actual  : 1
        	Test:       	Test_PrivateNetworkInterface_Get/From_ID
        	Messages:   	Invalid exit code
        	            	scaleway-sdk-go: error executing request: Get "https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno": requested interaction not found
    custom_private_network_interface_test.go:212: 
        	Error Trace:	.../scaleway-cli/core/testing.go:781
        	            				.../scaleway-cli/core/testing.go:694
        	            				.../scaleway-cli/core/testing.go:524
        	Error:      	Not equal: 
        	            	expected: "🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲\n🟩🟩🟩 STDOUT️ 🟩🟩🟩️\nID                a3a68600-2f76-437d-87e2-d61a69abff42\nPrivateNetworkID  db7a1e1f-3222-4e9b-ba7a-002a4a71fba2\nProjectID         fa1e3217-dc80-42ac-85c3-3f034b78b552\nServerID          eb8afb95-cbbb-4d6d-8bfb-7246c38edd44\nMacAddress        02:00:00:1f:bf:3a\nStatus            available\nIPIDs.0           b9decf3a-8a11-43e0-a3db-b4a2a2e17c34\nIPIDs.1           312cf385-0c4c-475f-aefd-cf807c0b9a55\nCreatedAt         few seconds ago\nUpdatedAt         few seconds ago\n🟩🟩🟩 JSON STDOUT 🟩🟩🟩\n{\n  \"id\": \"a3a68600-2f76-437d-87e2-d61a69abff42\",\n  \"private_network_id\": \"db7a1e1f-3222-4e9b-ba7a-002a4a71fba2\",\n  \"project_id\": \"fa1e3217-dc80-42ac-85c3-3f034b78b552\",\n  \"server_id\": \"eb8afb95-cbbb-4d6d-8bfb-7246c38edd44\",\n  \"mac_address\": \"02:00:00:1f:bf:3a\",\n  \"status\": \"available\",\n  \"ip_ids\": [\n    \"b9decf3a-8a11-43e0-a3db-b4a2a2e17c34\",\n    \"312cf385-0c4c-475f-aefd-cf807c0b9a55\"\n  ],\n  \"tags\": [],\n  \"created_at\": \"1970-01-01T00:00:00.0Z\",\n  \"updated_at\": \"1970-01-01T00:00:00.0Z\"\n}\n"
        	            	actual  : "🎲🎲🎲 EXIT CODE: 1 🎲🎲🎲\n🟥🟥🟥 STDERR️️ 🟥🟥🟥️\nscaleway-sdk-go: error executing request: Get \"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\": requested interaction not found\n🟥🟥🟥 JSON STDERR 🟥🟥🟥\n{\n  \"error\": \"scaleway-sdk-go: error executing request: Get \\\"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\\\": requested interaction not found\"\n}\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,28 +1,7 @@
        	            	-🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
        	            	-🟩🟩🟩 STDOUT️ 🟩🟩🟩️
        	            	-ID                a3a68600-2f76-437d-87e2-d61a69abff42
        	            	-PrivateNetworkID  db7a1e1f-3222-4e9b-ba7a-002a4a71fba2
        	            	-ProjectID         fa1e3217-dc80-42ac-85c3-3f034b78b552
        	            	-ServerID          eb8afb95-cbbb-4d6d-8bfb-7246c38edd44
        	            	-MacAddress        02:00:00:1f:bf:3a
        	            	-Status            available
        	            	-IPIDs.0           b9decf3a-8a11-43e0-a3db-b4a2a2e17c34
        	            	-IPIDs.1           312cf385-0c4c-475f-aefd-cf807c0b9a55
        	            	-CreatedAt         few seconds ago
        	            	-UpdatedAt         few seconds ago
        	            	-🟩🟩🟩 JSON STDOUT 🟩🟩🟩
        	            	+🎲🎲🎲 EXIT CODE: 1 🎲🎲🎲
        	            	+🟥🟥🟥 STDERR️️ 🟥🟥🟥️
        	            	+scaleway-sdk-go: error executing request: Get "https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno": requested interaction not found
        	            	+🟥🟥🟥 JSON STDERR 🟥🟥🟥
        	            	 {
        	            	-  "id": "a3a68600-2f76-437d-87e2-d61a69abff42",
        	            	-  "private_network_id": "db7a1e1f-3222-4e9b-ba7a-002a4a71fba2",
        	            	-  "project_id": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
        	            	-  "server_id": "eb8afb95-cbbb-4d6d-8bfb-7246c38edd44",
        	            	-  "mac_address": "02:00:00:1f:bf:3a",
        	            	-  "status": "available",
        	            	-  "ip_ids": [
        	            	-    "b9decf3a-8a11-43e0-a3db-b4a2a2e17c34",
        	            	-    "312cf385-0c4c-475f-aefd-cf807c0b9a55"
        	            	-  ],
        	            	-  "tags": [],
        	            	-  "created_at": "1970-01-01T00:00:00.0Z",
        	            	-  "updated_at": "1970-01-01T00:00:00.0Z"
        	            	+  "error": "scaleway-sdk-go: error executing request: Get \"https://api.scaleway..../zones/fr-par-1/private-network-interfaces/%3Cno\": requested interaction not found"
        	            	 }
        	Test:       	Test_PrivateNetworkInterface_Get/From_ID
--- FAIL: Test_PrivateNetworkInterface_Get/From_ID (0.05s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@Mia-Cross
Mia-Cross force-pushed the instance_V2_private_nic branch 3 times, most recently from f69fc2d to d2cd853 Compare October 5, 2026 12:43
@github-code-quality

github-code-quality Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Go

Go / cli

main 9959947 instance_V2_private_... a202c18 +/-
52% 52% 0%
View coverage of the 8 most impacted files.
File main 9959947 instance_V2_private_... a202c18 +/-
internal/namesp..._privatenics.go 92% 31% -61%
internal/namesp...instance_cli.go 81% 81% 0%
internal/namesp...ce/v1/custom.go 99% 99% 0%
internal/namesp...lpha1/custom.go 100% 100% 0%
internal/namesp...1/custom_web.go 100% 100% 0%
internal/namesp.../testhelpers.go 0% 0% 0%
internal/namesp...instance_cli.go 32% 39% +7%
internal/namesp...rk_interface.go 0% 90% +90%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 29, 2026 18:39 UTC

@Mia-Cross
Mia-Cross marked this pull request as ready for review October 5, 2026 12:48
@Mia-Cross
Mia-Cross requested review from a team and remyleone as code owners October 5, 2026 12:48
elwinar
elwinar previously approved these changes Oct 5, 2026
@Mia-Cross
Mia-Cross force-pushed the instance_V2_private_nic branch 3 times, most recently from 652ef4d to c25b8fc Compare October 22, 2026 13:51
elwinar
elwinar previously approved these changes Oct 27, 2026
@Mia-Cross
Mia-Cross force-pushed the instance_V2_private_nic branch from e430d11 to 5d4c57d Compare October 27, 2026 15:10
@Mia-Cross
Mia-Cross requested review from elwinar and pypaut October 27, 2026 15:21
pypaut
pypaut previously approved these changes Oct 28, 2026
elwinar
elwinar previously approved these changes Oct 28, 2026
@remyleone
remyleone dismissed stale reviews from elwinar and pypaut via 9852b93 October 28, 2026 14:40
@Mia-Cross
Mia-Cross force-pushed the instance_V2_private_nic branch from 43e8147 to d9a4f68 Compare October 29, 2026 12:53
Mia-Cross and others added 3 commits October 29, 2026 13:54
 - ignore case on mac address + cleanup IPAM IP in test
 - deprecate commands in custom.go + move ipam testhelpers
 - break when PNI is found by mac address
 - return error if mac address is not found

Co-authored-by: esoulard <esoulard@scaleway.com>
Co-authored-by: Geoffrey Jount <gjount@scaleway.com>
@Mia-Cross
Mia-Cross force-pushed the instance_V2_private_nic branch from d9a4f68 to 1808c25 Compare October 29, 2026 12:54
@Mia-Cross
Mia-Cross requested review from elwinar and pypaut October 29, 2026 13:15

import "github.com/scaleway/scaleway-cli/v2/core"

func CreateIPAMIPFromPrivateNetwork() core.BeforeFunc {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We can probably remove the "IPAM" from the function name since this is now in the ipam package?

func deprecatePrivateNicCommand(c *core.Command) *core.Command {
c.Hidden = true
c.Deprecated = true
c.DeprecationMessage = "private-nic is a term only used in v1, please use private-network-interface instead."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users probably don't really know or care about v1/v2, we should probably leave the version out of the message.

private-nic has been deprecated, use private-network-interface instead

@Mia-Cross
Mia-Cross added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 4edc69c Nov 2, 2026
2 checks passed
@Mia-Cross
Mia-Cross deleted the instance_V2_private_nic branch November 2, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement instance Instance issues, bugs and feature requests load-balancer Load-balancer issues, bugs and feature requests priority:high New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants