Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/BurntSushi/toml v1.6.0
github.com/cloudbase/garm-provider-common v0.1.9
github.com/cloudbase/garm-provider-common v0.1.10-0.20261111212522-a63fbe8afd51
github.com/google/uuid v1.6.0
github.com/gophercloud/gophercloud/v2 v2.15.0
github.com/gophercloud/utils/v2 v2.0.0-20260626221802-4ae35253ac13
Expand All @@ -20,14 +20,14 @@ require (
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
github.com/stretchr/objx v0.5.3 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect
)

require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/mattn/go-isatty v0.0.21 // indirect
github.com/minio/sio v0.4.3 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/minio/sio v0.5.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPn
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk=
github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cloudbase/garm-provider-common v0.1.9 h1:ZL53ma/j7BgMAqW/OJ/jCnx1MUd8hLcYxUTEFb/o/e0=
github.com/cloudbase/garm-provider-common v0.1.9/go.mod h1:8tnJcLXtaMUDEUgX3MGLFEYnMpiCAKaKWPtzNnzEpAE=
github.com/cloudbase/garm-provider-common v0.1.10-0.20261111212522-a63fbe8afd51 h1:WMeG7MyUnjwpM2qBAo5NmyE3NSzTCqRTv8dmOFUEYdM=
github.com/cloudbase/garm-provider-common v0.1.10-0.20261111212522-a63fbe8afd51/go.mod h1:9UvQ/bHlwgSAeLFV94by9M7kRg3d0H3kemkjcFzJMmc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/gofrs/uuid/v5 v5.4.0 h1:EfbpCTjqMuGyq5ZJwxqzn3Cbr2d0rUZU7v5ycAk/e/0=
github.com/gofrs/uuid/v5 v5.4.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand All @@ -21,10 +21,10 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg=
github.com/invopop/jsonschema v0.14.0/go.mod h1:ygm6C2EaVNMBDPpaPlnOA2pFAxBnxGjFlMZABxm9n2I=
github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs=
github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/minio/sio v0.4.3 h1:JqyID1XM86KwBZox5RAdLD4MLPIDoCY2cke2CXCJCkg=
github.com/minio/sio v0.4.3/go.mod h1:4ANoe4CCXqnt1FCiLM0+vlBUhhWZzVOhYCz0069KtFc=
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/minio/sio v0.5.1 h1:sqtImrnCSHbDqO/lVy3tfbsctHzfelDv3NbXWEVcWT8=
github.com/minio/sio v0.5.1/go.mod h1:4ANoe4CCXqnt1FCiLM0+vlBUhhWZzVOhYCz0069KtFc=
github.com/pb33f/ordered-map/v2 v2.3.1 h1:5319HDO0aw4DA4gzi+zv4FXU9UlSs3xGZ40wcP1nBjY=
github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7VvaHKbd1HnmQ=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -47,8 +47,8 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U=
go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4=
go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
Expand Down
57 changes: 57 additions & 0 deletions provider/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/cloudbase/garm-provider-common/cloudconfig"
"github.com/cloudbase/garm-provider-common/params"
"github.com/cloudbase/garm-provider-common/util"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/stretchr/testify/assert"

Expand Down Expand Up @@ -557,6 +558,62 @@ func TestNewMachineSpec(t *testing.T) {
assert.Equal(t, expectedOutput, spec)
}

// TestNewMachineSpecSelectsToolsForArch checks that the machine spec takes
// the runner tools matching the requested architecture from the list GARM
// passes, including architectures whose tools only third parties publish.
func TestNewMachineSpecSelectsToolsForArch(t *testing.T) {
// TestNewMachineSpec replaces DefaultToolFetch with a stub; use the real one.
DefaultToolFetch = util.GetTools
cfg := &config.Config{
Cloud: "mycloud",
Credentials: config.Credentials{
Clouds: "../testdata/clouds.yaml",
},
DefaultNetworkID: "network",
}
tools := []params.RunnerApplicationDownload{}
for _, arch := range []string{"x64", "arm64", "arm", "ppc64le", "s390x"} {
tools = append(tools, params.RunnerApplicationDownload{
OS: Ptr("linux"),
Architecture: Ptr(arch),
DownloadURL: Ptr("https://example.com/actions-runner-linux-" + arch + ".tar.gz"),
Filename: Ptr("actions-runner-linux-" + arch + ".tar.gz"),
})
}

tests := []struct {
osArch params.OSArch
wantArch string
}{
{osArch: params.Amd64, wantArch: "x64"},
{osArch: params.Arm64, wantArch: "arm64"},
{osArch: params.Arm, wantArch: "arm"},
{osArch: params.Ppc64le, wantArch: "ppc64le"},
{osArch: params.S390x, wantArch: "s390x"},
}

for _, tt := range tests {
t.Run(string(tt.osArch), func(t *testing.T) {
data := params.BootstrapInstance{
Name: "test-instance",
OSArch: tt.osArch,
OSType: params.Linux,
Flavor: "m1.small",
Image: "ubuntu-24.04",
Tools: tools,
PoolID: "test-pool",
}

spec, err := NewMachineSpec(data, cfg, "controllerID")
assert.NoError(t, err)
if assert.NotNil(t, spec) {
assert.Equal(t, tt.wantArch, spec.Tools.GetArchitecture())
assert.Equal(t, string(tt.osArch), spec.Properties["os_arch"])
}
})
}
}

func TestGetBootFromVolumeOpts(t *testing.T) {
srvOpts := servers.CreateOpts{
Name: "runner",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading