From 5fb8981c82341448187b9835b40decd74947586e Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Mon, 25 Sep 2023 22:07:44 +0400 Subject: [PATCH 1/3] Fix fluky test --- .github/workflows/{go-trust.yml => go-trusted.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{go-trust.yml => go-trusted.yml} (99%) diff --git a/.github/workflows/go-trust.yml b/.github/workflows/go-trusted.yml similarity index 99% rename from .github/workflows/go-trust.yml rename to .github/workflows/go-trusted.yml index 7de592d32eff..9882ec80b50a 100644 --- a/.github/workflows/go-trust.yml +++ b/.github/workflows/go-trusted.yml @@ -1,7 +1,7 @@ --- # Integration tests that need access to secrets. -name: Go trusted +name: Go Trusted on: pull_request_target: types: From 1fd811c17f8e7fd0eebcbe5981c197201ac23cee Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Tue, 26 Sep 2023 10:56:36 +0400 Subject: [PATCH 2/3] Add SAP HANA backend stub Makes integration tests fail faster without panic. --- .github/workflows/go-trusted.yml | 4 +- Taskfile.yml | 12 ++- cmd/ferretdb/main.go | 6 +- integration/setup/listener.go | 3 +- integration/setup/setup.go | 3 +- internal/backends/hana/backend.go | 90 +++++++++++++++++++ internal/backends/hana/collection.go | 75 ++++++++++++++++ internal/backends/hana/database.go | 62 +++++++++++++ internal/backends/hana/dummy_test.go | 21 +++++ internal/backends/hana/hana.go | 16 ++++ internal/backends/postgresql/backend.go | 6 +- internal/backends/postgresql/dummy_test.go | 21 +++++ .../postgresql/{doc.go => postgresql.go} | 0 internal/backends/sqlite/backend.go | 6 +- internal/handlers/registry/hana.go | 18 ++++ internal/handlers/registry/pg.go | 2 - internal/handlers/registry/registry.go | 3 +- internal/handlers/sqlite/sqlite.go | 7 ++ 18 files changed, 333 insertions(+), 22 deletions(-) create mode 100644 internal/backends/hana/backend.go create mode 100644 internal/backends/hana/collection.go create mode 100644 internal/backends/hana/database.go create mode 100644 internal/backends/hana/dummy_test.go create mode 100644 internal/backends/hana/hana.go create mode 100644 internal/backends/postgresql/dummy_test.go rename internal/backends/postgresql/{doc.go => postgresql.go} (100%) diff --git a/.github/workflows/go-trusted.yml b/.github/workflows/go-trusted.yml index 9882ec80b50a..c909042c5d5f 100644 --- a/.github/workflows/go-trusted.yml +++ b/.github/workflows/go-trusted.yml @@ -47,8 +47,8 @@ jobs: fail-fast: false matrix: task: [hana] - shard_index: [1, 2, 3] - shard_total: [3] + shard_index: [1] + shard_total: [1] # Do not submit to coveralls because it can't handle parallel workflows: # https://github.com/lemurheavy/coveralls-public/issues/1636#issuecomment-1529460515 diff --git a/Taskfile.yml b/Taskfile.yml index 839bd859dfdd..08a4159fcffc 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -17,7 +17,6 @@ vars: FUZZ_CORPUS: ../fuzz-corpus TESTJS_PORT: 27017 RACE_FLAG: -race={{and (ne OS "windows") (ne ARCH "arm") (ne ARCH "riscv64")}} - TEST_UNIX_SOCKET_FLAG: -target-unix-socket={{ne OS "windows"}} BUILD_TAGS: ferretdb_debug,ferretdb_hana SERVICES: postgres postgres_secured mongodb mongodb_secured jaeger @@ -252,9 +251,12 @@ tasks: go test -count=1 -run='{{or .TEST_RUN .SHARD_RUN}}' -timeout={{.TEST_TIMEOUT}} {{.RACE_FLAG}} -tags={{.BUILD_TAGS}} -shuffle=on -coverpkg=../... -coverprofile=integration-hana.txt . -target-backend=ferretdb-hana - {{.TEST_UNIX_SOCKET_FLAG}} + -target-tls -hana-url=$FERRETDB_HANA_URL - -compat-url='mongodb://127.0.0.1:47017/' + -compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem' + -use-new-hana + -disable-filter-pushdown={{.DISABLE_FILTER_PUSHDOWN}} + -enable-sort-pushdown={{.ENABLE_SORT_PUSHDOWN}} vars: SHARD_RUN: sh: go run -C .. ./cmd/envtool tests shard --index={{.SHARD_INDEX}} --total={{.SHARD_TOTAL}} @@ -315,6 +317,7 @@ tasks: desc: "Run FerretDB with `pg` handler" deps: [build-host] cmds: + # TODO --use-new-pg - > bin/ferretdb{{exeExt}} --listen-addr=:27017 @@ -344,6 +347,7 @@ tasks: desc: "Run FerretDB with `hana` handler" deps: [build-host] cmds: + # TODO --use-new-hana - > bin/ferretdb{{exeExt}} --listen-addr=:27017 @@ -356,6 +360,7 @@ tasks: desc: "Run FerretDB with `pg` handler (TLS, auth required)" deps: [build-host] cmds: + # TODO --use-new-pg - > bin/ferretdb{{exeExt}} --listen-addr='' @@ -373,6 +378,7 @@ tasks: desc: "Run FerretDB in diff-proxy mode" deps: [build-host] cmds: + # TODO --use-new-pg - > bin/ferretdb{{exeExt}} --listen-addr=:27017 diff --git a/cmd/ferretdb/main.go b/cmd/ferretdb/main.go index f3f5b5f4efce..21e04f581acd 100644 --- a/cmd/ferretdb/main.go +++ b/cmd/ferretdb/main.go @@ -84,7 +84,8 @@ var cli struct { EnableSortPushdown bool `default:"false" help:"Experimental: enable sort pushdown."` EnableOplog bool `default:"false" help:"Experimental: enable OpLog." hidden:""` - UseNewPG bool `default:"false" help:"Experimental: use new PostgreSQL backend." hidden:""` + UseNewPG bool `default:"false" help:"Experimental: use new PostgreSQL backend." hidden:""` + UseNewHana bool `default:"false" help:"Experimental: use new SAP HANA backend." hidden:""` //nolint:lll // for readability Telemetry struct { @@ -367,7 +368,8 @@ func run() { EnableSortPushdown: cli.Test.EnableSortPushdown, EnableOplog: cli.Test.EnableOplog, - UseNewPG: cli.Test.UseNewPG, + UseNewPG: cli.Test.UseNewPG, + UseNewHana: cli.Test.UseNewHana, }, }) if err != nil { diff --git a/integration/setup/listener.go b/integration/setup/listener.go index 13e346ba43d8..1a7666320d5d 100644 --- a/integration/setup/listener.go +++ b/integration/setup/listener.go @@ -178,7 +178,8 @@ func setupListener(tb testtb.TB, ctx context.Context, logger *zap.Logger) string EnableSortPushdown: *enableSortPushdownF, EnableOplog: *enableOplogF, - UseNewPG: *useNewPGF, + UseNewPG: *useNewPgF, + UseNewHana: *useNewHanaF, }, } h, err := registry.NewHandler(handler, handlerOpts) diff --git a/integration/setup/setup.go b/integration/setup/setup.go index 19d014544bac..9b995a1188bc 100644 --- a/integration/setup/setup.go +++ b/integration/setup/setup.go @@ -63,7 +63,8 @@ var ( enableSortPushdownF = flag.Bool("enable-sort-pushdown", false, "enable sort pushdown") enableOplogF = flag.Bool("enable-oplog", false, "enable OpLog") - useNewPGF = flag.Bool("use-new-pg", false, "use new PostgreSQL backend") + useNewPgF = flag.Bool("use-new-pg", false, "use new PostgreSQL backend") + useNewHanaF = flag.Bool("use-new-hana", false, "use new SAP HANA backend") ) // Other globals. diff --git a/internal/backends/hana/backend.go b/internal/backends/hana/backend.go new file mode 100644 index 000000000000..60642b205774 --- /dev/null +++ b/internal/backends/hana/backend.go @@ -0,0 +1,90 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +package hana + +import ( + "context" + + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + + "github.com/FerretDB/FerretDB/internal/backends" + "github.com/FerretDB/FerretDB/internal/util/lazyerrors" + "github.com/FerretDB/FerretDB/internal/util/state" +) + +// backend implements backends.Backend interface. +type backend struct{} + +// NewBackendParams represents the parameters of NewBackend function. +// +//nolint:vet // for readability +type NewBackendParams struct { + URI string + L *zap.Logger + P *state.Provider +} + +// NewBackend creates a new backend. +func NewBackend(params *NewBackendParams) (backends.Backend, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// Close implements backends.Backend interface. +func (b *backend) Close() { + // TODO +} + +// Name implements backends.Backend interface. +func (b *backend) Name() string { + return "SAP HANA" +} + +// Status implements backends.Backend interface. +func (b *backend) Status(ctx context.Context, params *backends.StatusParams) (*backends.StatusResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// Database implements backends.Backend interface. +func (b *backend) Database(name string) (backends.Database, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// ListDatabases implements backends.Backend interface. +// +//nolint:lll // for readability +func (b *backend) ListDatabases(ctx context.Context, params *backends.ListDatabasesParams) (*backends.ListDatabasesResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// DropDatabase implements backends.Backend interface. +func (b *backend) DropDatabase(ctx context.Context, params *backends.DropDatabaseParams) error { + return lazyerrors.New("not implemented yet") +} + +// Describe implements prometheus.Collector. +func (b *backend) Describe(ch chan<- *prometheus.Desc) { + // TODO +} + +// Collect implements prometheus.Collector. +func (b *backend) Collect(ch chan<- prometheus.Metric) { + // TODO +} + +// check interfaces +var ( + _ backends.Backend = (*backend)(nil) +) diff --git a/internal/backends/hana/collection.go b/internal/backends/hana/collection.go new file mode 100644 index 000000000000..53fa7afb0727 --- /dev/null +++ b/internal/backends/hana/collection.go @@ -0,0 +1,75 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +package hana + +import ( + "context" + + "github.com/FerretDB/FerretDB/internal/backends" + "github.com/FerretDB/FerretDB/internal/util/lazyerrors" +) + +// collection implements backends.Collection interface by delegating all methods to the wrapped database. +type collection struct{} + +// Query implements backends.Collection interface. +func (c *collection) Query(ctx context.Context, params *backends.QueryParams) (*backends.QueryResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// InsertAll implements backends.Collection interface. +func (c *collection) InsertAll(ctx context.Context, params *backends.InsertAllParams) (*backends.InsertAllResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// UpdateAll implements backends.Collection interface. +func (c *collection) UpdateAll(ctx context.Context, params *backends.UpdateAllParams) (*backends.UpdateAllResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// DeleteAll implements backends.Collection interface. +func (c *collection) DeleteAll(ctx context.Context, params *backends.DeleteAllParams) (*backends.DeleteAllResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// Explain implements backends.Collection interface. +func (c *collection) Explain(ctx context.Context, params *backends.ExplainParams) (*backends.ExplainResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// Stats implements backends.Collection interface. +func (c *collection) Stats(ctx context.Context, params *backends.CollectionStatsParams) (*backends.CollectionStatsResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// ListIndexes implements backends.Collection interface. +func (c *collection) ListIndexes(ctx context.Context, params *backends.ListIndexesParams) (*backends.ListIndexesResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// CreateIndexes implements backends.Collection interface. +func (c *collection) CreateIndexes(ctx context.Context, params *backends.CreateIndexesParams) (*backends.CreateIndexesResult, error) { //nolint:lll // for readability + return nil, lazyerrors.New("not implemented yet") +} + +// DropIndexes implements backends.Collection interface. +func (c *collection) DropIndexes(ctx context.Context, params *backends.DropIndexesParams) (*backends.DropIndexesResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// check interfaces +var ( + _ backends.Collection = (*collection)(nil) +) diff --git a/internal/backends/hana/database.go b/internal/backends/hana/database.go new file mode 100644 index 000000000000..9dbf858c3253 --- /dev/null +++ b/internal/backends/hana/database.go @@ -0,0 +1,62 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +package hana + +import ( + "context" + + "github.com/FerretDB/FerretDB/internal/backends" + "github.com/FerretDB/FerretDB/internal/util/lazyerrors" +) + +// database implements backends.Database. +type database struct{} + +// Collection implements backends.Database interface. +func (db *database) Collection(name string) (backends.Collection, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// ListCollections implements backends.Database interface. +// +//nolint:lll // for readability +func (db *database) ListCollections(ctx context.Context, params *backends.ListCollectionsParams) (*backends.ListCollectionsResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// CreateCollection implements backends.Database interface. +func (db *database) CreateCollection(ctx context.Context, params *backends.CreateCollectionParams) error { + return lazyerrors.New("not implemented yet") +} + +// DropCollection implements backends.Database interface. +func (db *database) DropCollection(ctx context.Context, params *backends.DropCollectionParams) error { + return lazyerrors.New("not implemented yet") +} + +// RenameCollection implements backends.Database interface. +func (db *database) RenameCollection(ctx context.Context, params *backends.RenameCollectionParams) error { + return lazyerrors.New("not implemented yet") +} + +// Stats implements backends.Database interface. +func (db *database) Stats(ctx context.Context, params *backends.DatabaseStatsParams) (*backends.DatabaseStatsResult, error) { + return nil, lazyerrors.New("not implemented yet") +} + +// check interfaces +var ( + _ backends.Database = (*database)(nil) +) diff --git a/internal/backends/hana/dummy_test.go b/internal/backends/hana/dummy_test.go new file mode 100644 index 000000000000..baf26e9328d2 --- /dev/null +++ b/internal/backends/hana/dummy_test.go @@ -0,0 +1,21 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +package hana + +import "testing" + +func TestDummy(t *testing.T) { + // we need at least one test per package to correctly calculate coverage +} diff --git a/internal/backends/hana/hana.go b/internal/backends/hana/hana.go new file mode 100644 index 000000000000..9980d9a37020 --- /dev/null +++ b/internal/backends/hana/hana.go @@ -0,0 +1,16 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Package hana provides backend for SAP HANA. +package hana diff --git a/internal/backends/postgresql/backend.go b/internal/backends/postgresql/backend.go index 0fd48d1469dd..c6f4cad1a8ae 100644 --- a/internal/backends/postgresql/backend.go +++ b/internal/backends/postgresql/backend.go @@ -40,12 +40,8 @@ type NewBackendParams struct { P *state.Provider } -// NewBackend creates a new backend for PostgreSQL-compatible database. +// NewBackend creates a new backend. func NewBackend(params *NewBackendParams) (backends.Backend, error) { - if params.P == nil { - panic("state provider is required but not set") - } - r, err := metadata.NewRegistry(params.URI, params.L, params.P) if err != nil { return nil, err diff --git a/internal/backends/postgresql/dummy_test.go b/internal/backends/postgresql/dummy_test.go new file mode 100644 index 000000000000..ab1be0278a87 --- /dev/null +++ b/internal/backends/postgresql/dummy_test.go @@ -0,0 +1,21 @@ +// Copyright 2021 FerretDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +package postgresql + +import "testing" + +func TestDummy(t *testing.T) { + // we need at least one test per package to correctly calculate coverage +} diff --git a/internal/backends/postgresql/doc.go b/internal/backends/postgresql/postgresql.go similarity index 100% rename from internal/backends/postgresql/doc.go rename to internal/backends/postgresql/postgresql.go diff --git a/internal/backends/sqlite/backend.go b/internal/backends/sqlite/backend.go index 65cfe992bbf3..a34d54e8e9fd 100644 --- a/internal/backends/sqlite/backend.go +++ b/internal/backends/sqlite/backend.go @@ -40,12 +40,8 @@ type NewBackendParams struct { P *state.Provider } -// NewBackend creates a new SQLite backend. +// NewBackend creates a new backend. func NewBackend(params *NewBackendParams) (backends.Backend, error) { - if params.P == nil { - panic("state provider is required but not set") - } - r, err := metadata.NewRegistry(params.URI, params.L, params.P) if err != nil { return nil, err diff --git a/internal/handlers/registry/hana.go b/internal/handlers/registry/hana.go index 56ee05f7fffb..a3209c7f63d6 100644 --- a/internal/handlers/registry/hana.go +++ b/internal/handlers/registry/hana.go @@ -19,6 +19,7 @@ package registry import ( "github.com/FerretDB/FerretDB/internal/handlers" "github.com/FerretDB/FerretDB/internal/handlers/hana" + "github.com/FerretDB/FerretDB/internal/handlers/sqlite" ) // init registers "hana" handler for Hana when "ferretdb_hana" build tag is provided. @@ -26,6 +27,23 @@ func init() { registry["hana"] = func(opts *NewHandlerOpts) (handlers.Interface, error) { opts.Logger.Warn("HANA handler is in alpha. It is not supported yet.") + if opts.UseNewHana { + handlerOpts := &sqlite.NewOpts{ + Backend: "hana", + URI: opts.HANAURL, + + L: opts.Logger.Named("hana"), + ConnMetrics: opts.ConnMetrics, + StateProvider: opts.StateProvider, + + DisableFilterPushdown: opts.DisableFilterPushdown, + EnableSortPushdown: opts.EnableSortPushdown, + EnableOplog: opts.EnableOplog, + } + + return sqlite.New(handlerOpts) + } + handlerOpts := &hana.NewOpts{ HANAURL: opts.HANAURL, L: opts.Logger, diff --git a/internal/handlers/registry/pg.go b/internal/handlers/registry/pg.go index a063b77efb2f..eab411c03b94 100644 --- a/internal/handlers/registry/pg.go +++ b/internal/handlers/registry/pg.go @@ -24,8 +24,6 @@ import ( func init() { registry["pg"] = func(opts *NewHandlerOpts) (handlers.Interface, error) { if opts.UseNewPG { - opts.Logger.Warn("New PostgreSQL backend is in alpha.") - handlerOpts := &sqlite.NewOpts{ Backend: "postgresql", URI: opts.PostgreSQLURL, diff --git a/internal/handlers/registry/registry.go b/internal/handlers/registry/registry.go index b555190dd6d5..7c0babed6531 100644 --- a/internal/handlers/registry/registry.go +++ b/internal/handlers/registry/registry.go @@ -59,7 +59,8 @@ type TestOpts struct { EnableSortPushdown bool EnableOplog bool - UseNewPG bool + UseNewPG bool + UseNewHana bool } // NewHandler constructs a new handler. diff --git a/internal/handlers/sqlite/sqlite.go b/internal/handlers/sqlite/sqlite.go index 74ec26faf905..7323b4473c36 100644 --- a/internal/handlers/sqlite/sqlite.go +++ b/internal/handlers/sqlite/sqlite.go @@ -23,6 +23,7 @@ import ( "github.com/FerretDB/FerretDB/internal/backends" "github.com/FerretDB/FerretDB/internal/backends/decorators/oplog" + "github.com/FerretDB/FerretDB/internal/backends/hana" "github.com/FerretDB/FerretDB/internal/backends/postgresql" "github.com/FerretDB/FerretDB/internal/backends/sqlite" "github.com/FerretDB/FerretDB/internal/clientconn/connmetrics" @@ -75,6 +76,12 @@ func New(opts *NewOpts) (handlers.Interface, error) { L: opts.L, P: opts.StateProvider, }) + case "hana": + b, err = hana.NewBackend(&hana.NewBackendParams{ + URI: opts.URI, + L: opts.L, + P: opts.StateProvider, + }) default: panic("unknown backend: " + opts.Backend) } From f193b220e0b01680284898d7761c89c0e2102360 Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Tue, 26 Sep 2023 12:54:56 +0400 Subject: [PATCH 3/3] Fix workflows --- .github/workflows/_integration.yml | 1 + .github/workflows/debug.yml | 1 + .github/workflows/docs.yml | 1 + .github/workflows/format.yml | 1 + .github/workflows/go-trusted.yml | 2 +- .github/workflows/go.yml | 7 +++++++ .github/workflows/js.yml | 1 + .github/workflows/packages.yml | 4 +++- .github/workflows/security.yml | 1 + .github/workflows/website-preview.yml | 6 ++++-- 10 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_integration.yml b/.github/workflows/_integration.yml index 3f6980a9158b..77531df8099b 100644 --- a/.github/workflows/_integration.yml +++ b/.github/workflows/_integration.yml @@ -56,6 +56,7 @@ jobs: env: GITHUB_CONTEXT: ${{ toJSON(github) }} + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index eade80277399..74f7a8b53cf9 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -38,6 +38,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b20b1ca3f2db..5f4269edc959 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -41,6 +41,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 1e049b7e4dc9..b200566b3bd0 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -40,6 +40,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/go-trusted.yml b/.github/workflows/go-trusted.yml index c909042c5d5f..dfa89c4a50d2 100644 --- a/.github/workflows/go-trusted.yml +++ b/.github/workflows/go-trusted.yml @@ -57,7 +57,7 @@ jobs: task: ${{ matrix.task }} shard_index: ${{ matrix.shard_index }} shard_total: ${{ matrix.shard_total }} - checkout_ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.merge_commit_sha || ''}} + checkout_ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || ''}} coveralls: false secrets: FERRETDB_HANA_URL: ${{ secrets.FERRETDB_HANA_URL }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3fafa6a80e4d..4569048a24f4 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,6 +40,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: @@ -90,6 +91,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: @@ -222,6 +224,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: @@ -268,6 +271,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: @@ -299,6 +303,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: @@ -315,6 +320,8 @@ jobs: run: go generate -x working-directory: source/tools + # TODO https://github.com/FerretDB/github-actions/issues/211 + # Use deploy key instead of Personal Access Token (PAT) to limit access to one repository. # If secrets are not available (for example, for a pull request from a fork), GITHUB_TOKEN PAT is used automatically. - name: Checkout collected fuzz corpus diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 93e221f87102..ffcb5c8be2c6 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -42,6 +42,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 1637da1a6e66..a62ddd5fe169 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -64,6 +64,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code if: github.event_name != 'pull_request_target' uses: actions/checkout@v3 @@ -71,13 +72,14 @@ jobs: fetch-depth: 0 # for `git describe` to work lfs: false # LFS is used only by website + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout pull request code if: github.event_name == 'pull_request_target' uses: actions/checkout@v3 with: fetch-depth: 0 lfs: false - ref: ${{ github.event.pull_request.merge_commit_sha }} + ref: ${{ github.event.pull_request.head.sha }} # for version.txt on push tags; see https://github.com/actions/checkout/issues/290 - name: Fetch annotated tags diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index a75d58d21a69..b81e04c26eb9 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -40,6 +40,7 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/website-preview.yml b/.github/workflows/website-preview.yml index 89997b6561b2..18d163784819 100644 --- a/.github/workflows/website-preview.yml +++ b/.github/workflows/website-preview.yml @@ -44,12 +44,13 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 # for wrangler to work lfs: true - ref: ${{ github.event.pull_request.merge_commit_sha }} + ref: ${{ github.event.pull_request.head.sha }} # for Wrangler / Cloudflare Pages on pull_request_target - name: Name branch @@ -113,12 +114,13 @@ jobs: uses: GitHubSecurityLab/actions-permissions/monitor@v1 if: false + # TODO https://github.com/FerretDB/github-actions/issues/211 - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 # for wrangler to work lfs: true - ref: ${{ github.event.pull_request.merge_commit_sha }} + ref: ${{ github.event.pull_request.head.sha }} # TODO https://github.com/FerretDB/github-actions/issues/211 # for Wrangler / Cloudflare Pages on pull_request_target - name: Name branch