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: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.4
go-version: 1.24.6
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
Expand Down
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
FROM golang:1.15-alpine as builder
FROM golang:1.24.6-alpine as builder

LABEL maintainer="MinIO Inc <[email protected]>"

ENV GOPATH /go
ENV CGO_ENABLED 0
ENV GO111MODULE on
ENV GOPATH=/go
ENV CGO_ENABLED=0
ENV GO111MODULE=on

RUN \
apk add --no-cache git && \
git clone https://github.com/minio/mc && cd mc && \
go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)"
WORKDIR /workspace

RUN apk add --no-cache git

# Copy current source and build
COPY . /workspace

RUN go mod download && \
go build -v -ldflags "$(go run buildscripts/gen-ldflags.go)" -o /go/bin/mc ./

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

ARG TARGETARCH

COPY --from=builder /go/bin/mc /usr/bin/mc
COPY --from=builder /go/mc/CREDITS /licenses/CREDITS
COPY --from=builder /go/mc/LICENSE /licenses/LICENSE
COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE

RUN \
microdnf update --nodocs && \
Expand Down
8 changes: 4 additions & 4 deletions cmd/admin-prometheus-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/console"

jwtgo "github.com/dgrijalva/jwt-go"
jwt "github.com/golang-jwt/jwt/v4"
json "github.com/minio/mc/pkg/colorjson"
yaml "gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -170,13 +170,13 @@ func generatePrometheusConfig(ctx *cli.Context) error {
return err
}

jwt := jwtgo.NewWithClaims(jwtgo.SigningMethodHS512, jwtgo.StandardClaims{
ExpiresAt: UTCNow().Add(defaultPrometheusJWTExpiry).Unix(),
tokenObj := jwt.NewWithClaims(jwt.SigningMethodHS512, jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(UTCNow().Add(defaultPrometheusJWTExpiry)),
Subject: hostConfig.AccessKey,
Issuer: "prometheus",
})

token, err := jwt.SignedString([]byte(hostConfig.SecretKey))
token, err := tokenObj.SignedString([]byte(hostConfig.SecretKey))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-service-restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func mainAdminServiceRestart(ctx *cli.Context) error {
// Print restart progress
printProgress := func() {
if !globalQuiet && !globalJSON {
coloring.Printf(mark)
coloring.Printf("%s", mark)
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/cp-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ loop:
console.Eraseline()
}
errorIf(cpURLs.Error.Trace(cpURLs.SourceContent.URL.String()),
fmt.Sprintf("Failed to copy `%s`.", cpURLs.SourceContent.URL.String()))
"Failed to copy `%s`.", cpURLs.SourceContent.URL.String())
if isErrIgnored(cpURLs.Error) {
cpAllFilesErr = false
continue loop
Expand Down
4 changes: 2 additions & 2 deletions cmd/du-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func du(urlStr string, timeRef time.Time, withVersions bool, depth int, encKeyDB

clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(urlStr), "Failed to summarize disk usage `"+urlStr+"`.")
errorIf(pErr.Trace(urlStr), "Failed to summarize disk usage `%s`.", urlStr)
return 0, exitStatus(globalErrorExitStatus) // End of journey.
}

Expand All @@ -138,7 +138,7 @@ func du(urlStr string, timeRef time.Time, withVersions bool, depth int, encKeyDB
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
continue
}
errorIf(content.Err.Trace(urlStr), "Failed to find disk usage of `"+urlStr+"` recursively.")
errorIf(content.Err.Trace(urlStr), "Failed to find disk usage of `%s` recursively.", urlStr)
return 0, exitStatus(globalErrorExitStatus)
}
if content.URL.String() == targetURL {
Expand Down
2 changes: 1 addition & 1 deletion cmd/legalhold-info.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func showLegalHoldInfo(ctx context.Context, urlStr, versionID string, timeRef ti
lhold, probeErr := newClnt.GetObjectLegalHold(ctx, content.VersionID)
if probeErr != nil {
errorsFound = true
errorIf(probeErr.Trace(content.URL.Path), "Failed to get legal hold information on `"+content.URL.Path+"`")
errorIf(probeErr.Trace(content.URL.Path), "Failed to get legal hold information on `%s`", content.URL.Path)
} else {
if !globalJSON {

Expand Down
4 changes: 2 additions & 2 deletions cmd/legalhold-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func setLegalHold(ctx context.Context, urlStr, versionID string, timeRef time.Ti
if !recursive && !withOlderVersions {
err = clnt.PutObjectLegalHold(ctx, versionID, lhold)
if err != nil {
errorIf(err.Trace(urlStr), "Failed to set legal hold on `"+urlStr+"` successfully")
errorIf(err.Trace(urlStr), "Failed to set legal hold on `%s` successfully", urlStr)
} else {
contentURL := filepath.ToSlash(clnt.GetURL().Path)
key := strings.TrimPrefix(contentURL, prefixPath)
Expand Down Expand Up @@ -144,7 +144,7 @@ func setLegalHold(ctx context.Context, urlStr, versionID string, timeRef time.Ti

probeErr := newClnt.PutObjectLegalHold(ctx, content.VersionID, lhold)
if probeErr != nil {
errorIf(probeErr.Trace(content.URL.Path), "Failed to set legal hold on `"+content.URL.Path+"` successfully")
errorIf(probeErr.Trace(content.URL.Path), "Failed to set legal hold on `%s` successfully", content.URL.Path)
} else {
if !globalJSON {
contentURL := filepath.ToSlash(content.URL.Path)
Expand Down
4 changes: 2 additions & 2 deletions cmd/mb-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func mainMakeBucket(cli *cli.Context) error {
// Instantiate client for URL.
clnt, err := newClient(targetURL)
if err != nil {
errorIf(err.Trace(targetURL), "Invalid target `"+targetURL+"`.")
errorIf(err.Trace(targetURL), "Invalid target `%s`.", targetURL)
cErr = exitStatus(globalErrorExitStatus)
continue
}
Expand All @@ -148,7 +148,7 @@ func mainMakeBucket(cli *cli.Context) error {
case BucketNameTopLevel:
errorIf(err.Trace(targetURL), "Unable to make prefix, please use `mc mb %s/`.", targetURL)
default:
errorIf(err.Trace(targetURL), "Unable to make bucket `"+targetURL+"`.")
errorIf(err.Trace(targetURL), "Unable to make bucket `%s`.", targetURL)
}
cErr = exitStatus(globalErrorExitStatus)
continue
Expand Down
10 changes: 5 additions & 5 deletions cmd/mirror-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) {
case sURLs.SourceContent != nil:
if !isErrIgnored(sURLs.Error) {
errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()),
fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String()))
"Failed to copy `%s`.", sURLs.SourceContent.URL.String())
errDuringMirror = true
}
case sURLs.TargetContent != nil:
// When sURLs.SourceContent is nil, we know that we have an error related to removing
errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()),
fmt.Sprintf("Failed to remove `%s`.", sURLs.TargetContent.URL.String()))
"Failed to remove `%s`.", sURLs.TargetContent.URL.String())
errDuringMirror = true
default:
if sURLs.ErrorCond == differInUnknown {
Expand Down Expand Up @@ -917,14 +917,14 @@ func runMirror(ctx context.Context, cancelMirror context.CancelFunc, srcURL, dst
}
// Bucket only exists in the source, create the same bucket in the destination
if err := newDstClt.MakeBucket(ctx, cli.String("region"), false, withLock); err != nil {
errorIf(err, "Unable to create bucket at `"+newTgtURL+"`.")
errorIf(err, "Unable to create bucket at `%s`.", newTgtURL)
continue
}
if preserve && mirrorBucketsToBuckets {
// object lock configuration set on bucket
if mode != "" {
err = newDstClt.SetObjectLockConfig(ctx, mode, validity, unit)
errorIf(err, "Unable to set object lock config in `"+newTgtURL+"`.")
errorIf(err, "Unable to set object lock config in `%s`.", newTgtURL)
if err != nil && mj.opts.activeActive {
return true
}
Expand All @@ -933,7 +933,7 @@ func runMirror(ctx context.Context, cancelMirror context.CancelFunc, srcURL, dst
}
}
errorIf(copyBucketPolicies(ctx, newSrcClt, newDstClt, isOverwrite),
"Unable to copy bucket policies to `"+newDstClt.GetURL().String()+"`.")
"Unable to copy bucket policies to `%s`.", newDstClt.GetURL().String())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/mv-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (rm *removeManager) readErrors(errorCh <-chan *probe.Error, targetURL strin
go func() {
defer rm.wg.Done()
for pErr := range errorCh {
errorIf(pErr.Trace(targetURL), "Failed to remove in`"+targetURL+"`.")
errorIf(pErr.Trace(targetURL), "Failed to remove in`%s`.", targetURL)
}
}()
}
Expand All @@ -173,7 +173,7 @@ func (rm *removeManager) add(ctx context.Context, targetAlias, targetURL string)
if clientInfo == nil {
client, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(targetURL), "Invalid argument `"+targetURL+"`.")
errorIf(pErr.Trace(targetURL), "Invalid argument `%s`.", targetURL)
return
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/policy-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func runPolicyLinksCmd(args cli.Args, recursive bool) {

// Encode public URL
u, e := url.Parse(content.URL.String())
errorIf(probe.NewError(e), "Unable to parse url `"+content.URL.String()+"`.")
errorIf(probe.NewError(e), "Unable to parse url `%s`.", content.URL.String())
publicURL := u.String()

// Construct the message to be displayed to the user
Expand Down
4 changes: 2 additions & 2 deletions cmd/rb-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func mainRemoveBucket(cliCtx *cli.Context) error {
// Instantiate client for URL.
clnt, err := newClient(targetURL)
if err != nil {
errorIf(err.Trace(targetURL), "Invalid target `"+targetURL+"`.")
errorIf(err.Trace(targetURL), "Invalid target `%s`.", targetURL)
cErr = exitStatus(globalErrorExitStatus)
continue
}
Expand All @@ -214,7 +214,7 @@ func mainRemoveBucket(cliCtx *cli.Context) error {
switch err.ToGoError().(type) {
case BucketNameEmpty:
default:
errorIf(err.Trace(targetURL), "Unable to validate target `"+targetURL+"`.")
errorIf(err.Trace(targetURL), "Unable to validate target `%s`.", targetURL)
cErr = exitStatus(globalErrorExitStatus)
continue

Expand Down
2 changes: 1 addition & 1 deletion cmd/retention-common.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func applyRetention(ctx context.Context, op lockOpType, target, versionID string
}

if !atLeastOneRetentionApplied {
errorIf(errDummy().Trace(clnt.GetURL().String()), "Unable to find any object/version to "+string(op)+" its retention.")
errorIf(errDummy().Trace(clnt.GetURL().String()), "Unable to find any object/version to %s its retention.", string(op))
cErr = exitStatus(globalErrorExitStatus) // Set the exit status.
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/retention-info.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ func (m retentionInfoMessageRecord) String() string {

fmt.Fprintf(&msg, "Mode : ")
if m.Mode == "" {
fmt.Fprintf(&msg, console.Colorize("RetentionNotFound", "NO RETENTION"))
fmt.Fprintf(&msg, "%s", console.Colorize("RetentionNotFound", "NO RETENTION"))
} else {
fmt.Fprintf(&msg, console.Colorize("RetentionSuccess", m.Mode))
fmt.Fprintf(&msg, "%s", console.Colorize("RetentionSuccess", m.Mode))
if !m.Until.IsZero() {
msg.WriteString(", ")
exp := ""
Expand All @@ -222,7 +222,7 @@ func (m retentionInfoMessageRecord) String() string {
prettyDuration := timeDurationToHumanizedDuration(m.Until.Sub(now)).StringShort()
exp = console.Colorize("RetentionSuccess", "expiring in "+prettyDuration)
}
fmt.Fprintf(&msg, exp)
fmt.Fprintf(&msg, "%s", exp)
}
}
fmt.Fprintf(&msg, "\n")
Expand Down
18 changes: 9 additions & 9 deletions cmd/rm-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func removeSingle(url, versionID string, isIncomplete, isFake, isForce, isBypass
case http.StatusBadRequest, http.StatusMethodNotAllowed:
ignoreStatError = true
default:
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
errorIf(pErr.Trace(url), "Failed to remove `%s`.", url)
return exitStatus(globalErrorExitStatus)
}
} else {
Expand All @@ -274,7 +274,7 @@ func removeSingle(url, versionID string, isIncomplete, isFake, isForce, isBypass

// We should not proceed
if ignoreStatError && olderThan != "" || newerThan != "" {
errorIf(pErr.Trace(url), "Unable to stat `"+url+"`.")
errorIf(pErr.Trace(url), "Unable to stat `%s`.", url)
return exitStatus(globalErrorExitStatus)
}

Expand All @@ -298,7 +298,7 @@ func removeSingle(url, versionID string, isIncomplete, isFake, isForce, isBypass
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(url), "Invalid argument `"+url+"`.")
errorIf(pErr.Trace(url), "Invalid argument `%s`.", url)
return exitStatus(globalErrorExitStatus) // End of journey.
}

Expand All @@ -313,7 +313,7 @@ func removeSingle(url, versionID string, isIncomplete, isFake, isForce, isBypass
errorCh := clnt.Remove(ctx, isIncomplete, isRemoveBucket, isBypass, contentCh)
for pErr := range errorCh {
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
errorIf(pErr.Trace(url), "Failed to remove `%s`.", url)
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
Expand All @@ -338,7 +338,7 @@ func listAndRemove(url string, timeRef time.Time, withVersions, isRecursive, isI
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"` recursively.")
errorIf(pErr.Trace(url), "Failed to remove `%s` recursively.", url)
return exitStatus(globalErrorExitStatus) // End of journey.
}
contentCh := make(chan *ClientContent)
Expand All @@ -357,7 +357,7 @@ func listAndRemove(url string, timeRef time.Time, withVersions, isRecursive, isI

for content := range clnt.List(ctx, listOpts) {
if content.Err != nil {
errorIf(content.Err.Trace(url), "Failed to remove `"+url+"` recursively.")
errorIf(content.Err.Trace(url), "Failed to remove `%s` recursively.", url)
switch content.Err.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
Expand Down Expand Up @@ -416,7 +416,7 @@ func listAndRemove(url string, timeRef time.Time, withVersions, isRecursive, isI
case contentCh <- content:
sent = true
case pErr := <-errorCh:
errorIf(pErr.Trace(urlString), "Failed to remove `"+urlString+"`.")
errorIf(pErr.Trace(urlString), "Failed to remove `%s`.", urlString)
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
Expand All @@ -431,7 +431,7 @@ func listAndRemove(url string, timeRef time.Time, withVersions, isRecursive, isI

close(contentCh)
for pErr := range errorCh {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"` recursively.")
errorIf(pErr.Trace(url), "Failed to remove `%s` recursively.", url)
switch pErr.ToGoError().(type) {
case PathInsufficientPermission:
// Ignore Permission error.
Expand All @@ -441,7 +441,7 @@ func listAndRemove(url string, timeRef time.Time, withVersions, isRecursive, isI
}

if !atLeastOneObjectFound {
errorIf(errDummy().Trace(url), "No object/version found to be removed in `"+url+"`.")
errorIf(errDummy().Trace(url), "No object/version found to be removed in `%s`.", url)
return exitStatus(globalErrorExitStatus)
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/sql-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func mainSQL(cliCtx *cli.Context) error {
writeHdr := true
for _, url := range URLs {
if _, targetContent, err := url2Stat(ctx, url, "", false, encKeyDB, time.Time{}); err != nil {
errorIf(err.Trace(url), "Unable to run sql for "+url+".")
errorIf(err.Trace(url), "Unable to run sql for %s.", url)
continue
} else if !targetContent.Type.IsDir() {
if writeHdr {
Expand All @@ -469,13 +469,13 @@ func mainSQL(cliCtx *cli.Context) error {
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, err := newClientFromAlias(targetAlias, targetURL)
if err != nil {
errorIf(err.Trace(url), "Unable to initialize target `"+url+"`.")
errorIf(err.Trace(url), "Unable to initialize target `%s`.", url)
continue
}

for content := range clnt.List(ctx, ListOptions{Recursive: cliCtx.Bool("recursive"), ShowDir: DirNone}) {
if content.Err != nil {
errorIf(content.Err.Trace(url), "Unable to list on target `"+url+"`.")
errorIf(content.Err.Trace(url), "Unable to list on target `%s`.", url)
continue
}
if writeHdr {
Expand Down
Loading
Loading