Skip to content

Commit

Permalink
Merge branch 'master' into delmarker-expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Oct 4, 2024
2 parents 9c2a765 + 07eeb10 commit 40670b9
Show file tree
Hide file tree
Showing 244 changed files with 6,371 additions and 3,466 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
go-version: [1.22.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
GO111MODULE: on
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
make
make test-race
make verify
make crosscompile
./functional-tests.sh
vetchecks: # Run vet checks against one version.
env:
CGO_ENABLED: 0
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Checkout code
uses: actions/checkout@v2
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.9
check-latest: true
go-version: 1.22.5
- name: Get official govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
shell: bash
Expand Down
7 changes: 1 addition & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ linters:
- typecheck
- goimports
- misspell
- staticcheck
- govet
- revive
- ineffassign
Expand All @@ -19,9 +20,6 @@ linters-settings:
misspell:
locale: US

gofumpt:
lang-version: "1.17"

# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false
Expand All @@ -32,6 +30,3 @@ issues:
- instead of using struct literal
- should have a package comment
- error strings should not be capitalized or end with punctuation or a newline

service:
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
1,291 changes: 827 additions & 464 deletions CREDITS

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as build
FROM golang:1.22-alpine as build

LABEL maintainer="MinIO Inc <dev@min.io>"

Expand All @@ -19,4 +19,4 @@ COPY --from=build /go/CREDITS /licenses/CREDITS
COPY --from=build /go/LICENSE /licenses/LICENSE
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT ["mc"]
ENTRYPOINT ["mc"]
2 changes: 1 addition & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 registry.access.redhat.com/ubi9/ubi-minimal:latest as build
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS build

RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.release.fips
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 registry.access.redhat.com/ubi9/ubi-minimal:latest as build
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS build

RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.release.old_cpu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 registry.access.redhat.com/ubi8/ubi-minimal:latest as build
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS build

RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes

Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ GOOS := $(shell go env GOOS)
VERSION ?= $(shell git describe --tags)
TAG ?= "minio/mc:$(VERSION)"

GOLANGCI_DIR = .bin/golangci/$(GOLANGCI_VERSION)
GOLANGCI = $(GOLANGCI_DIR)/golangci-lint

all: build

checks:
Expand All @@ -16,9 +19,8 @@ checks:

getdeps:
@mkdir -p ${GOPATH}/bin
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOLANGCI_DIR)
@echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@latest
@echo "Installing staticheck" && go install honnef.co/go/tools/cmd/staticcheck@latest

crosscompile:
@(env bash $(PWD)/buildscripts/cross-compile.sh)
Expand All @@ -32,10 +34,13 @@ vet:
@echo "Running $@"
@GO111MODULE=on go vet github.com/minio/mc/...

lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes
@echo "Running $@ check"
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml --fix

lint: getdeps
@echo "Running $@ check"
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
@GO111MODULE=on ${GOPATH}/bin/staticcheck -tests=false -checks="all,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022,-ST1023,-ST1005" ./...
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml

# Builds mc, runs the verifiers then runs the tests.
check: test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ mc.exe --help
```

## Install from Source
Source installation is only intended for developers and advanced users. If you do not have a working Golang environment, please follow [How to install Golang](https://golang.org/doc/install). Minimum version required is [go1.17](https://golang.org/dl/#stable)
Source installation is only intended for developers and advanced users. If you do not have a working Golang environment, please follow [How to install Golang](https://golang.org/doc/install). Minimum version required is [go1.22](https://golang.org/dl/#stable)

```sh
go install github.com/minio/mc@latest
Expand Down
94 changes: 94 additions & 0 deletions cmd/admin-accesskey-create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cmd

import (
"github.com/minio/cli"
)

var adminAccesskeyCreateFlags = []cli.Flag{
cli.StringFlag{
Name: "access-key",
Usage: "set an access key for the account",
},
cli.StringFlag{
Name: "secret-key",
Usage: "set a secret key for the account",
},
cli.StringFlag{
Name: "policy",
Usage: "path to a JSON policy file",
},
cli.StringFlag{
Name: "name",
Usage: "friendly name for the account",
},
cli.StringFlag{
Name: "description",
Usage: "description for the account",
},
cli.StringFlag{
Name: "expiry-duration",
Usage: "duration before the access key expires",
},
cli.StringFlag{
Name: "expiry",
Usage: "expiry date for the access key",
},
}

var adminAccesskeyCreateCmd = cli.Command{
Name: "create",
Usage: "create access key pairs for users",
Action: mainAdminAccesskeyCreate,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeyCreateFlags, globalFlags...),
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Create a new access key pair with the same policy as the authenticated user
{{.Prompt}} {{.HelpName}} myminio/
2. Create a new access key pair with custom access key and secret key
{{.Prompt}} {{.HelpName}} myminio/ --access-key myaccesskey --secret-key mysecretkey
3. Create a new access key pair for user 'tester' that expires in 1 day
{{.Prompt}} {{.HelpName}} myminio/ tester --expiry-duration 24h
4. Create a new access key pair for authenticated user that expires on 2025-01-01
{{.Prompt}} {{.HelpName}} --expiry 2025-01-01
5. Create a new access key pair for user 'tester' with a custom policy
{{.Prompt}} {{.HelpName}} myminio/ tester --policy /path/to/policy.json
6. Create a new access key pair for user 'tester' with a custom name and description
{{.Prompt}} {{.HelpName}} myminio/ tester --name "Tester's Access Key" --description "Access key for tester"
`,
}

func mainAdminAccesskeyCreate(ctx *cli.Context) error {
return commonAccesskeyCreate(ctx, false)
}
48 changes: 48 additions & 0 deletions cmd/admin-accesskey-disable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cmd

import (
"github.com/minio/cli"
)

var adminAccesskeyDisableCmd = cli.Command{
Name: "disable",
Usage: "disable an access key",
Action: mainAdminAccesskeyDisable,
Before: setGlobalsFromContext,
Flags: globalFlags,
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Disable access key
{{.Prompt}} {{.HelpName}} myminio myaccesskey
`,
}

func mainAdminAccesskeyDisable(ctx *cli.Context) error {
return enableDisableAccesskey(ctx, false)
}
77 changes: 77 additions & 0 deletions cmd/admin-accesskey-edit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cmd

import (
"github.com/minio/cli"
)

var adminAccesskeyEditFlags = []cli.Flag{
cli.StringFlag{
Name: "secret-key",
Usage: "set a secret key for the account",
},
cli.StringFlag{
Name: "policy",
Usage: "path to a JSON policy file",
},
cli.StringFlag{
Name: "name",
Usage: "friendly name for the account",
},
cli.StringFlag{
Name: "description",
Usage: "description for the account",
},
cli.StringFlag{
Name: "expiry-duration",
Usage: "duration before the access key expires",
},
cli.StringFlag{
Name: "expiry",
Usage: "expiry date for the access key",
},
}

var adminAccesskeyEditCmd = cli.Command{
Name: "edit",
Usage: "edit existing access keys",
Action: mainAdminAccesskeyEdit,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeyEditFlags, globalFlags...),
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Change the secret key for the access key "testkey"
{{.Prompt}} {{.HelpName}} myminio/ testkey --secret-key 'xxxxxxx'
2. Change the expiry duration for the access key "testkey"
{{.Prompt}} {{.HelpName}} myminio/ testkey ---expiry-duration 24h
`,
}

func mainAdminAccesskeyEdit(ctx *cli.Context) error {
return commonAccesskeyEdit(ctx)
}
Loading

0 comments on commit 40670b9

Please sign in to comment.