Skip to content

Commit

Permalink
Merge branch 'goharbor:main' into support_acr_ee
Browse files Browse the repository at this point in the history
  • Loading branch information
njucjc committed Dec 11, 2023
2 parents efd7515 + aa1f79c commit ef846ab
Show file tree
Hide file tree
Showing 39 changed files with 615 additions and 466 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/CI.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
timeout-minutes: 100
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
timeout-minutes: 100
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
timeout-minutes: 100
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
timeout-minutes: 100
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down Expand Up @@ -266,7 +266,7 @@ jobs:
timeout-minutes: 100
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-package.yml
Expand Up @@ -16,15 +16,15 @@ jobs:
- ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: 'google-github-actions/auth@v1'
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- uses: google-github-actions/setup-gcloud@v1
with:
version: '430.0.0'
- run: gcloud info
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/conformance_test.yml
Expand Up @@ -20,13 +20,13 @@ jobs:
- uses: actions/checkout@v3
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: google-github-actions/auth@v1
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- uses: google-github-actions/setup-gcloud@v1
- run: gcloud info
- name: Set up Go 1.21
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.21.4
id: go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Expand Up @@ -19,7 +19,7 @@ jobs:
echo "PRE_TAG=$(echo $release | jq -r '.body' | jq -r '.preTag')" >> $GITHUB_ENV
echo "BRANCH=$(echo $release | jq -r '.target_commitish')" >> $GITHUB_ENV
echo "PRERELEASE=$(echo $release | jq -r '.prerelease')" >> $GITHUB_ENV
- uses: 'google-github-actions/auth@v1'
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- uses: google-github-actions/setup-gcloud@v1
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -103,12 +103,12 @@ PKGVERSIONTAG=dev
PREPARE_VERSION_NAME=versions

#versions
REGISTRYVERSION=v2.8.2-patch-redis
REGISTRYVERSION=v2.8.3-patch-redis
TRIVYVERSION=v0.47.0
TRIVYADAPTERVERSION=v0.30.19

# version of registry for pulling the source code
REGISTRY_SRC_TAG=v2.8.2
REGISTRY_SRC_TAG=v2.8.3

# dependency binaries
REGISTRYURL=https://storage.googleapis.com/harbor-builds/bin/registry/release-${REGISTRYVERSION}/registry
Expand Down
2 changes: 1 addition & 1 deletion api/v2.0/swagger.yaml
Expand Up @@ -6240,7 +6240,7 @@ parameters:
repositoryName:
name: repository_name
in: path
description: The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
description: The name of the repository. If it contains slash, encode it twice over with URL encoding. e.g. a/b -> a%2Fb -> a%252Fb
required: true
type: string
reference:
Expand Down
Expand Up @@ -351,7 +351,7 @@ log:


#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version: 2.9.0
_version: 2.10.0
{% if external_database is defined %}
# Uncomment external_database if using external database.
external_database:
Expand Down
45 changes: 21 additions & 24 deletions make/photon/registry/redis.patch
@@ -1,19 +1,19 @@
diff --git a/configuration/configuration.go b/configuration/configuration.go
index dd315485..a3e0818e 100644
index 7076df85d4..3e74330321 100644
--- a/configuration/configuration.go
+++ b/configuration/configuration.go
@@ -168,6 +168,9 @@ type Configuration struct {
// Addr specifies the the redis instance available to the application.
Addr string `yaml:"addr,omitempty"`

+ // SentinelMasterSet specifies the the redis sentinel master set name.
+ SentinelMasterSet string `yaml:"sentinelMasterSet,omitempty"`
+
// Password string to use when making a connection.
Password string `yaml:"password,omitempty"`

diff --git a/registry/handlers/app.go b/registry/handlers/app.go
index 8a30bd4d..4e9cec34 100644
index bf56cea22a..4a7cee9a2e 100644
--- a/registry/handlers/app.go
+++ b/registry/handlers/app.go
@@ -3,6 +3,7 @@ package handlers
Expand All @@ -24,19 +24,18 @@ index 8a30bd4d..4e9cec34 100644
"expvar"
"fmt"
"math"
@@ -16,6 +17,8 @@ import (
@@ -16,6 +17,7 @@ import (
"strings"
"time"

+ "github.com/FZambia/sentinel"
+
"github.com/distribution/reference"
"github.com/docker/distribution"
"github.com/docker/distribution/configuration"
dcontext "github.com/docker/distribution/context"
@@ -499,6 +502,44 @@ func (app *App) configureRedis(configuration *configuration.Configuration) {
@@ -499,6 +501,45 @@ func (app *App) configureRedis(configuration *configuration.Configuration) {
return
}

+ var getRedisAddr func() (string, error)
+ var testOnBorrow func(c redis.Conn, t time.Time) error
+ if configuration.Redis.SentinelMasterSet != "" {
Expand Down Expand Up @@ -75,13 +74,14 @@ index 8a30bd4d..4e9cec34 100644
+ return err
+ }
+ }
+
pool := &redis.Pool{
Dial: func() (redis.Conn, error) {
// TODO(stevvooe): Yet another use case for contextual timing.
@@ -514,8 +555,11 @@ func (app *App) configureRedis(configuration *configuration.Configuration) {
}
}

- conn, err := redis.DialTimeout("tcp",
- configuration.Redis.Addr,
+ redisAddr, err := getRedisAddr()
Expand Down Expand Up @@ -112,10 +112,10 @@ index 8a30bd4d..4e9cec34 100644
+ TestOnBorrow: testOnBorrow,
+ Wait: false, // if a connection is not available, proceed without cache.
}

app.redis = pool
diff --git a/registry/handlers/app_test.go b/registry/handlers/app_test.go
index 60a57e6c..8a644d83 100644
index 60a57e6c15..8a644d83d8 100644
--- a/registry/handlers/app_test.go
+++ b/registry/handlers/app_test.go
@@ -140,7 +140,29 @@ func TestAppDispatcher(t *testing.T) {
Expand Down Expand Up @@ -157,7 +157,7 @@ index 60a57e6c..8a644d83 100644
+ config.Redis.DB = 0
+ runAppWithConfig(t, config)
+}

+// TestNewApp covers the creation of an application via NewApp with a
+// configuration(with redis sentinel cluster).
+func TestNewAppWithRedisSentinelCluster(t *testing.T) {
Expand Down Expand Up @@ -189,18 +189,17 @@ index 60a57e6c..8a644d83 100644
// ensuring that NewApp doesn't panic. We might want to tweak this
// behavior.
diff --git a/vendor.conf b/vendor.conf
index bd1b4bff..a45ac137 100644
index 33fe616b76..a8d8f58bc6 100644
--- a/vendor.conf
+++ b/vendor.conf
@@ -49,3 +49,4 @@ gopkg.in/yaml.v2 v2.2.1
@@ -51,3 +51,4 @@ gopkg.in/yaml.v2 v2.2.1
rsc.io/letsencrypt e770c10b0f1a64775ae91d240407ce00d1a5bdeb https://github.com/dmcgowan/letsencrypt.git
github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb
github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
github.com/opencontainers/image-spec 67d2d5658fe0476ab9bf414cec164077ebff3920 # v1.0.2
+github.com/FZambia/sentinel 5585739eb4b6478aa30161866ccf9ce0ef5847c7 https://github.com/jeremyxu2010/sentinel.git
\ No newline at end of file
diff --git a/vendor/github.com/FZambia/sentinel/LICENSE b/vendor/github.com/FZambia/sentinel/LICENSE
new file mode 100644
index 00000000..9c8f3ea0
index 0000000000..8dada3edaf
--- /dev/null
+++ b/vendor/github.com/FZambia/sentinel/LICENSE
@@ -0,0 +1,201 @@
Expand Down Expand Up @@ -405,10 +404,9 @@ index 00000000..9c8f3ea0
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/vendor/github.com/FZambia/sentinel/README.md b/vendor/github.com/FZambia/sentinel/README.md
new file mode 100644
index 00000000..fc810435
index 0000000000..f544c54ef6
--- /dev/null
+++ b/vendor/github.com/FZambia/sentinel/README.md
@@ -0,0 +1,39 @@
Expand Down Expand Up @@ -450,11 +448,10 @@ index 00000000..fc810435
+License
+-------
+
+Library is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
\ No newline at end of file
+Library is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
diff --git a/vendor/github.com/FZambia/sentinel/sentinel.go b/vendor/github.com/FZambia/sentinel/sentinel.go
new file mode 100644
index 00000000..98dea26d
index 0000000000..79209e9f0d
--- /dev/null
+++ b/vendor/github.com/FZambia/sentinel/sentinel.go
@@ -0,0 +1,426 @@
Expand Down
42 changes: 20 additions & 22 deletions src/go.mod
Expand Up @@ -12,7 +12,7 @@ require (
github.com/beego/i18n v0.0.0-20140604031826-e87155e8f0c0
github.com/bmatcuk/doublestar v1.1.1
github.com/casbin/casbin v1.9.1
github.com/cenkalti/backoff/v4 v4.1.2
github.com/cenkalti/backoff/v4 v4.2.1
github.com/cloudevents/sdk-go/v2 v2.13.0
github.com/coreos/go-oidc/v3 v3.7.0
github.com/dghubble/sling v1.1.0
Expand All @@ -33,9 +33,9 @@ require (
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/golang-migrate/migrate/v4 v4.16.2
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/gorilla/csrf v1.6.2
github.com/gorilla/handlers v1.5.1
github.com/gorilla/handlers v1.5.2
github.com/gorilla/mux v1.8.0
github.com/graph-gophers/dataloader v5.0.0+incompatible
github.com/jackc/pgconn v1.14.0
Expand All @@ -48,18 +48,18 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/robfig/cron/v3 v3.0.0
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.8.4
github.com/tencentcloud/tencentcloud-sdk-go v1.0.62
github.com/vmihailenco/msgpack/v5 v5.0.0-rc.2
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.45.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel v1.21.0
go.opentelemetry.io/otel/exporters/jaeger v1.0.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0
go.opentelemetry.io/otel/sdk v1.8.0
go.opentelemetry.io/otel/trace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0
go.opentelemetry.io/otel/sdk v1.21.0
go.opentelemetry.io/otel/trace v1.21.0
go.uber.org/ratelimit v0.2.0
golang.org/x/crypto v0.14.0
golang.org/x/net v0.17.0
Expand All @@ -73,11 +73,11 @@ require (
k8s.io/api v0.26.2
k8s.io/apimachinery v0.26.2
k8s.io/client-go v0.26.2
sigs.k8s.io/yaml v1.3.0
sigs.k8s.io/yaml v1.4.0
)

require (
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/azure-sdk-for-go v37.2.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
Expand All @@ -101,8 +101,8 @@ require (
github.com/docker/go-metrics v0.0.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.19.10 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
Expand All @@ -113,7 +113,7 @@ require (
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand Down Expand Up @@ -154,22 +154,20 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
go.mongodb.org/mongo-driver v1.7.5 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/proto/otlp v0.11.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
Expand Down

0 comments on commit ef846ab

Please sign in to comment.