Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump dependencies #745

Merged
merged 2 commits into from
Aug 31, 2024
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
14 changes: 11 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ concurrency:
group: linter-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
# Optional: allow write access to checks to allow the action to annotate code in the PR.
checks: write

jobs:
golangci:
name: lint
Expand All @@ -14,10 +22,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
go-version-file: go.mod
cache-dependency-path: go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.56
version: v1.60.3
args: --config .golangci.yml
6 changes: 3 additions & 3 deletions cmd/extras/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package extras

import (
"encoding/json"
"fmt"
"errors"
"strings"

"github.com/fatih/color"
Expand Down Expand Up @@ -37,7 +37,7 @@ func newDigestCommand() *cli.Command {
func generateDigest(ctx *cli.Context) error {
input := ctx.String("input")
if input == "" {
return fmt.Errorf(color.RedString("input is empty"))
return errors.New(color.RedString("input is empty"))
}

digestType := strings.ToUpper(ctx.String("type"))
Expand All @@ -49,7 +49,7 @@ func generateDigest(ctx *cli.Context) error {

manifestContent, err := json.Marshal([]byte(input))
if err != nil {
return fmt.Errorf(color.RedString("generateDigest: ERR_MARSHAL_INDENT: %s", err))
return errors.New(color.RedString("generateDigest: ERR_MARSHAL_INDENT: %s", err))
}

var inputDigest oci_digest.Digest
Expand Down
15 changes: 8 additions & 7 deletions cmd/registry/registry.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package registry

import (
"fmt"
"errors"

"github.com/fatih/color"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/urfave/cli/v2"

user_api "github.com/containerish/OpenRegistry/api/users"
"github.com/containerish/OpenRegistry/auth"
Expand All @@ -23,10 +28,6 @@ import (
"github.com/containerish/OpenRegistry/store/v1/webauthn"
"github.com/containerish/OpenRegistry/telemetry"
"github.com/containerish/OpenRegistry/telemetry/otel"
"github.com/fatih/color"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/urfave/cli/v2"
)

// const CategoryOpenRegistry = "OpenRegistry"
Expand Down Expand Up @@ -62,7 +63,7 @@ func RunRegistryServer(ctx *cli.Context) error {
configPath := ctx.String("config")
cfg, err := config.ReadYamlConfig(configPath)
if err != nil {
return fmt.Errorf(color.RedString("error reading cfg file: %s", err.Error()))
return errors.New(color.RedString("error reading cfg file: %s", err.Error()))
}

logger := telemetry.ZeroLogger(cfg.Environment, cfg.Telemetry)
Expand Down Expand Up @@ -107,7 +108,7 @@ func RunRegistryServer(ctx *cli.Context) error {
}

if err = buildHTTPServer(cfg, baseRouter); err != nil {
return fmt.Errorf(color.RedString("error initialising OpenRegistry Server: %s", err))
return errors.New(color.RedString("error initialising OpenRegistry Server: %s", err))
}

return nil
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"crypto/rsa"
"errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -259,7 +260,7 @@ func translateError(err error, trans ut.Translator) error {
return err
}
for _, e := range validatorErrs {
translatedErr = multierror.Append(translatedErr, fmt.Errorf(e.Translate(trans)))
translatedErr = multierror.Append(translatedErr, errors.New(e.Translate(trans)))
}

return translatedErr
Expand Down
3 changes: 2 additions & 1 deletion dfs/dfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"

s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/store/v1/types"
)
Expand All @@ -18,7 +19,7 @@ type DFS interface {
uploadId string,
key string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error)
Expand Down
10 changes: 7 additions & 3 deletions dfs/filebase/filebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
oci_digest "github.com/opencontainers/go-digest"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
"github.com/containerish/OpenRegistry/store/v1/types"
core_types "github.com/containerish/OpenRegistry/types"
oci_digest "github.com/opencontainers/go-digest"
)

type filebase struct {
Expand Down Expand Up @@ -64,7 +65,7 @@ func (fb *filebase) UploadPart(
uploadId string,
layerKey string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand All @@ -78,7 +79,7 @@ func (fb *filebase) UploadPart(
ChecksumSHA256: aws.String(digest),
ContentLength: &contentLength,
Key: &layerKey,
PartNumber: aws.Int32(int32(partNumber)),
PartNumber: aws.Int32(partNumber),
UploadId: &uploadId,
}

Expand Down Expand Up @@ -208,12 +209,15 @@ func (fb *filebase) Download(ctx context.Context, path string) (io.ReadCloser, e

return resp.Body, nil
}

func (fb *filebase) DownloadDir(dfsLink, dir string) error {
return nil
}

func (fb *filebase) List(path string) ([]*types.Metadata, error) {
return nil, nil
}

func (fb *filebase) AddImage(ns string, mf, l map[string][]byte) (string, error) {
return "", nil
}
Expand Down
11 changes: 6 additions & 5 deletions dfs/ipfs/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ import (
hexmap "github.com/alphadose/haxmap"
"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
"github.com/containerish/OpenRegistry/store/v1/types"
"github.com/fatih/color"
"github.com/google/uuid"
boxo_files "github.com/ipfs/boxo/files"
boxo_path "github.com/ipfs/boxo/path"
"github.com/ipfs/kubo/client/rpc"
"github.com/multiformats/go-multiaddr"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
"github.com/containerish/OpenRegistry/store/v1/types"
)

const (
Expand Down Expand Up @@ -112,7 +113,7 @@ func (ipfs *ipfsP2p) UploadPart(
uploadId string,
layerKey string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand Down Expand Up @@ -151,7 +152,7 @@ func (ipfs *ipfsP2p) UploadPart(

return s3types.CompletedPart{
ChecksumSHA256: &digest,
PartNumber: aws.Int32(int32(partNumber)),
PartNumber: aws.Int32(partNumber),
}, nil
}

Expand Down
14 changes: 7 additions & 7 deletions dfs/mock/memMappedSystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import (

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/fatih/color"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/spf13/afero"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
types "github.com/containerish/OpenRegistry/store/v1/types"
"github.com/containerish/OpenRegistry/telemetry"
core_types "github.com/containerish/OpenRegistry/types"
"github.com/fatih/color"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/spf13/afero"
)

type memMappedMockStorage struct {
Expand Down Expand Up @@ -70,7 +71,7 @@ func (ms *memMappedMockStorage) UploadPart(
uploadId string,
layerKey string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand All @@ -91,7 +92,7 @@ func (ms *memMappedMockStorage) UploadPart(
return s3types.CompletedPart{
ChecksumCRC32: &digest,
ChecksumCRC32C: &layerKey,
PartNumber: aws.Int32(int32(partNumber)),
PartNumber: aws.Int32(partNumber),
}, nil
}

Expand Down Expand Up @@ -175,7 +176,6 @@ func (ms *memMappedMockStorage) Metadata(layer *types.ContainerImageLayer) (*typ
DFSLink: identifier,
ContentLength: int(stat.Size()),
}, nil

}

func (ms *memMappedMockStorage) GetUploadProgress(identifier, uploadID string) (*types.ObjectMetadata, error) {
Expand Down
17 changes: 8 additions & 9 deletions dfs/mock/mockFileSystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ import (

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
types "github.com/containerish/OpenRegistry/store/v1/types"
"github.com/containerish/OpenRegistry/telemetry"
core_types "github.com/containerish/OpenRegistry/types"
"github.com/fatih/color"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/spf13/afero"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
types "github.com/containerish/OpenRegistry/store/v1/types"
"github.com/containerish/OpenRegistry/telemetry"
core_types "github.com/containerish/OpenRegistry/types"
)

type fileBasedMockStorage struct {
Expand Down Expand Up @@ -82,7 +83,7 @@ func (ms *fileBasedMockStorage) UploadPart(
uploadId string,
layerKey string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand All @@ -104,7 +105,7 @@ func (ms *fileBasedMockStorage) UploadPart(
return s3types.CompletedPart{
ChecksumCRC32: &digest,
ChecksumCRC32C: &layerKey,
PartNumber: aws.Int32(int32(partNumber)),
PartNumber: aws.Int32(partNumber),
}, nil
}

Expand Down Expand Up @@ -141,7 +142,6 @@ func (ms *fileBasedMockStorage) Upload(ctx context.Context, identifier, digest s
}

func (ms *fileBasedMockStorage) Download(ctx context.Context, path string) (io.ReadCloser, error) {

fd, err := ms.fs.Open(path)
if err != nil {
return nil, err
Expand Down Expand Up @@ -192,7 +192,6 @@ func (ms *fileBasedMockStorage) Metadata(layer *types.ContainerImageLayer) (*typ
DFSLink: identifier,
ContentLength: int(stat.Size()),
}, nil

}

func (ms *fileBasedMockStorage) GetUploadProgress(identifier, uploadID string) (*types.ObjectMetadata, error) {
Expand Down
7 changes: 4 additions & 3 deletions dfs/storj/storj.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
oci_digest "github.com/opencontainers/go-digest"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
"github.com/containerish/OpenRegistry/store/v1/types"
core_types "github.com/containerish/OpenRegistry/types"
oci_digest "github.com/opencontainers/go-digest"
)

type storj struct {
Expand Down Expand Up @@ -62,7 +63,7 @@ func (sj *storj) UploadPart(
uploadId string,
layerKey string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand All @@ -76,7 +77,7 @@ func (sj *storj) UploadPart(
ChecksumSHA256: aws.String(digest),
ContentLength: &contentLength,
Key: &layerKey,
PartNumber: aws.Int32(int32(partNumber)),
PartNumber: aws.Int32(partNumber),
UploadId: &uploadId,
}

Expand Down
10 changes: 5 additions & 5 deletions dfs/storj/uplink/uplink.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/fatih/color"
"storj.io/uplink"
"storj.io/uplink/edge"

"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
"github.com/containerish/OpenRegistry/store/v1/types"
core_types "github.com/containerish/OpenRegistry/types"
"github.com/fatih/color"
"storj.io/uplink"
"storj.io/uplink/edge"
)

type storjUplink struct {
Expand Down Expand Up @@ -70,7 +71,7 @@ func (u *storjUplink) UploadPart(
uploadId string,
key string,
digest string,
partNumber int64,
partNumber int32,
content io.ReadSeeker,
contentLength int64,
) (s3types.CompletedPart, error) {
Expand Down Expand Up @@ -122,7 +123,6 @@ func (u *storjUplink) CompleteMultipartUpload(
"digest": finalDigest,
},
})

if err != nil {
return "", fmt.Errorf("ERR_STORJ_UPLINK_COMMIT_UPLOAD: %w", err)
}
Expand Down
Loading
Loading