Skip to content

Commit

Permalink
Backports (stable-5.0) (#14094)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline committed Sep 13, 2024
2 parents 3b4fd07 + ca665aa commit 74f9b30
Show file tree
Hide file tree
Showing 44 changed files with 721 additions and 343 deletions.
2 changes: 2 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"enabled": false,
"dependencyDashboard": false,
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/commits.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Commits
on:
- pull_request
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

permissions:
contents: read
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ on:
- main
- stable-*
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

defaults:
Expand Down Expand Up @@ -56,12 +57,10 @@ jobs:
path: ${{ steps.ShellCheck.outputs.sarif }}
if: github.event_name == 'pull_request'

# XXX: using 1.21 to workaround swagger crashing under 1.22
# https://github.com/go-swagger/go-swagger/issues/3070
- name: Install Go (1.21)
- name: Install Go (1.22)
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Install dependencies
run: |
Expand Down Expand Up @@ -161,7 +160,7 @@ jobs:
- name: Unit tests (all)
run: |
set -eux
sudo --preserve-env=CGO_CFLAGS,CGO_LDFLAGS,CGO_LDFLAGS_ALLOW,LD_LIBRARY_PATH LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env "PATH=${PATH}" go test ./...
sudo --preserve-env=CGO_CFLAGS,CGO_LDFLAGS,CGO_LDFLAGS_ALLOW,LD_LIBRARY_PATH LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env "PATH=${PATH}" go test -v ./...
system-tests:
env:
Expand All @@ -182,10 +181,10 @@ jobs:
suite: ["cluster", "standalone"]
backend: ["dir", "btrfs", "lvm", "zfs", "ceph", "random"]
include:
- go: "1.21.x"
- go: "1.22.x"
suite: cluster
backend: dir
- go: "1.21.x"
- go: "1.22.x"
suite: standalone
backend: dir
- go: stable
Expand Down Expand Up @@ -244,7 +243,7 @@ jobs:
go-version: ${{ matrix.go }}

- name: Check compatibility with min Go version (${{ matrix.go }})
if: matrix.go == '1.21.x'
if: matrix.go == '1.22.x'
run: |
set -eux
GOMIN="$(sed -n 's/^GOMIN=\([0-9.]\+\)$/\1/p' Makefile)"
Expand Down Expand Up @@ -476,10 +475,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go (1.21)
- name: Install Go (1.22)
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Install dependencies
run: |
Expand Down Expand Up @@ -548,7 +547,7 @@ jobs:
- name: Install Go (${{ matrix.go }})
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Trigger Launchpad snap build
env:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TAG_SQLITE3=$(shell printf "$(HASH)include <dqlite.h>\nvoid main(){dqlite_node_i
GOPATH ?= $(shell go env GOPATH)
CGO_LDFLAGS_ALLOW ?= (-Wl,-wrap,pthread_create)|(-Wl,-z,now)
SPHINXENV=doc/.sphinx/venv/bin/activate
GOMIN=1.21.0
GOMIN=1.22.0

ifneq "$(wildcard vendor)" ""
DQLITE_PATH=$(CURDIR)/vendor/dqlite
Expand Down
88 changes: 72 additions & 16 deletions client/lxd_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,

targetSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Prepare the source request
Expand Down Expand Up @@ -937,7 +942,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,

sourceSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
sourceSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

sourceSecrets[k] = vStr
}

// Relay mode migration
Expand All @@ -957,7 +967,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,
// Extract the websockets
targetSecrets := map[string]string{}
for k, v := range targetOpAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Launch the relay
Expand Down Expand Up @@ -1199,9 +1214,16 @@ func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPos

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand All @@ -1216,7 +1238,12 @@ func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPos
outputs, ok := opAPI.Metadata["output"].(map[string]any)
if ok {
for k, v := range outputs {
outputFiles[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

outputFiles[k] = vStr
}
}

Expand Down Expand Up @@ -1948,7 +1975,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s

targetSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Prepare the source request
Expand Down Expand Up @@ -1976,7 +2008,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s

sourceSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
sourceSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

sourceSecrets[k] = vStr
}

// Relay mode migration
Expand All @@ -1996,7 +2033,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s
// Extract the websockets
targetSecrets := map[string]string{}
for k, v := range targetOpAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Launch the relay
Expand Down Expand Up @@ -2552,9 +2594,16 @@ func (r *ProtocolLXD) ConsoleInstance(instanceName string, console api.InstanceC

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand Down Expand Up @@ -2644,9 +2693,16 @@ func (r *ProtocolLXD) ConsoleInstanceDynamic(instanceName string, console api.In

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion doc/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
golang: "1.21"
golang: "1.22"
python: "3.11"
jobs:
pre_build:
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(requirements-go)=
## Go

LXD requires Go 1.21.0 or higher and is only tested with the Golang compiler.
LXD requires Go 1.22.0 or higher and is only tested with the Golang compiler.

We recommend having at least 2GB of RAM to allow the build to complete.

Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/canonical/lxd

go 1.21.0
go 1.22.0

// https://github.com/minio/minio-go/issues/1931
replace github.com/minio/minio-go/v7 => github.com/minio/minio-go/v7 v7.0.66
Expand All @@ -20,7 +20,7 @@ require (
github.com/google/gopacket v1.1.19
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
github.com/gorilla/websocket v1.5.1
github.com/gosexy/gettext v0.0.0-20160830220431-74466a0a0c4a
github.com/j-keck/arping v1.0.3
github.com/jaypipes/pcidb v1.0.0
Expand Down Expand Up @@ -48,7 +48,7 @@ require (
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635
github.com/zitadel/oidc/v2 v2.12.2
golang.org/x/crypto v0.27.0
golang.org/x/oauth2 v0.22.0
golang.org/x/oauth2 v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.25.0
golang.org/x/term v0.24.0
Expand All @@ -57,7 +57,7 @@ require (
gopkg.in/juju/environschema.v1 v1.0.1
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
gopkg.in/yaml.v2 v2.4.0
k8s.io/utils v0.0.0-20240821151609-f90d01438635
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3
)

require (
Expand Down Expand Up @@ -122,12 +122,12 @@ require (
github.com/vishvananda/netns v0.0.4 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/grpc v1.65.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.66.2 // indirect
gopkg.in/errgo.v1 v1.0.1 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
gopkg.in/httprequest.v1 v1.2.1 // indirect
Expand Down
Loading

0 comments on commit 74f9b30

Please sign in to comment.