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

WIP: recycle bin functionality for cephfs #4713

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
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
29 changes: 29 additions & 0 deletions .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test
on:
pull_request:
push:
branches:
- "*"
workflow_dispatch:

jobs:
docker:
strategy:
fail-fast: false
matrix:
file: [docker/Dockerfile.reva, docker/Dockerfile.revad-eos, docker/Dockerfile.revad-ceph]
uses: ./.github/workflows/docker.yml
with:
file: ${{ matrix.file }}
docker-revad:
name: docker (docker/Dockerfile.revad)
uses: ./.github/workflows/docker.yml
with:
file: docker/Dockerfile.revad
load: true
docker-revad-eos:
name: docker (docker/Dockerfile.revad-eos)
uses: ./.github/workflows/docker.yml
with:
file: docker/Dockerfile.revad-eos
load: false
37 changes: 37 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test
on:
pull_request:
push:
branches:
- "*"
workflow_dispatch:

jobs:
integration:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Test integration
run: make test-integration
env:
REDIS_ADDRESS: redis:6379
SQL_USERNAME: root
SQL_PASSWORD: my-secret-pw
SQL_ADDRESS: localhost:3306
SQL_DBNAME: reva
services:
redis:
image: registry.cern.ch/docker.io/webhippie/redis
mysql:
image: mysql
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: reva
19 changes: 19 additions & 0 deletions .github/workflows/test-litmus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test
on:
pull_request:
push:
branches:
- "*"
workflow_dispatch:

jobs:
litmus:
needs:
- docker-revad-eos
strategy:
fail-fast: false
matrix:
test: [litmus-1, litmus-2]
uses: ./.github/workflows/compose.yml
with:
test: ${{ matrix.test }}
30 changes: 30 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test
on:
pull_request:
push:
branches:
- "*"
workflow_dispatch:

jobs:
unit-tests:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Test
run: make test-go
env:
COVER_PROFILE: ${{ github.event_name == 'push' && 'coverage.out' || '' }}
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
if: github.event_name == 'push'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.out
force-coverage-parser: go
108 changes: 0 additions & 108 deletions .github/workflows/test.yml

This file was deleted.

78 changes: 9 additions & 69 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,9 @@ run:
timeout: 20m

linters:
enable-all: true
disable:
- exhaustive # TODO: consider enabling the 'exhaustive' linter to check the exhaustiveness of enum switch statements and map literals.
- wrapcheck # TODO: consider enabling the 'wrapcheck' linter to check that errors from external packages are wrapped during return to help identify the error source during debugging.
- cyclop # TODO: consider enabling the 'cyclop' linter to calculate the cyclomatic complexities of functions/packages.
- varnamelen # TODO: consider enabling the 'varnamelen' linter to check that the length of a variable's name matches its usage scope.
- testpackage # TODO: consider enabling the 'testpackage' linter to make sure that separate _test packages are used.
- gosec # TODO: consider enabling the 'gosec' linter to inspect source code for security problems.
- tagliatelle # TODO: consider enabling the 'tagliatelle' linter to check the struct tags.
- thelper # TODO: consider enabling the 'thelper' linter to detect golang test helpers without t.Helper() call and check the consistency of test helpers.
- predeclared # TODO: consider enabling the 'predeclared' linter to find code that shadows one of Go's predeclared identifiers.
- paralleltest # TODO: consider enabling the 'paralleltest' linter to detect missing usage of t.Parallel() method in Go test.
- ireturn # TODO: consider enabling the 'ireturn' linter to accept interfaces and return concrete types.
- nosprintfhostport # TODO: consider enabling the 'nosprintfhostport' linter to check for misuse of Sprintf to construct a host with port in a URL.
- nonamedreturns # TODO: consider enabling the 'nonamedreturns' linter to reports all named returns.
- gomnd # TODO: consider enabling the 'gomnd' linter to detect magic numbers.
- noctx # TODO: consider enabling the 'noctx' linter to find sending http request without context.Context.
- nlreturn # TODO: consider enabling the 'nlreturn' linter to check for a new line before return and branch statements to increase code clarity.
- nilnil # TODO: consider enabling the 'nilnil' linter to check that there is no simultaneous return of nil error and an invalid value.
- nilerr # TODO: consider enabling the 'nilerr' linter to find the code that returns nil even if it checks that the error is not nil.
- interfacebloat # TODO: consider enabling the 'interfacebloat' linter to check the number of methods inside an interface.
- goerr113 # TODO: consider enabling the 'goerr113' linter to check the errors handling expressions.
- gochecknoglobals # TODO: consider enabling the 'gochecknoglobals' linter to check that no global variables exist.
- forcetypeassert # TODO: consider enabling the 'forcetypeassert' linter to find forced type assertions.
- exhaustruct # TODO: consider enabling the 'exhaustruct' linter to check if all structure fields are initialized.
- execinquery # TODO: consider enabling the 'execinquery' linter to check query strings.
- errorlint # TODO: consider enabling the 'errorlint' linter to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- errname # TODO: consider enabling the 'errname' linter to check that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
- wsl # TODO: consider enabling the 'wsl' linter to force the use of empty lines.
- nestif # TODO: consider enabling the 'nestif' linter to report deeply nested if statements.
- errchkjson # TODO: consider enabling the 'errchkjson' linter to checks types passed to the json encoding functions.
- contextcheck # TODO: consider enabling the 'contextcheck' linter to check whether the function uses a non-inherited context.
- asasalint # TODO: consider enabling the 'asasalint' linter to check for pass []any as any in variadic func(...any).
- containedctx # TODO: consider enabling the 'containedctx' linter to detect struct contained context.Context field.
- unparam # TODO: consider enabling the 'unparam' linter to report unused function parameters.
- nakedret # TODO: consider enabling the 'nakedret' linter to find naked returns in functions greater than a specified function length.
- makezero # TODO: consider enabling the 'makezero' linter to find slice declarations with non-zero initial length.
- lll # TODO: consider enabling the 'lll' linter to report long lines.
- gomoddirectives # TODO: consider enabling the 'gomoddirectives' linter to manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
- gofumpt # TODO: consider enabling the 'gofumpt' linter to check whether code was gofumpt-ed.
- godox # TODO: consider enabling the 'godox' linter to detect FIXME, TODO and other comment keywords.
- goconst # TODO: consider enabling the 'goconst' linter to find repeated strings that could be replaced by a constant.
- gocognit # TODO: consider enabling the 'gocognit' linter to compute and check the cognitive complexity of functions.
- gochecknoinits # TODO: consider enabling the 'gochecknoinits' linter to check that no init functions are present in Go code.
- gci # TODO: consider enabling the 'gci' linter to control golang package import order and make it always deterministic.
- funlen # TODO: consider enabling the 'funlen' linter to detect long functions.
- maintidx # TODO: consider enabling the 'maintidx' linter to measure the maintainability index of each function.
- gocyclo # TODO: consider enabling the 'gocyclo' linter to compute and check the cyclomatic complexity of functions.
- forbidigo # TODO: consider enabling the 'forbidigo' linter to forbid identifiers.
- dupl # TODO: consider enabling the 'dupl' linter to detect code cloning.
- musttag
- ginkgolinter
- depguard
- revive
- nolintlint
- golint # deprecated since v1.41.0 - replaced by 'revive'.
- ifshort # deprecated since v1.48.0
- structcheck # deprecated since v1.49.0 - replaced by 'unused'.
- exhaustivestruct # deprecated since v1.46.0 - replaced by 'exhaustruct'.
- deadcode # deprecated since v1.49.0 - replaced by 'unused'.
- interfacer # deprecated since v1.38.0
- nosnakecase # deprecated since v1.48.1 - replaced by 'revive'(var-naming).
- varcheck # deprecated since v1.49.0 - replaced by 'unused'.
- maligned # deprecated since v1.38.0 - replaced by 'govet' 'fieldalignment'.
- scopelint # deprecated since v1.39.0 - replaced by 'exportloopref'.
- rowserrcheck # disabled because of generics - https://github.com/golangci/golangci-lint/issues/2649.
- sqlclosecheck # disabled because of generics - https://github.com/golangci/golangci-lint/issues/2649.
- wastedassign # disabled because of generics - https://github.com/golangci/golangci-lint/issues/2649.
disable-all: true
enable:
- govet

linters-settings:
goheader:
Expand All @@ -90,4 +25,9 @@ linters-settings:

In applying this license, CERN does not waive the privileges and immunities
granted to it by virtue of its status as an Intergovernmental Organization
or submit itself to any jurisdiction.
or submit itself to any jurisdiction.
issues:
exclude-rules:
- linters:
- govet
text: ".*lock.*"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ toolchain: $(GOLANGCI_LINT) $(CALENS)

$(GOLANGCI_LINT):
@mkdir -p $(@D)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(@D) sh -s v1.54.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINDIR=$(@D) sh -s v1.60.3

CALENS_DIR := $(shell mktemp -d)
$(CALENS):
Expand Down Expand Up @@ -87,7 +87,7 @@ docker-eos-full-tests:
# Test
################################################################################

TEST = litmus-1 litmus-2 acceptance-1 acceptance-2
TEST = litmus-1 litmus-2
export REVAD_IMAGE ?= revad-eos
export EOS_FULL_IMAGE ?= eos-full
export PARTS ?= 1
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/ceph-recycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: recycle bin functionality for cephfs

This implementation is modeled after the CERN-deployed WinSpaces,
where a folder within each space is designated as the recycle folder
and organized by dates.

https://github.com/cs3org/reva/pull/4713
3 changes: 3 additions & 0 deletions changelog/unreleased/enhance-ceph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Refactor Ceph code

https://github.com/cs3org/reva/pull/4824
3 changes: 3 additions & 0 deletions changelog/unreleased/enhance-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Refactor CI jobs and bump to latest deps

https://github.com/cs3org/reva/pull/4797
6 changes: 6 additions & 0 deletions changelog/unreleased/locks-uploads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Pass lock holder metadata on uploads

We now pass relevant metadata (lock id and lock holder) downstream
on uploads, and handle the case of conflicts due to lock mismatch.

https://github.com/cs3org/reva/pull/4514
5 changes: 5 additions & 0 deletions changelog/unreleased/ocm-error-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: simplified error handling

Minor rewording and simplification, following cs3org/OCM-API#90 and cs3org/OCM-API#91

https://github.com/cs3org/reva/pull/4810
4 changes: 2 additions & 2 deletions cmd/reva/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func getClient() (gateway.GatewayAPIClient, error) {

func getConn() (*grpc.ClientConn, error) {
if insecure {
return grpc.Dial(conf.Host, grpc.WithTransportCredentials(ins.NewCredentials()))
return grpc.NewClient(conf.Host, grpc.WithTransportCredentials(ins.NewCredentials()))
}

// TODO(labkode): if in the future we want client-side certificate validation,
// we need to load the client cert here
tlsconf := &tls.Config{InsecureSkipVerify: skipverify}
creds := credentials.NewTLS(tlsconf)
return grpc.Dial(conf.Host, grpc.WithTransportCredentials(creds))
return grpc.NewClient(conf.Host, grpc.WithTransportCredentials(creds))
}

func formatError(status *rpc.Status) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/reva/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func lsCommand() *command {
}
if len(w) == 0 {
if *longFlag {
fmt.Printf("%s %d %d %v %s\n", info.Type, info.Mtime, info.Size, info.Id, p)
fmt.Printf("%s %s %d %v %s\n", info.Type, info.Mtime, info.Size, info.Id, p)
} else {
fmt.Println(p)
}
Expand Down
Loading
Loading