From 1b75e3bc7887abeecaf87282a15ed719d665ac40 Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Sat, 20 Apr 2024 23:52:35 +0200 Subject: [PATCH 1/4] incusd/storage/s3: Use 'mc' client Signed-off-by: Piotr Resztak --- .../server/storage/s3/miniod/admin_client.go | 271 ++++++++++++++++++ internal/server/storage/s3/miniod/miniod.go | 50 +++- 2 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 internal/server/storage/s3/miniod/admin_client.go diff --git a/internal/server/storage/s3/miniod/admin_client.go b/internal/server/storage/s3/miniod/admin_client.go new file mode 100644 index 00000000000..4d1b64fa2c1 --- /dev/null +++ b/internal/server/storage/s3/miniod/admin_client.go @@ -0,0 +1,271 @@ +package miniod + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/google/uuid" + + "github.com/lxc/incus/v6/shared/subprocess" +) + +// AddServiceAccountResp is the response body of the add service account call. +type AddServiceAccountResp struct { + AccessKey string `json:"accessKey,omitempty"` + SecretKey string `json:"secretKey,omitempty"` + SessionToken string `json:"sessionToken,omitempty"` +} + +// InfoServiceAccountResp is the response body of the info service account call. +type InfoServiceAccountResp struct { + AccountStatus string `json:"accountStatus"` + ParentUser string `json:"parentUser"` + Policy map[string]any `json:"policy"` +} + +// AdminClient represents minio client. +type AdminClient struct { + process *Process + alias string + binaryName string + varPath string +} + +// configDir returns path to the configuration directory for mc command. +func (c *AdminClient) configDir() string { + return filepath.Join(c.varPath, "mc", "config") +} + +// policyDir returns path to the location with temporary policy files. +func (c *AdminClient) policyDir() string { + return filepath.Join(c.varPath, "mc", "policy") +} + +// runClientCommand runs 'mc' command. +func (c *AdminClient) runClientCommand(ctx context.Context, workDir string, extraArgs ...string) (string, error) { + args := []string{"-C", c.configDir()} + + args = append(args, extraArgs...) + + cmd := exec.CommandContext(ctx, c.binaryName, args...) + + if workDir != "" { + cmd.Dir = workDir + } + + var stdout bytes.Buffer + var stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + err := cmd.Run() + if err != nil { + return stdout.String(), subprocess.NewRunError(c.binaryName, args, err, &stdout, &stderr) + } + + return stdout.String(), nil +} + +// writePolicy writes policy data to the file. +func (c *AdminClient) writePolicy(policy []byte) error { + err := os.MkdirAll(c.policyDir(), 0755) + if err != nil { + return err + } + + policyPath := filepath.Join(c.policyDir(), c.alias) + + err = os.WriteFile(policyPath, policy, 0644) + if err != nil { + return err + } + + return nil +} + +// isMinIOClient checks whether "mc" is the MinIO client binary or another software. +func (c *AdminClient) isMinIOClient() bool { + out, err := c.runClientCommand(context.TODO(), "", "--version") + if err != nil { + return false + } + + lines := strings.Split(out, "\n") + if len(lines) < 1 { + return false + } + + if !strings.Contains(lines[0], "mc version") { + return false + } + + return true +} + +// ServiceStop stops the MinIO cluster. +func (c *AdminClient) ServiceStop(ctx context.Context) error { + _, err := c.runClientCommand(ctx, "", "admin", "service", "stop", c.alias) + if err != nil { + return err + } + + return nil +} + +// AddAlias adds a new alias to configuration file. +func (c *AdminClient) AddAlias(ctx context.Context) error { + _, err := c.runClientCommand(ctx, "", "alias", "set", c.alias, c.process.url.String(), c.process.username, c.process.password) + if err != nil { + return err + } + + return nil +} + +// RemoveAlias removes an alias from configuration file. +func (c *AdminClient) RemoveAlias(ctx context.Context) error { + _, err := c.runClientCommand(ctx, "", "alias", "rm", c.alias) + if err != nil { + return err + } + + return nil +} + +// AddServiceAccount adds a new service account. +func (c *AdminClient) AddServiceAccount(ctx context.Context, account, accessKey, secretKey string, policy []byte) (*AddServiceAccountResp, error) { + cmd := []string{ + "--json", + "admin", + "user", + "svcacct", + "add", + c.alias, + account, + } + + if accessKey != "" { + cmd = append(cmd, "--access-key", accessKey) + } + + if secretKey != "" { + cmd = append(cmd, "--secret-key", secretKey) + } + + if len(policy) > 0 { + policyPath := filepath.Join(c.policyDir(), c.alias) + err := c.writePolicy(policy) + if err != nil { + return nil, err + } + + defer os.Remove(policyPath) + + cmd = append(cmd, "--policy", policyPath) + } + + out, err := c.runClientCommand(ctx, "", cmd...) + if err != nil { + return nil, err + } + + var resp AddServiceAccountResp + err = json.Unmarshal([]byte(out), &resp) + if err != nil { + return nil, err + } + + return &resp, nil +} + +// DeleteServiceAccount removes a service account. +func (c *AdminClient) DeleteServiceAccount(ctx context.Context, accessKey string) error { + _, err := c.runClientCommand(ctx, "", "admin", "user", "svcacct", "rm", c.alias, accessKey) + if err != nil { + return err + } + + return nil +} + +// InfoServiceAccount returns a service account info. +func (c *AdminClient) InfoServiceAccount(ctx context.Context, accessKey string) (*InfoServiceAccountResp, error) { + out, err := c.runClientCommand(ctx, "", "--json", "admin", "user", "svcacct", "info", c.alias, accessKey) + if err != nil { + return nil, err + } + + var resp InfoServiceAccountResp + err = json.Unmarshal([]byte(out), &resp) + if err != nil { + return nil, err + } + + return &resp, nil +} + +// UpdateServiceAccount modifies an existing service account. +func (c *AdminClient) UpdateServiceAccount(ctx context.Context, account, secretKey string, policy []byte) error { + cmd := []string{ + "admin", + "user", + "svcacct", + "edit", + c.alias, + account, + } + + if secretKey != "" { + cmd = append(cmd, "--secret-key", secretKey) + } + + if len(policy) > 0 { + policyPath := filepath.Join(c.policyDir(), c.alias) + err := c.writePolicy(policy) + if err != nil { + return err + } + + defer os.Remove(policyPath) + + cmd = append(cmd, "--policy", policyPath) + } + + _, err := c.runClientCommand(ctx, "", cmd...) + if err != nil { + return err + } + + return nil +} + +// ExportIAM exports IAM data. +func (c *AdminClient) ExportIAM(ctx context.Context) ([]byte, error) { + iamDir := filepath.Join(c.varPath, "mc", "iam", uuid.NewString()) + + err := os.MkdirAll(iamDir, 0755) + if err != nil { + return nil, err + } + + defer func() { _ = os.RemoveAll(iamDir) }() + + _, err = c.runClientCommand(ctx, iamDir, "admin", "cluster", "iam", "export", c.alias) + if err != nil { + return nil, err + } + + iamPath := filepath.Join(iamDir, fmt.Sprintf("%s-%s", c.alias, "iam-info.zip")) + iamBytes, err := os.ReadFile(iamPath) + if err != nil { + return nil, err + } + + return iamBytes, nil +} diff --git a/internal/server/storage/s3/miniod/miniod.go b/internal/server/storage/s3/miniod/miniod.go index 0107daa1c4d..5d904e45d56 100644 --- a/internal/server/storage/s3/miniod/miniod.go +++ b/internal/server/storage/s3/miniod/miniod.go @@ -9,12 +9,12 @@ import ( "os" "os/exec" "path/filepath" + "strings" "sync" "syscall" "time" "github.com/google/uuid" - "github.com/minio/madmin-go" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" @@ -23,6 +23,7 @@ import ( "github.com/lxc/incus/v6/internal/server/operations" "github.com/lxc/incus/v6/internal/server/state" storageDrivers "github.com/lxc/incus/v6/internal/server/storage/drivers" + internalUtil "github.com/lxc/incus/v6/internal/util" "github.com/lxc/incus/v6/shared/api" "github.com/lxc/incus/v6/shared/cancel" "github.com/lxc/incus/v6/shared/logger" @@ -63,13 +64,29 @@ func (p *Process) AdminUser() string { } // AdminClient returns admin client for the minio process. -func (p *Process) AdminClient() (*madmin.AdminClient, error) { - adminClient, err := madmin.New(p.url.Host, p.username, p.password, false) +func (p *Process) AdminClient() (*AdminClient, error) { + binaryName := "mc" + _, err := exec.LookPath(binaryName) if err != nil { - return nil, err + binaryName = "mcli" + _, err = exec.LookPath(binaryName) + if err != nil { + return nil, err + } + } + + client := &AdminClient{ + p, + strings.Replace(p.bucketName, ".", "_", -1), + binaryName, + internalUtil.VarPath(""), } - return adminClient, nil + if !client.isMinIOClient() { + return nil, fmt.Errorf("'%s' binary is not MinIO client", binaryName) + } + + return client, nil } // S3Client returns S3 client for the minio process. @@ -137,7 +154,7 @@ func (p *Process) WaitReady(ctx context.Context) error { } for { - _, err = adminClient.GetConfig(ctx) + err := adminClient.AddAlias(ctx) if err == nil { return nil } @@ -313,6 +330,17 @@ func EnsureRunning(s *state.State, bucketVol storageDrivers.Volume) (*Process, e miniosMu.Lock() delete(minios, bucketName) miniosMu.Unlock() + + client, err := minioProc.AdminClient() + if err != nil { + l.Error("Error creating MinIO client", logger.Ctx{"err": err}) + return + } + + err = client.RemoveAlias(context.TODO()) + if err != nil { + l.Error("Error with removing alias", logger.Ctx{"err": err}) + } }() // Wait up to 10s for service to become ready. Pass the minioProc.cancel as parent context so that if the @@ -325,6 +353,16 @@ func EnsureRunning(s *state.State, bucketVol storageDrivers.Volume) (*Process, e return nil, fmt.Errorf("Failed connecting to bucket: %w", err) } + client, err := minioProc.AdminClient() + if err != nil { + return nil, fmt.Errorf("Error creating MinIO client: %w", err) + } + + err = client.AddAlias(context.TODO()) + if err != nil { + return nil, fmt.Errorf("%w", err) + } + l.Debug("MinIO bucket ready") // Launch go routine for idle process cleanup. From c062d357bf66b13035ac580722b9bc9675abd1eb Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Sat, 20 Apr 2024 23:53:40 +0200 Subject: [PATCH 2/4] incusd/storage: Switch to use minio's 'mc' client Signed-off-by: Piotr Resztak --- internal/server/storage/backend.go | 38 +++++++++--------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/internal/server/storage/backend.go b/internal/server/storage/backend.go index b8f13ee2d8e..1b7da39887d 100644 --- a/internal/server/storage/backend.go +++ b/internal/server/storage/backend.go @@ -20,7 +20,6 @@ import ( "time" "unicode" - "github.com/minio/madmin-go" "github.com/minio/minio-go/v7" "golang.org/x/sync/errgroup" "gopkg.in/yaml.v2" @@ -4085,14 +4084,7 @@ func (b *backend) recoverMinIOKeys(projectName string, bucketName string, op *op defer ctxCancel() // Export IAM data (response is ZIP file). - iamReader, err := adminClient.ExportIAM(ctx) - if err != nil { - return nil, err - } - - defer iamReader.Close() - - iamBytes, err := io.ReadAll(iamReader) + iamBytes, err := adminClient.ExportIAM(ctx) if err != nil { return nil, err } @@ -4104,7 +4096,7 @@ func (b *backend) recoverMinIOKeys(projectName string, bucketName string, op *op // We are interesed only in a json file that contains service accounts. // Find that file and extract service accounts. - svcAccounts := map[string]madmin.Credentials{} + svcAccounts := map[string]miniod.AddServiceAccountResp{} for _, file := range iamZipReader.File { if file.Name != "iam-assets/svcaccts.json" { continue @@ -4139,7 +4131,12 @@ func (b *backend) recoverMinIOKeys(projectName string, bucketName string, op *op return nil, err } - bucketRole, err := s3.BucketPolicyRole(bucketName, svcAccountInfo.Policy) + jsonBytes, err := json.Marshal(svcAccountInfo.Policy) + if err != nil { + return nil, err + } + + bucketRole, err := s3.BucketPolicyRole(bucketName, string(jsonBytes)) if err != nil { return nil, err } @@ -4228,12 +4225,7 @@ func (b *backend) CreateBucketKey(projectName string, bucketName string, key api return nil, err } - adminCreds, err := adminClient.AddServiceAccount(ctx, madmin.AddServiceAccountReq{ - TargetUser: minioProc.AdminUser(), - Policy: bucketPolicy, - AccessKey: key.AccessKey, - SecretKey: key.SecretKey, - }) + adminCreds, err := adminClient.AddServiceAccount(ctx, minioProc.AdminUser(), key.AccessKey, key.SecretKey, bucketPolicy) if err != nil { return nil, err } @@ -4374,12 +4366,7 @@ func (b *backend) UpdateBucketKey(projectName string, bucketName string, keyName // Delete service account if exists (this allows changing the access key). _ = adminClient.DeleteServiceAccount(ctx, curBucketKey.AccessKey) - newCreds, err := adminClient.AddServiceAccount(ctx, madmin.AddServiceAccountReq{ - TargetUser: minioProc.AdminUser(), - Policy: bucketPolicy, - AccessKey: creds.AccessKey, - SecretKey: creds.SecretKey, - }) + newCreds, err := adminClient.AddServiceAccount(ctx, minioProc.AdminUser(), creds.AccessKey, creds.SecretKey, bucketPolicy) if err != nil { return err } @@ -4389,10 +4376,7 @@ func (b *backend) UpdateBucketKey(projectName string, bucketName string, keyName // service account but a secret key is, *both* the AccessKey and the SecreyKey are randomly // generated, even though it should only have been the AccessKey. // So detect this and update the SecretKey back to what it should have been. - err := adminClient.UpdateServiceAccount(ctx, newCreds.AccessKey, madmin.UpdateServiceAccountReq{ - NewSecretKey: creds.SecretKey, - NewPolicy: bucketPolicy, // Ensure policy is also applied. - }) + err := adminClient.UpdateServiceAccount(ctx, newCreds.AccessKey, creds.SecretKey, bucketPolicy) if err != nil { return err } From 4d415869a8965bbfe9327c6516fba6eefa88fefa Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Sat, 20 Apr 2024 23:54:31 +0200 Subject: [PATCH 3/4] gomod: Update dependencies Signed-off-by: Piotr Resztak --- go.mod | 12 ------------ go.sum | 37 ------------------------------------- 2 files changed, 49 deletions(-) diff --git a/go.mod b/go.mod index 3f7e05e4851..a68043561af 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,6 @@ require ( github.com/mdlayher/netx v0.0.0-20230430222610-7e21880baee8 github.com/mdlayher/vsock v1.2.1 github.com/miekg/dns v1.1.58 - github.com/minio/madmin-go v1.7.5 github.com/minio/minio-go/v7 v7.0.69 github.com/mitchellh/mapstructure v1.5.0 github.com/olekukonko/tablewriter v0.0.5 @@ -81,7 +80,6 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-jose/go-jose/v4 v4.0.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-ole/go-ole v1.3.0 // indirect github.com/google/renameio v1.0.1 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -92,7 +90,6 @@ require ( github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect @@ -105,10 +102,8 @@ require ( github.com/muhlemmer/gu v0.3.1 // indirect github.com/muhlemmer/httpforwarded v0.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.0 // indirect - github.com/philhofer/fwd v1.1.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.52.2 // indirect @@ -119,20 +114,13 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/secure-io/sio-go v0.3.1 // indirect - github.com/shirou/gopsutil/v3 v3.24.3 // indirect - github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.18.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tinylib/msgp v1.1.9 // indirect - github.com/tklauser/go-sysconf v0.3.13 // indirect - github.com/tklauser/numcpus v0.7.0 // indirect github.com/vishvananda/netns v0.0.4 // indirect - github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zitadel/logging v0.6.0 // indirect github.com/zitadel/schema v1.3.0 // indirect go.opentelemetry.io/otel v1.25.0 // indirect diff --git a/go.sum b/go.sum index 1f5ae23285a..91ac9fab874 100644 --- a/go.sum +++ b/go.sum @@ -135,9 +135,6 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= -github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -188,7 +185,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -293,9 +289,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a h1:3Bm7EwfUQUvhNeKIkUct/gl9eod1TcXuj8stxvi/GoI= -github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= github.com/lxc/go-lxc v0.0.0-20230926171149-ccae595aa49e h1:qM376kOMJIIDi5yqcxMzezaA2O+lLybIDSL4o1AEHLI= github.com/lxc/go-lxc v0.0.0-20230926171149-ccae595aa49e/go.mod h1:d7gwEiQlW13OqE5UDJp2JJO78aTiSabSC/jUiVRZSes= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -327,8 +320,6 @@ github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnE github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= -github.com/minio/madmin-go v1.7.5 h1:IF8j2HR0jWc7msiOcy0KJ8EyY7Q3z+j+lsmSDksQm+I= -github.com/minio/madmin-go v1.7.5/go.mod h1:3SO8SROxHN++tF6QxdTii2SSUaYSrr8lnE9EJWjvz0k= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.69 h1:l8AnsQFyY1xiwa/DaQskY4NXSLA2yrGsW5iD9nRPVS0= @@ -372,8 +363,6 @@ github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/peterh/liner v1.2.1/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= -github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -389,9 +378,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= -github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -423,14 +409,6 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/secure-io/sio-go v0.3.1 h1:dNvY9awjabXTYGsTF1PiCySl9Ltofk9GA3VdWlo7rRc= -github.com/secure-io/sio-go v0.3.1/go.mod h1:+xbkjDzPjwh4Axd07pRKSNriS9SCiYksWnZqdnfpQxs= -github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= -github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= -github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= -github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= -github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -474,14 +452,6 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU= -github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= -github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= -github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/vishvananda/netlink v1.2.1-beta.2 h1:Llsql0lnQEbHj0I1OuKyp8otXp0r3q0mPkuhwHfStVs= github.com/vishvananda/netlink v1.2.1-beta.2/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= @@ -493,8 +463,6 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= -github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zitadel/logging v0.6.0 h1:t5Nnt//r+m2ZhhoTmoPX+c96pbMarqJvW1Vq6xFTank= github.com/zitadel/logging v0.6.0/go.mod h1:Y4CyAXHpl3Mig6JOszcV5Rqqsojj+3n7y2F591Mp/ow= github.com/zitadel/oidc/v3 v3.19.0 h1:yNo80fHcDeMtBMIRhcd5oE9bvucE34VZiG8PqbJ4dKU= @@ -530,7 +498,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= @@ -660,7 +627,6 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -684,7 +650,6 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -706,9 +671,7 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 11c6a488e23575a1db9d5ad63a720c8b0175bf82 Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Sun, 21 Apr 2024 16:23:46 +0200 Subject: [PATCH 4/4] github: Download MinIO client Signed-off-by: Piotr Resztak --- .github/workflows/tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5cd598cb6ea..512ddfcb352 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -241,6 +241,11 @@ jobs: curl -sSfL https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20240116160738.0.0_amd64.deb --output /tmp/minio.deb sudo apt-get install /tmp/minio.deb --yes + # Download MinIO client + curl -sSfL https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2024-01-16T16-06-34Z --output /tmp/mc + sudo mv /tmp/mc /usr/local/bin/ + sudo chmod +x /usr/local/bin/mc + # Download latest release of openfga server. mkdir -p "$(go env GOPATH)/bin/" curl -sSfL https://api.github.com/repos/openfga/openfga/releases/latest | jq -r '.assets | .[] | .browser_download_url | select(. | test("_linux_amd64.tar.gz$"))' | xargs -I {} curl -sSfL {} -o openfga.tar.gz