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
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
goos: linux
- os: ubuntu-24.04
goos: freebsd
- os: ubuntu-24.04
Copy link
Member

Choose a reason for hiding this comment

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

Why ubuntu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just selects a runner. I always was under impression than Linux runner are faster and more available on GitHub Actions. Also, Ubuntu runner is used for Windows lint in this file.

Copy link
Contributor

Choose a reason for hiding this comment

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

We use ubuntu for windows because something is botched wrt Makefile path when on windows...

Will move it to macos-15 - the point is not so much speed here, but verifying that the tooling itself actually works on the target platform.

Making things a bit more clear here: 9c83660

But yeah, it's a detail..

goos: darwin
# FIXME: this is currently failing in a non-sensical way, so, running on linux instead...
# - os: windows-2022
- os: ubuntu-24.04
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
goos: windows
- os: ubuntu-24.04
goos: linux
- os: macos-15
goos: darwin
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unix && !linux

/*
Copyright The containerd Authors.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
23 changes: 0 additions & 23 deletions cmd/nerdctl/container/container_cp_windows.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
2 changes: 2 additions & 0 deletions cmd/nerdctl/main_freebsd.go → cmd/nerdctl/main_nolinux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
2 changes: 2 additions & 0 deletions pkg/buildkitutil/buildkitutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func TestBuildKitFile(t *testing.T) {
var tmp = t.TempDir()
var wd, err = os.Getwd()
assert.NilError(t, err)
tmp, err = filepath.EvalSymlinks(tmp)
assert.NilError(t, err)
err = os.Chdir(tmp)
assert.NilError(t, err)
defer os.Chdir(wd)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unix && !linux

/*
Copyright The containerd Authors.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
26 changes: 0 additions & 26 deletions pkg/cmd/container/exec_windows.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unix && !linux

/*
Copyright The containerd Authors.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
26 changes: 0 additions & 26 deletions pkg/cmd/container/stats_windows.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
26 changes: 0 additions & 26 deletions pkg/cmd/namespace/namespace_windows.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unix && !linux

/*
Copyright The containerd Authors.

Expand Down
26 changes: 23 additions & 3 deletions pkg/defaults/defaults_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,42 @@

package defaults

import gocni "github.com/containerd/go-cni"

const (
AppArmorProfileName = ""
SeccompProfileName = ""
Runtime = ""
)

func CNIPath() string {
return ""
return gocni.DefaultCNIDir
}

func CNIRuntimeDir() (string, error) {
return "/var/run/cni", nil
}

func CNINetConfPath() string {
return ""
return gocni.DefaultNetDir
}

func DataRoot() string {
return ""
return "/var/lib/nerdctl"
}

func CgroupManager() string {
return ""
}

func CgroupnsMode() string {
return ""
}

func NerdctlTOML() string {
return "/etc/nerdctl/nerdctl.toml"
}

func HostsDirs() []string {
return []string{}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/defaults/defaults_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func CNINetConfPath() string {
}

func CNIRuntimeDir() (string, error) {
return "/run/cni", nil
return "/var/run/cni", nil
}

func CgroupManager() string {
Expand Down
22 changes: 13 additions & 9 deletions cmd/nerdctl/main_windows.go → pkg/infoutil/infoutil_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,25 @@
limitations under the License.
*/

package main
package infoutil

import (
"github.com/spf13/cobra"
"github.com/docker/docker/pkg/sysinfo"

"github.com/containerd/nerdctl/v2/pkg/inspecttypes/dockercompat"
)

func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool {
return false
const UnameO = "Darwin"

func CgroupsVersion() string {
return ""
}

func addApparmorCommand(rootCmd *cobra.Command) {
// NOP
func fulfillPlatformInfo(info *dockercompat.Info) {
// unimplemented
}

func resetSavedSETUID() error {
// NOP
return nil
func mobySysInfo(info *dockercompat.Info) *sysinfo.SysInfo {
var sysinfo sysinfo.SysInfo
return &sysinfo
}
72 changes: 72 additions & 0 deletions pkg/mountutil/mountutil_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
Copyright The containerd Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package mountutil

import (
"fmt"
"strings"

"github.com/containerd/containerd/v2/pkg/oci"
"github.com/containerd/errdefs"
"github.com/containerd/log"

"github.com/containerd/nerdctl/v2/pkg/mountutil/volumestore"
)

const (
DefaultMountType = ""

DefaultPropagationMode = ""
)

func UnprivilegedMountFlags(path string) ([]string, error) {
m := []string{}
return m, nil
}

// parseVolumeOptions parses specified optsRaw with using information of
// the volume type and the src directory when necessary.
func parseVolumeOptions(vType, src, optsRaw string) ([]string, []oci.SpecOpts, error) {
var writeModeRawOpts []string
for _, opt := range strings.Split(optsRaw, ",") {
switch opt {
case "rw":
writeModeRawOpts = append(writeModeRawOpts, opt)
case "ro":
writeModeRawOpts = append(writeModeRawOpts, opt)
case "":
// NOP
default:
log.L.Warnf("unsupported volume option %q", opt)
}
}
var opts []string
if len(writeModeRawOpts) > 1 {
return nil, nil, fmt.Errorf("duplicated read/write volume option: %+v", writeModeRawOpts)
} else if len(writeModeRawOpts) > 0 && writeModeRawOpts[0] == "ro" {
opts = append(opts, "ro")
} // No need to return option when "rw"
return opts, nil, nil
}

func ProcessFlagTmpfs(s string) (*Processed, error) {
return nil, errdefs.ErrNotImplemented
}

func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, error) {
return nil, errdefs.ErrNotImplemented
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !linux

/*
Copyright The containerd Authors.

Expand Down
21 changes: 0 additions & 21 deletions pkg/ocihook/ocihook_windows.go

This file was deleted.

Loading