Skip to content

Commit dabbcb8

Browse files
Merge pull request #21339 from mheon/specgen_to_pointer_v2
Convert SpecGen values to be nullable where possible
2 parents a6be5b0 + d202acd commit dabbcb8

85 files changed

Lines changed: 2177 additions & 1281 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ require (
1111
github.com/checkpoint-restore/go-criu/v7 v7.0.0
1212
github.com/containernetworking/plugins v1.4.0
1313
github.com/containers/buildah v1.33.2-0.20231121195905-d1a1c53c8e1c
14-
github.com/containers/common v0.57.1-0.20240124083822-167512e3cfc4
14+
github.com/containers/common v0.57.1-0.20240129201029-3310a75e3608
1515
github.com/containers/conmon v2.0.20+incompatible
1616
github.com/containers/gvisor-tap-vsock v0.7.2
17-
github.com/containers/image/v5 v5.29.1-0.20231221164234-1b221d4a9c28
17+
github.com/containers/image/v5 v5.29.2-0.20240129204525-816800b5daf7
1818
github.com/containers/libhvee v0.6.0
1919
github.com/containers/ocicrypt v1.1.9
2020
github.com/containers/psgo v1.8.0
21-
github.com/containers/storage v1.51.1-0.20231221151421-1020ab61b4e5
21+
github.com/containers/storage v1.52.1-0.20240129173630-7a525ce0e2bc
2222
github.com/coreos/go-systemd/v22 v22.5.1-0.20231103132048-7d375ecc2b09
2323
github.com/coreos/stream-metadata-go v0.4.4
2424
github.com/crc-org/vfkit v0.5.0
@@ -65,7 +65,7 @@ require (
6565
github.com/vbauerster/mpb/v8 v8.7.2
6666
github.com/vishvananda/netlink v1.2.1-beta.2
6767
go.etcd.io/bbolt v1.3.8
68-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
68+
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b
6969
golang.org/x/net v0.20.0
7070
golang.org/x/sync v0.6.0
7171
golang.org/x/sys v0.16.0
@@ -101,13 +101,13 @@ require (
101101
github.com/containers/luksy v0.0.0-20231030195837-b5a7f79da98b // indirect
102102
github.com/coreos/go-oidc/v3 v3.9.0 // indirect
103103
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
104-
github.com/cyberphone/json-canonicalization v0.0.0-20231011164504-785e29786b46 // indirect
104+
github.com/cyberphone/json-canonicalization v0.0.0-20231217050601-ba74d44ecf5f // indirect
105105
github.com/davecgh/go-spew v1.1.1 // indirect
106106
github.com/digitalocean/go-libvirt v0.0.0-20220804181439-8648fbde413e // indirect
107107
github.com/disiqueira/gotree/v3 v3.0.2 // indirect
108108
github.com/distribution/reference v0.5.0 // indirect
109-
github.com/docker/docker-credential-helpers v0.8.0 // indirect
110-
github.com/felixge/httpsnoop v1.0.3 // indirect
109+
github.com/docker/docker-credential-helpers v0.8.1 // indirect
110+
github.com/felixge/httpsnoop v1.0.4 // indirect
111111
github.com/fsnotify/fsnotify v1.7.0 // indirect
112112
github.com/fsouza/go-dockerclient v1.10.0 // indirect
113113
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
@@ -124,8 +124,8 @@ require (
124124
github.com/go-openapi/loads v0.21.2 // indirect
125125
github.com/go-openapi/runtime v0.26.0 // indirect
126126
github.com/go-openapi/spec v0.20.9 // indirect
127-
github.com/go-openapi/strfmt v0.21.10 // indirect
128-
github.com/go-openapi/swag v0.22.5 // indirect
127+
github.com/go-openapi/strfmt v0.22.0 // indirect
128+
github.com/go-openapi/swag v0.22.9 // indirect
129129
github.com/go-openapi/validate v0.22.1 // indirect
130130
github.com/go-playground/locales v0.14.1 // indirect
131131
github.com/go-playground/universal-translator v0.18.1 // indirect
@@ -145,7 +145,7 @@ require (
145145
github.com/inconshreveable/mousetrap v1.1.0 // indirect
146146
github.com/jinzhu/copier v0.4.0 // indirect
147147
github.com/josharian/intern v1.0.0 // indirect
148-
github.com/klauspost/compress v1.17.4 // indirect
148+
github.com/klauspost/compress v1.17.5 // indirect
149149
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
150150
github.com/klauspost/pgzip v1.2.6 // indirect
151151
github.com/kr/fs v0.1.0 // indirect
@@ -184,7 +184,7 @@ require (
184184
github.com/shoenig/go-m1cpu v0.1.6 // indirect
185185
github.com/sigstore/fulcio v1.4.3 // indirect
186186
github.com/sigstore/rekor v1.2.2 // indirect
187-
github.com/sigstore/sigstore v1.8.0 // indirect
187+
github.com/sigstore/sigstore v1.8.1 // indirect
188188
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
189189
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980 // indirect
190190
github.com/sylabs/sif/v2 v2.15.1 // indirect
@@ -208,7 +208,7 @@ require (
208208
golang.org/x/arch v0.5.0 // indirect
209209
golang.org/x/crypto v0.18.0 // indirect
210210
golang.org/x/mod v0.14.0 // indirect
211-
golang.org/x/oauth2 v0.15.0 // indirect
211+
golang.org/x/oauth2 v0.16.0 // indirect
212212
golang.org/x/time v0.3.0 // indirect
213213
golang.org/x/tools v0.16.1 // indirect
214214
google.golang.org/appengine v1.6.8 // indirect

go.sum

Lines changed: 30 additions & 28 deletions
Large diffs are not rendered by default.

pkg/api/handlers/compat/containers_create.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
115115
return
116116
}
117117
// moby always create the working directory
118-
sg.CreateWorkingDir = true
118+
localTrue := true
119+
sg.CreateWorkingDir = &localTrue
119120
// moby doesn't inherit /etc/hosts from host
120121
sg.BaseHostsFile = "none"
121122

@@ -420,7 +421,7 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C
420421
Expose: expose,
421422
GroupAdd: cc.HostConfig.GroupAdd,
422423
Hostname: cc.Config.Hostname,
423-
ImageVolume: define.TypeBind,
424+
ImageVolume: "anonymous",
424425
Init: init,
425426
Interactive: cc.Config.OpenStdin,
426427
IPC: string(cc.HostConfig.IpcMode),

pkg/api/handlers/libpod/containers_create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
3030
// we have to set the default before we decode to make sure the correct default is set when the field is unset
3131
sg := specgen.SpecGenerator{
3232
ContainerNetworkConfig: specgen.ContainerNetworkConfig{
33-
UseImageHosts: conf.Containers.NoHosts,
33+
UseImageHosts: &conf.Containers.NoHosts,
3434
},
3535
ContainerSecurityConfig: specgen.ContainerSecurityConfig{
3636
Umask: conf.Containers.Umask,
37-
Privileged: conf.Containers.Privileged,
37+
Privileged: &conf.Containers.Privileged,
3838
},
3939
}
4040

pkg/bindings/test/attach_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ var _ = Describe("Podman containers attach", func() {
6767
It("can echo data via cat in container", func() {
6868
s := specgen.NewSpecGenerator(alpine.name, false)
6969
s.Name = "CatAttachTest"
70-
s.Terminal = true
70+
localTrue := true
71+
s.Terminal = &localTrue
7172
s.Command = []string{"/bin/cat"}
7273
ctnr, err := containers.CreateWithSpec(bt.conn, s, nil)
7374
Expect(err).ShouldNot(HaveOccurred())

pkg/bindings/test/common_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ func (b *bindingTest) restoreImageFromCache(i testImage) {
203203
// and add or append the alpine image to it
204204
func (b *bindingTest) RunTopContainer(containerName *string, podName *string) (string, error) {
205205
s := specgen.NewSpecGenerator(alpine.name, false)
206-
s.Terminal = false
206+
terminal := false
207+
s.Terminal = &terminal
207208
s.Command = []string{"/usr/bin/top"}
208209
if containerName != nil {
209210
s.Name = *containerName

pkg/bindings/test/containers_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ var _ = Describe("Podman containers ", func() {
360360
It("logging", func() {
361361
stdoutChan := make(chan string, 10)
362362
s := specgen.NewSpecGenerator(alpine.name, false)
363-
s.Terminal = true
363+
terminal := true
364+
s.Terminal = &terminal
364365
s.Command = []string{"date", "-R"}
365366
r, err := containers.CreateWithSpec(bt.conn, s, nil)
366367
Expect(err).ToNot(HaveOccurred())
@@ -774,7 +775,8 @@ var _ = Describe("Podman containers ", func() {
774775
_, err = bt.RunTopContainer(&name2, nil)
775776
Expect(err).ToNot(HaveOccurred())
776777
s := specgen.NewSpecGenerator(alpine.name, false)
777-
s.Terminal = true
778+
terminal := true
779+
s.Terminal = &terminal
778780
s.Command = []string{"date", "-R"}
779781
_, err = containers.CreateWithSpec(bt.conn, s, nil)
780782
Expect(err).ToNot(HaveOccurred())

pkg/bindings/test/create_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ var _ = Describe("Create containers ", func() {
3333
It("create a container running top", func() {
3434
s := specgen.NewSpecGenerator(alpine.name, false)
3535
s.Command = []string{"top"}
36-
s.Terminal = true
36+
terminal := true
37+
s.Terminal = &terminal
3738
s.Name = "top"
3839
ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
3940
Expect(err).ToNot(HaveOccurred())

pkg/domain/entities/pods.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"strings"
66

77
commonFlag "github.com/containers/common/pkg/flag"
8-
"github.com/containers/podman/v4/libpod/define"
98
"github.com/containers/podman/v4/pkg/domain/entities/types"
109
"github.com/containers/podman/v4/pkg/specgen"
1110
"github.com/containers/podman/v4/pkg/util"
@@ -272,7 +271,7 @@ type ContainerCreateOptions struct {
272271
func NewInfraContainerCreateOptions() ContainerCreateOptions {
273272
options := ContainerCreateOptions{
274273
IsInfra: true,
275-
ImageVolume: define.TypeBind,
274+
ImageVolume: "anonymous",
276275
MemorySwappiness: -1,
277276
}
278277
return options

pkg/domain/infra/abi/containers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,8 @@ func (ic *ContainerEngine) ContainerClone(ctx context.Context, ctrCloneOpts enti
17011701
}
17021702

17031703
// if we do not pass term, running ctrs exit
1704-
spec.Terminal = c.Terminal()
1704+
localTerm := c.Terminal()
1705+
spec.Terminal = &localTerm
17051706

17061707
// Print warnings
17071708
if len(out) > 0 {

0 commit comments

Comments
 (0)