Skip to content

Commit

Permalink
✨ Add support oss (#298)
Browse files Browse the repository at this point in the history
* ✨ Remove offset in storage read api

* ✨ Add support oss
  • Loading branch information
tosone authored Feb 8, 2024
1 parent 546d180 commit be5fde3
Show file tree
Hide file tree
Showing 27 changed files with 584 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
node: ["18"]
node: ["20"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.21"]
node: ["18"]
go: ["1.22"]
node: ["20"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/local-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.21"]
node: ["18"]
go: ["1.22"]
node: ["20"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down
42 changes: 33 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.21"]
node: ["18"]
go: ["1.22"]
node: ["20"]
services:
mysql:
image: mysql:8.0
Expand Down Expand Up @@ -76,6 +76,10 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_SQLITE }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_SQLITE }}
run: |
CI_DATABASE_TYPE=sqlite3 go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
Expand All @@ -84,8 +88,12 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_SQLITE }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_SQLITE }}
run: |
CI_DATABASE_TYPE=sqlite3 go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos"`
CI_DATABASE_TYPE=sqlite3 go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -96,8 +104,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.21"]
node: ["18"]
go: ["1.22"]
node: ["20"]
services:
mysql:
image: mysql:8.0
Expand Down Expand Up @@ -157,6 +165,10 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_POSTGRESQL }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_POSTGRESQL }}
run: |
CI_DATABASE_TYPE=postgresql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
Expand All @@ -165,8 +177,12 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_POSTGRESQL }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_POSTGRESQL }}
run: |
CI_DATABASE_TYPE=postgresql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos"`
CI_DATABASE_TYPE=postgresql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -178,8 +194,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.21"]
node: ["18"]
go: ["1.22"]
node: ["20"]
services:
mysql:
image: mysql:8.0
Expand Down Expand Up @@ -239,6 +255,10 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_MYSQL }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_MYSQL }}
run: |
CI_DATABASE_TYPE=mysql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"`
- name: Run tests
Expand All @@ -247,8 +267,12 @@ jobs:
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_MYSQL }}
COS_AK: ${{ secrets.COS_AK }}
COS_SK: ${{ secrets.COS_SK }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_AK: ${{ secrets.OSS_AK }}
OSS_SK: ${{ secrets.OSS_SK }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET_MYSQL }}
run: |
CI_DATABASE_TYPE=mysql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos"`
CI_DATABASE_TYPE=mysql go test -tags "timetzdata,exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp" -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks" | grep -v "pkg/storage/cos" | grep -v "pkg/storage/oss"`
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/go-sigma/sigma/test.yml?style=for-the-badge) ![Codecov](https://img.shields.io/codecov/c/github/go-sigma/sigma?style=for-the-badge) ![GitHub repo size](https://img.shields.io/github/repo-size/go-sigma/sigma?style=for-the-badge)

Sigma is an image registry that is extremely easy to deploy and maintain. and it adheres to the interface standards defined by the [OCI Distribution Specification 1.1](https://github.com/opencontainers/distribution-spec/tree/v1.1.0-rc4). It can also support any other client programs that follow the interface definition of the OCI Distribution Specification, such as [oras](https://github.com/oras-project/oras), [apptainer](https://github.com/apptainer/apptainer), [helm](https://github.com/helm/helm), and [nerdctl](https://github.com/containerd/nerdctl).
Sigma is an image registry that is extremely easy to deploy and maintain, and it adheres to the interface standards defined by the [OCI Distribution Specification 1.1](https://github.com/opencontainers/distribution-spec/tree/v1.1.0-rc4), it can also support any other client programs that follow the interface definition of the OCI Distribution Specification, such as [oras](https://github.com/oras-project/oras), [apptainer](https://github.com/apptainer/apptainer), [helm](https://github.com/helm/helm), and [nerdctl](https://github.com/containerd/nerdctl).

## Demo Server

Expand Down
8 changes: 4 additions & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOLANG_VERSION=1.21.6-alpine3.18
ARG NODE_VERSION=18-alpine3.18
ARG ALPINE_VERSION=3.18
ARG GOLANG_VERSION=1.22.0-alpine3.19
ARG NODE_VERSION=20-alpine3.19
ARG ALPINE_VERSION=3.19

FROM --platform=$BUILDPLATFORM node:${NODE_VERSION} as web-builder

Expand Down Expand Up @@ -33,7 +33,7 @@ RUN set -eux && \
FROM alpine:${ALPINE_VERSION} as trivy

ARG USE_MIRROR=false
ARG TRIVY_VERSION=0.48.3
ARG TRIVY_VERSION=0.49.0
ARG ORAS_VERSION=1.0.0
ARG TARGETOS TARGETARCH

Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOLANG_VERSION=1.21.6-alpine3.18
ARG GOLANG_VERSION=1.22.0-alpine3.19
ARG BUILDKIT_VERSION=v0.12.4-rootless
ARG ALPINE_VERSION=3.18
ARG ALPINE_VERSION=3.19

FROM alpine:${ALPINE_VERSION} as cosign

Expand Down
8 changes: 4 additions & 4 deletions build/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOLANG_VERSION=1.21.6-bookworm
ARG NODE_VERSION=18-alpine3.18
ARG ALPINE_VERSION=3.18
ARG GOLANG_VERSION=1.22.0-bookworm
ARG NODE_VERSION=20-alpine3.19
ARG ALPINE_VERSION=3.19
ARG DEBIAN_VERSION=bookworm-slim

FROM --platform=$BUILDPLATFORM node:${NODE_VERSION} as web-builder
Expand Down Expand Up @@ -34,7 +34,7 @@ RUN set -eux && \
FROM alpine:${ALPINE_VERSION} as trivy

ARG USE_MIRROR=false
ARG TRIVY_VERSION=0.48.3
ARG TRIVY_VERSION=0.49.0
ARG ORAS_VERSION=1.0.0
ARG TARGETOS TARGETARCH

Expand Down
5 changes: 5 additions & 0 deletions conf/config-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ storage:
region: cn-north-1
bucket: sigma
forcePathStyle: true
oss:
ak: sigma
sk: sigma-sigma
endpoint: http://127.0.0.1:9000
forcePathStyle: true

# Notice: the tag never update after the first pulled from remote registry, unless you delete the image and pull again.
proxy:
Expand Down
44 changes: 23 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ require (
github.com/alicebob/miniredis/v2 v2.31.1
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/anchore/syft v0.101.0
github.com/aquasecurity/trivy v0.48.3
github.com/aws/aws-sdk-go v1.50.8
github.com/aquasecurity/trivy v0.49.0
github.com/aws/aws-sdk-go v1.50.13
github.com/bytedance/json v0.0.0-20190516032711-0d89175f1949
github.com/caarlos0/env/v9 v9.0.0
github.com/casbin/casbin/v2 v2.81.0
github.com/casbin/casbin/v2 v2.82.0
github.com/casbin/gorm-adapter/v3 v3.20.0
github.com/containers/podman/v4 v4.9.2
github.com/deckarep/golang-set/v2 v2.6.0
Expand Down Expand Up @@ -44,38 +44,38 @@ require (
github.com/labstack/echo/v4 v4.11.4
github.com/matoous/go-nanoid v1.5.0
github.com/matoous/go-nanoid/v2 v2.0.0
github.com/mattn/go-sqlite3 v1.14.21
github.com/mattn/go-sqlite3 v1.14.22
github.com/mholt/archiver/v3 v3.5.1
github.com/moby/buildkit v0.12.5
github.com/opencontainers/distribution-spec/specs-go v0.0.0-20240127010305-05cf62402d05
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc6
github.com/redis/go-redis/v9 v9.4.0
github.com/robfig/cron/v3 v3.0.1
github.com/rs/zerolog v1.31.0
github.com/rs/zerolog v1.32.0
github.com/sigstore/cosign/v2 v2.2.3
github.com/smartystreets/goconvey v1.8.1
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/swaggo/echo-swagger v1.4.1
github.com/swaggo/swag v1.16.2
github.com/swaggo/swag v1.16.3
github.com/tencentyun/cos-go-sdk-v5 v0.7.46
github.com/tidwall/gjson v1.17.0
github.com/wagslane/go-password-validator v0.3.0
github.com/xanzy/go-gitlab v0.96.0
github.com/xanzy/go-gitlab v0.97.0
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/net v0.20.0
golang.org/x/crypto v0.19.0
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.16.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.2
gorm.io/driver/postgres v1.5.4
gorm.io/driver/sqlite v1.5.4
gorm.io/driver/mysql v1.5.4
gorm.io/driver/postgres v1.5.6
gorm.io/driver/sqlite v1.5.5
gorm.io/gen v0.3.25
gorm.io/gorm v1.25.6
gorm.io/gorm v1.25.7
gorm.io/plugin/dbresolver v1.5.0
gorm.io/plugin/soft_delete v1.2.1
k8s.io/api v0.29.1
Expand Down Expand Up @@ -119,7 +119,7 @@ require (
github.com/clbanning/mxj v1.8.4 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/cgroups/v3 v3.0.2 // indirect
github.com/containerd/containerd v1.7.11 // indirect
github.com/containerd/containerd v1.7.12 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
Expand All @@ -144,7 +144,7 @@ require (
github.com/disiqueira/gotree/v3 v3.0.2 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/docker/go-connections v0.4.1-0.20231031175723-0b8c1f4e07a0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
Expand Down Expand Up @@ -260,6 +260,7 @@ require (
github.com/moby/sys/mountinfo v0.7.1 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand All @@ -276,6 +277,7 @@ require (
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect
github.com/package-url/packageurl-go v0.1.2 // indirect
github.com/pborman/indent v1.2.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
Expand All @@ -291,7 +293,7 @@ require (
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/samber/lo v1.39.0 // indirect
github.com/sassoftware/relic v7.2.1+incompatible // indirect
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect
github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect
Expand Down Expand Up @@ -346,8 +348,8 @@ require (
go.uber.org/zap v1.26.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
Expand All @@ -367,9 +369,9 @@ require (
gorm.io/datatypes v1.2.0 // indirect
gorm.io/driver/sqlserver v1.5.1 // indirect
gorm.io/hints v1.1.2 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/klog/v2 v2.120.0 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect
modernc.org/libc v1.37.6 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
Expand Down
Loading

0 comments on commit be5fde3

Please sign in to comment.