Merge pull request #5262 from cpuguy83/ci_cross_compile

Add CI job to cross compile all the things
This commit is contained in:
Derek McGowan 2021-03-25 09:44:12 -07:00 committed by GitHub
commit 7b17a29da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 136 additions and 61 deletions

View File

@ -123,6 +123,88 @@ jobs:
- run: make man - run: make man
working-directory: src/github.com/containerd/containerd working-directory: src/github.com/containerd/containerd
# Make sure binaries compile with other platforms
crossbuild:
name: Crossbuild Binaries
needs: [project, linters, protos, man]
runs-on: ubuntu-18.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: arm64
- goos: linux
goarch: arm
goarm: "7"
- goos: linux
goarch: arm
goarm: "5"
- goos: freebsd
goarch: amd64
- goos: freebsd
goarch: arm64
- goos: windows
goarch: arm
goarm: "7"
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.16.2'
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- run: |
set -e -x
packages=""
platform="${{matrix.goos}}/${{matrix.goarch}}"
if [ -n "${{matrix.goarm}}" ]; then
platform+="/v${{matrix.goarm}}"
fi
case "${platform}" in
linux/arm/v5)
packages+=" crossbuild-essential-armel"
echo "CGO_ENABLED=1" >> $GITHUB_ENV
echo "CC=arm-linux-gnueabi-gcc" >> $GITHUB_ENV
;;
linux/arm/v7)
packages+=" crossbuild-essential-armhf"
echo "CGO_ENABLED=1" >> $GITHUB_ENV
echo "CC=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
;;
linux/arm64)
packages+=" crossbuild-essential-arm64"
echo "CGO_ENABLED=1" >> $GITHUB_ENV
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
;;
windows/arm/v7)
echo "CGO_ENABLED=0" >> $GITHUB_ENV
;;
esac
if [ -n "${packages}" ]; then
sudo apt-get update && sudo apt-get install -y ${packages}
fi
name: install deps
- name: Build
working-directory: src/github.com/containerd/containerd
env:
GOOS: ${{matrix.goos}}
GOARCH: ${{matrix.goarch}}
GOARM: ${{matrix.goarm}}
run: |
make build
make binaries
# #
# Build containerd binaries # Build containerd binaries
# #
@ -157,13 +239,6 @@ jobs:
make binaries make binaries
working-directory: src/github.com/containerd/containerd working-directory: src/github.com/containerd/containerd
- name: Cross-compile
if: startsWith(matrix.os, 'ubuntu')
run : |
GOOS=freebsd make build
GOOS=freebsd make binaries
working-directory: src/github.com/containerd/containerd
# #
# Integration and CRI tests # Integration and CRI tests
# #

4
go.mod
View File

@ -4,7 +4,7 @@ go 1.16
require ( require (
github.com/BurntSushi/toml v0.3.1 github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958
github.com/Microsoft/hcsshim v0.8.15 github.com/Microsoft/hcsshim v0.8.15
github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97 github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97
github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676 github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676
@ -18,7 +18,7 @@ require (
github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14 github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14
github.com/containerd/ttrpc v1.0.2 github.com/containerd/ttrpc v1.0.2
github.com/containerd/typeurl v1.0.1 github.com/containerd/typeurl v1.0.1
github.com/containerd/zfs v0.0.0-20210322090317-0e92c2247fb7 github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433
github.com/containernetworking/plugins v0.8.6 github.com/containernetworking/plugins v0.8.6
github.com/coreos/go-systemd/v22 v22.1.0 github.com/coreos/go-systemd/v22 v22.1.0
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.1

7
go.sum
View File

@ -41,8 +41,9 @@ github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jB
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 h1:mw6pDQqv38/WGF1cO/jF5t/jyAJ2yi7CmtFLLO5tGFI=
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958 h1:koVgEW/cX7NavmMAkL6LgoMZJ9gJnxuWMwwfw5A2s34=
github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ=
@ -158,8 +159,8 @@ github.com/containerd/typeurl v1.0.1 h1:PvuK4E3D5S5q6IqsPDCy928FhP0LUIGcmZ/Yhgp5
github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw=
github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y=
github.com/containerd/zfs v0.0.0-20210322090317-0e92c2247fb7 h1:8vskJ2uVsiu9pjODDUnyj6gKZ6mNPMlqPgfqV6gnuRc= github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433 h1:oFJf1mMvgJAt2QwgEsXLMQK/qRTY8JXwsCV7No1uCb8=
github.com/containerd/zfs v0.0.0-20210322090317-0e92c2247fb7/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY=
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/cni v0.8.0 h1:BT9lpgGoH4jw3lFC7Odz2prU5ruiYKcgAjMCbgybcKI= github.com/containernetworking/cni v0.8.0 h1:BT9lpgGoH4jw3lFC7Odz2prU5ruiYKcgAjMCbgybcKI=
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=

View File

@ -12,46 +12,6 @@ import (
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
type providerOpts struct {
callback EnableCallback
id guid.GUID
group guid.GUID
}
// ProviderOpt allows the caller to specify provider options to
// NewProviderWithOptions
type ProviderOpt func(*providerOpts)
// WithCallback is used to provide a callback option to NewProviderWithOptions
func WithCallback(callback EnableCallback) ProviderOpt {
return func(opts *providerOpts) {
opts.callback = callback
}
}
// WithID is used to provide a provider ID option to NewProviderWithOptions
func WithID(id guid.GUID) ProviderOpt {
return func(opts *providerOpts) {
opts.id = id
}
}
// WithGroup is used to provide a provider group option to
// NewProviderWithOptions
func WithGroup(group guid.GUID) ProviderOpt {
return func(opts *providerOpts) {
opts.group = group
}
}
// NewProviderWithID creates and registers a new ETW provider, allowing the
// provider ID to be manually specified. This is most useful when there is an
// existing provider ID that must be used to conform to existing diagnostic
// infrastructure.
func NewProviderWithID(name string, id guid.GUID, callback EnableCallback) (provider *Provider, err error) {
return NewProviderWithOptions(name, WithID(id), WithCallback(callback))
}
// NewProviderWithOptions creates and registers a new ETW provider, allowing // NewProviderWithOptions creates and registers a new ETW provider, allowing
// the provider ID and Group to be manually specified. This is most useful when // the provider ID and Group to be manually specified. This is most useful when
// there is an existing provider ID that must be used to conform to existing // there is an existing provider ID that must be used to conform to existing

View File

@ -3,11 +3,7 @@
package etw package etw
import (
"github.com/Microsoft/go-winio/pkg/guid"
)
// NewProviderWithID returns a nil provider on unsupported platforms. // NewProviderWithID returns a nil provider on unsupported platforms.
func NewProviderWithID(name string, id guid.GUID, callback EnableCallback) (provider *Provider, err error) { func NewProviderWithOptions(name string, options ...ProviderOpt) (provider *Provider, err error) {
return nil, nil return nil, nil
} }

View File

@ -119,6 +119,46 @@ func providerIDFromName(name string) guid.GUID {
return guid.FromWindowsArray(a) return guid.FromWindowsArray(a)
} }
type providerOpts struct {
callback EnableCallback
id guid.GUID
group guid.GUID
}
// ProviderOpt allows the caller to specify provider options to
// NewProviderWithOptions
type ProviderOpt func(*providerOpts)
// WithCallback is used to provide a callback option to NewProviderWithOptions
func WithCallback(callback EnableCallback) ProviderOpt {
return func(opts *providerOpts) {
opts.callback = callback
}
}
// WithID is used to provide a provider ID option to NewProviderWithOptions
func WithID(id guid.GUID) ProviderOpt {
return func(opts *providerOpts) {
opts.id = id
}
}
// WithGroup is used to provide a provider group option to
// NewProviderWithOptions
func WithGroup(group guid.GUID) ProviderOpt {
return func(opts *providerOpts) {
opts.group = group
}
}
// NewProviderWithID creates and registers a new ETW provider, allowing the
// provider ID to be manually specified. This is most useful when there is an
// existing provider ID that must be used to conform to existing diagnostic
// infrastructure.
func NewProviderWithID(name string, id guid.GUID, callback EnableCallback) (provider *Provider, err error) {
return NewProviderWithOptions(name, WithID(id), WithCallback(callback))
}
// NewProvider creates and registers a new ETW provider. The provider ID is // NewProvider creates and registers a new ETW provider. The provider ID is
// generated based on the provider name. // generated based on the provider name.
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) { func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) {

View File

@ -36,6 +36,9 @@ const (
// active := filepath.Join(dataset.Name, id) // active := filepath.Join(dataset.Name, id)
// committed := active + "@" + snapshotSuffix // committed := active + "@" + snapshotSuffix
snapshotSuffix = "snapshot" snapshotSuffix = "snapshot"
// Using this typed MaxInt64 to prevent integer overlow on 32bit
maxSnapshotSize int64 = math.MaxInt64
) )
type snapshotter struct { type snapshotter struct {
@ -140,8 +143,8 @@ func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e
return snapshots.Usage{}, err return snapshots.Usage{}, err
} }
if sDataset.Used > math.MaxInt64 { if int64(sDataset.Used) > maxSnapshotSize {
return snapshots.Usage{}, errors.Errorf("Dataset size exceeds maximum snapshot size of %v bytes", math.MaxInt64) return snapshots.Usage{}, errors.Errorf("Dataset size exceeds maximum snapshot size of %d bytes", maxSnapshotSize)
} }
usage = snapshots.Usage{ usage = snapshots.Usage{

4
vendor/modules.txt vendored
View File

@ -1,7 +1,7 @@
# github.com/BurntSushi/toml v0.3.1 # github.com/BurntSushi/toml v0.3.1
## explicit ## explicit
github.com/BurntSushi/toml github.com/BurntSushi/toml
# github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 # github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958
## explicit ## explicit
github.com/Microsoft/go-winio github.com/Microsoft/go-winio
github.com/Microsoft/go-winio/backuptar github.com/Microsoft/go-winio/backuptar
@ -105,7 +105,7 @@ github.com/containerd/ttrpc/plugin
# github.com/containerd/typeurl v1.0.1 # github.com/containerd/typeurl v1.0.1
## explicit ## explicit
github.com/containerd/typeurl github.com/containerd/typeurl
# github.com/containerd/zfs v0.0.0-20210322090317-0e92c2247fb7 # github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433
## explicit ## explicit
github.com/containerd/zfs github.com/containerd/zfs
github.com/containerd/zfs/plugin github.com/containerd/zfs/plugin