From f673f17407acf9cf028a10a96f8ef14a9cadf93c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 1 Dec 2020 23:48:34 -0800 Subject: [PATCH] update deps for minio/minio and minio/mc (#458) --- .github/workflows/go.yml | 1 + Makefile | 3 +++ cross-compile.sh | 34 ++++++++++++++++++++++++++++++++++ go.mod | 6 +++--- go.sum | 26 ++++++++++++++++---------- restapi/client-admin.go | 6 +++--- restapi/operator_buckets.go | 2 +- restapi/user_buckets.go | 8 ++++---- restapi/user_buckets_test.go | 18 +++++++++--------- 9 files changed, 74 insertions(+), 30 deletions(-) create mode 100755 cross-compile.sh diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 119339171..801fe8fe4 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -33,4 +33,5 @@ jobs: run: | make verifiers make test + make crosscompile make console diff --git a/Makefile b/Makefile index 5e9b603cb..9b505c1d5 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ fmt: @GO111MODULE=on gofmt -d cmd/ @GO111MODULE=on gofmt -d cluster/ +crosscompile: + @(env bash $(PWD)/cross-compile.sh) + lint: @echo "Running $@ check" @GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean diff --git a/cross-compile.sh b/cross-compile.sh new file mode 100755 index 000000000..790b33cd9 --- /dev/null +++ b/cross-compile.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e +# Enable tracing if set. +[ -n "$BASH_XTRACEFD" ] && set -x + +_init() { + ## All binaries are static make sure to disable CGO. + export CGO_ENABLED=0 + + ## List of architectures and OS to test coss compilation. + SUPPORTED_OSARCH="linux/ppc64le linux/mips64 linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64" +} + +_build() { + local osarch=$1 + IFS=/ read -r -a arr <<<"$osarch" + os="${arr[0]}" + arch="${arr[1]}" + package=$(go list -f '{{.ImportPath}}' ./cmd/console) + printf -- "--> %15s:%s\n" "${osarch}" "${package}" + + # go build -trimpath to build the binary. + GOOS=$os GOARCH=$arch GO111MODULE=on go build -trimpath --tags=kqueue --ldflags "-s -w" -o /dev/null ./cmd/console +} + +main() { + echo "Testing builds for OS/Arch: ${SUPPORTED_OSARCH}" + for each_osarch in ${SUPPORTED_OSARCH}; do + _build "${each_osarch}" + done +} + +_init && main "$@" diff --git a/go.mod b/go.mod index bef808be4..99a5ae60c 100644 --- a/go.mod +++ b/go.mod @@ -16,9 +16,9 @@ require ( github.com/jessevdk/go-flags v1.4.0 github.com/minio/cli v1.22.0 github.com/minio/kes v0.11.0 - github.com/minio/mc v0.0.0-20201119214335-d4f9ea859d6c - github.com/minio/minio v0.0.0-20201102034248-d8e07f2c41c8 - github.com/minio/minio-go/v7 v7.0.6-0.20201119032702-6914cb678dde + github.com/minio/mc v0.0.0-20201202024448-00873e4b9326 + github.com/minio/minio v0.0.0-20201202000049-3ca046b40876 + github.com/minio/minio-go/v7 v7.0.6 github.com/minio/operator v0.0.0-20201022162018-527e5c32132b github.com/mitchellh/go-homedir v1.1.0 github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect diff --git a/go.sum b/go.sum index 0892e0e9f..401c25186 100644 --- a/go.sum +++ b/go.sum @@ -156,6 +156,7 @@ github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bcicen/jstream v0.0.0-20190220045926-16c1f8af81c2 h1:M+TYzBcNIRyzPRg66ndEqUMd7oWDmhvdQmaPC6EZNwM= github.com/bcicen/jstream v0.0.0-20190220045926-16c1f8af81c2/go.mod h1:RDu/qcrnpEdJC/p8tx34+YBFqqX71lB7dOX9QE+ZC4M= +github.com/bcicen/jstream v1.0.1/go.mod h1:9ielPxqFry7Y4Tg3j4BfjPocfJ3TbsRtXOAYXYmRuAQ= github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= github.com/beevik/ntp v0.3.0 h1:xzVrPrE4ziasFXgBVBZJDP0Wg/KpMwk2KHJ4Ba8GrDw= github.com/beevik/ntp v0.3.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= @@ -670,6 +671,8 @@ github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.10.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc= +github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.2/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -679,6 +682,7 @@ github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= github.com/klauspost/pgzip v1.2.1 h1:oIPZROsWuPHpOdMVWLuJZXwgjhrW8r1yEX8UqMyeNHM= github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/readahead v1.3.1 h1:QqXNYvm+VvqYcbrRT4LojUciM0XrznFRIDrbHiJtu/0= github.com/klauspost/readahead v1.3.1/go.mod h1:AH9juHzNH7xqdqFHrMRSHeH2Ps+vFf+kblDqzPFiLJg= github.com/klauspost/reedsolomon v1.9.9 h1:qCL7LZlv17xMixl55nq2/Oa1Y86nfO8EqDfv2GHND54= @@ -757,18 +761,18 @@ github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2 github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= github.com/minio/kes v0.11.0 h1:8ma6OCVSxKT50b1uYXLJro3m7PmZtCLxBaTddQexI5k= github.com/minio/kes v0.11.0/go.mod h1:mTF1Bv8YVEtQqF/B7Felp4tLee44Pp+dgI0rhCvgNg8= -github.com/minio/mc v0.0.0-20201119214335-d4f9ea859d6c h1:/wGiTfC8pFOC2JzwE+XrPeH31LqFR/Dam4Lx1zX3Wag= -github.com/minio/mc v0.0.0-20201119214335-d4f9ea859d6c/go.mod h1:B738ZPTRQiyp3uJ3p2W2mqk8Yp1puYASKY7GIhYyHP8= +github.com/minio/mc v0.0.0-20201202024448-00873e4b9326 h1:3D4hhryynwssPvd5Q4wA03zqwRFs9oNXgKzcFNLMRfw= +github.com/minio/mc v0.0.0-20201202024448-00873e4b9326/go.mod h1:bPrJ0bWZznjXPC+4I7Z4/I0nc1LJTk7nGY5KDTkqCiI= github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= github.com/minio/minio v0.0.0-20200723003940-b9be841fd222/go.mod h1:Eu2KC2p+vW03rnYY/6R/D+QduPB7/j4kBaVA/EDLjWM= -github.com/minio/minio v0.0.0-20201102034248-d8e07f2c41c8 h1:yCDFjUBUoE1uNr8dEqjHuwySdAtOyvVONchEVrPPOGQ= -github.com/minio/minio v0.0.0-20201102034248-d8e07f2c41c8/go.mod h1:640kMkCwiyOX8dheptHYModdUw4HrnUFHKw3McqUXD8= +github.com/minio/minio v0.0.0-20201202000049-3ca046b40876 h1:qaOfIlmmnNT2SFDI01uHVxGIPAlIi3pF0RbwlJZMG5Q= +github.com/minio/minio v0.0.0-20201202000049-3ca046b40876/go.mod h1:RvC4rtbp4pykaWxcJXQGu2QirCeXiyquSyPkadJiiFQ= github.com/minio/minio-go/v7 v7.0.1/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns= github.com/minio/minio-go/v7 v7.0.2/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns= -github.com/minio/minio-go/v7 v7.0.6-0.20200929220449-755b5633803a/go.mod h1:CSt2ETZNs+bIIhWTse0mcZKZWMGrFU7Er7RR0TmkDYk= -github.com/minio/minio-go/v7 v7.0.6-0.20201119032702-6914cb678dde h1:Ag2kFFpCxct9ayux92WQUlT938y7+IbibERYOraT8dM= -github.com/minio/minio-go/v7 v7.0.6-0.20201119032702-6914cb678dde/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= +github.com/minio/minio-go/v7 v7.0.6-0.20201118225257-f6869a5e2a6a/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= +github.com/minio/minio-go/v7 v7.0.6 h1:9czXaG0LEZ9s74smSqy0rm034MxngQoP6HTTuSc5GEs= +github.com/minio/minio-go/v7 v7.0.6/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= github.com/minio/operator v0.0.0-20201022162018-527e5c32132b h1:ggfD6V3nodTzhHJHCYIT1F897gscrz+hHsan0a2Wtqw= github.com/minio/operator v0.0.0-20201022162018-527e5c32132b/go.mod h1:At+++4/6W5BEXK11tN5DKIvkJKhYBZybbb5zmxb0LQI= github.com/minio/selfupdate v0.3.1 h1:BWEFSNnrZVMUWXbXIgLDNDjbejkmpAmZvy/nCz1HlEs= @@ -873,8 +877,7 @@ github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bA github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/philhofer/fwd v1.1.0 h1:PAdZw9+/BCf4gc/kA2L/PbGPkFe72Kl2GLZXTG8HpU8= -github.com/philhofer/fwd v1.1.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.4.0+incompatible h1:06usnXXDNcPvCHDkmPpkidf4jTc52UKld7UPfqKatY4= @@ -957,6 +960,10 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/gopsutil v2.20.3-0.20200314133625-53cec6b37e6a+incompatible h1:YiKUe2ZOmfpDBH4OSyxwkx/mjNqHHnNhOtZ2mPyRme8= github.com/shirou/gopsutil v2.20.3-0.20200314133625-53cec6b37e6a+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v2.20.9+incompatible h1:msXs2frUV+O/JLva9EDLpuJ84PrFsdCTCQex8PUdtkQ= +github.com/shirou/gopsutil v2.20.9+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v2.20.10-0.20201015215925-32d4603d01b7+incompatible h1:4Nw/OaZkO6z7Tj2V48FQkGcVESBvJmKvj+SLKugM6x8= +github.com/shirou/gopsutil v2.20.10-0.20201015215925-32d4603d01b7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= @@ -1043,7 +1050,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= -github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= diff --git a/restapi/client-admin.go b/restapi/client-admin.go index bcd0b6d8b..66288007e 100644 --- a/restapi/client-admin.go +++ b/restapi/client-admin.go @@ -93,7 +93,7 @@ type MinioAdmin interface { stopProfiling(ctx context.Context) (io.ReadCloser, error) serviceTrace(ctx context.Context, allTrace, errTrace bool) <-chan madmin.ServiceTraceInfo getLogs(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo - accountUsageInfo(ctx context.Context) (madmin.AccountUsageInfo, error) + accountInfo(ctx context.Context) (madmin.AccountInfo, error) heal(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, forceStart, forceStop bool) (healStart madmin.HealStartSuccess, healTaskStatus madmin.HealTaskStatus, err error) // Service Accounts @@ -246,8 +246,8 @@ func (ac adminClient) deleteServiceAccount(ctx context.Context, serviceAccount s } // implements madmin.AccountingUsageInfo() -func (ac adminClient) accountUsageInfo(ctx context.Context) (madmin.AccountUsageInfo, error) { - return ac.client.AccountUsageInfo(ctx) +func (ac adminClient) accountInfo(ctx context.Context) (madmin.AccountInfo, error) { + return ac.client.AccountInfo(ctx) } func (ac adminClient) heal(ctx context.Context, bucket, prefix string, healOpts madmin.HealOpts, clientToken string, diff --git a/restapi/operator_buckets.go b/restapi/operator_buckets.go index e35e17ad2..698f70415 100644 --- a/restapi/operator_buckets.go +++ b/restapi/operator_buckets.go @@ -80,7 +80,7 @@ func getOperatorListBucketsResponse(session *models.Principal, namespace, tenant // create a minioClient interface implementation // defining the client to be used adminClient := adminClient{client: mAdmin} - buckets, err := getAccountUsageInfo(ctx, adminClient) + buckets, err := getAccountInfo(ctx, adminClient) if err != nil { return nil, prepareError(err) } diff --git a/restapi/user_buckets.go b/restapi/user_buckets.go index 8239f648b..77d331777 100644 --- a/restapi/user_buckets.go +++ b/restapi/user_buckets.go @@ -245,9 +245,9 @@ func getBucketVersionedResponse(session *models.Principal, bucketName string) (* return listBucketsResponse, nil } -// getAccountUsageInfo fetches a list of all buckets allowed to that particular client from MinIO Servers -func getAccountUsageInfo(ctx context.Context, client MinioAdmin) ([]*models.Bucket, error) { - info, err := client.accountUsageInfo(ctx) +// getAccountInfo fetches a list of all buckets allowed to that particular client from MinIO Servers +func getAccountInfo(ctx context.Context, client MinioAdmin) ([]*models.Bucket, error) { + info, err := client.accountInfo(ctx) if err != nil { return []*models.Bucket{}, err } @@ -271,7 +271,7 @@ func getListBucketsResponse(session *models.Principal) (*models.ListBucketsRespo // create a minioClient interface implementation // defining the client to be used adminClient := adminClient{client: mAdmin} - buckets, err := getAccountUsageInfo(ctx, adminClient) + buckets, err := getAccountInfo(ctx, adminClient) if err != nil { return nil, prepareError(err) } diff --git a/restapi/user_buckets_test.go b/restapi/user_buckets_test.go index aa5317de7..89ddceeee 100644 --- a/restapi/user_buckets_test.go +++ b/restapi/user_buckets_test.go @@ -84,11 +84,11 @@ func (mc minioClientMock) getBucketEncryption(ctx context.Context, bucketName st return minioGetBucketEncryptionMock(ctx, bucketName) } -var minioAccountUsageInfoMock func(ctx context.Context) (madmin.AccountUsageInfo, error) +var minioAccountInfoMock func(ctx context.Context) (madmin.AccountInfo, error) // mock function of dataUsageInfo() needed for list bucket's usage -func (ac adminClientMock) accountUsageInfo(ctx context.Context) (madmin.AccountUsageInfo, error) { - return minioAccountUsageInfoMock(ctx) +func (ac adminClientMock) accountInfo(ctx context.Context) (madmin.AccountInfo, error) { + return minioAccountInfoMock(ctx) } func TestListBucket(t *testing.T) { @@ -96,7 +96,7 @@ func TestListBucket(t *testing.T) { adminClient := adminClientMock{} ctx := context.Background() // Test-1 : getaAcountUsageInfo() Get response from minio client with two buckets - mockBucketList := madmin.AccountUsageInfo{ + mockBucketList := madmin.AccountInfo{ AccountName: "test", Buckets: []madmin.BucketUsageInfo{ {Name: "bucket-1", Created: time.Now(), Size: 1024}, @@ -104,13 +104,13 @@ func TestListBucket(t *testing.T) { }, } // mock function response from listBucketsWithContext(ctx) - minioAccountUsageInfoMock = func(ctx context.Context) (madmin.AccountUsageInfo, error) { + minioAccountInfoMock = func(ctx context.Context) (madmin.AccountInfo, error) { return mockBucketList, nil } // get list buckets response this response should have Name, CreationDate, Size and Access // as part of of each bucket function := "getaAcountUsageInfo()" - bucketList, err := getAccountUsageInfo(ctx, adminClient) + bucketList, err := getAccountInfo(ctx, adminClient) if err != nil { t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) } @@ -124,10 +124,10 @@ func TestListBucket(t *testing.T) { } // Test-2 : getaAcountUsageInfo() Return and see that the error is handled correctly and returned - minioAccountUsageInfoMock = func(ctx context.Context) (madmin.AccountUsageInfo, error) { - return madmin.AccountUsageInfo{}, errors.New("error") + minioAccountInfoMock = func(ctx context.Context) (madmin.AccountInfo, error) { + return madmin.AccountInfo{}, errors.New("error") } - _, err = getAccountUsageInfo(ctx, adminClient) + _, err = getAccountInfo(ctx, adminClient) if assert.Error(err) { assert.Equal("error", err.Error()) }