Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cache')
-rw-r--r--internal/cache/diskcache.go3
-rw-r--r--internal/cache/keyer.go5
-rw-r--r--internal/cache/walker.go3
-rw-r--r--internal/cache/walker_test.go7
4 files changed, 11 insertions, 7 deletions
diff --git a/internal/cache/diskcache.go b/internal/cache/diskcache.go
index 60408f4af..d2c9fe02a 100644
--- a/internal/cache/diskcache.go
+++ b/internal/cache/diskcache.go
@@ -13,6 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/dontpanic"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v15/internal/safe"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
"google.golang.org/protobuf/proto"
@@ -290,7 +291,7 @@ func (c *DiskCache) PutStream(ctx context.Context, repo *gitalypb.Repository, re
}
}()
- if err := os.MkdirAll(filepath.Dir(reqPath), 0o755); err != nil {
+ if err := os.MkdirAll(filepath.Dir(reqPath), perm.SharedDir); err != nil {
return err
}
diff --git a/internal/cache/keyer.go b/internal/cache/keyer.go
index c3cdf5738..42a80f2da 100644
--- a/internal/cache/keyer.go
+++ b/internal/cache/keyer.go
@@ -16,6 +16,7 @@ import (
"github.com/google/uuid"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v15/internal/safe"
"gitlab.com/gitlab-org/gitaly/v15/internal/version"
@@ -62,7 +63,7 @@ func (keyer leaseKeyer) updateLatest(ctx context.Context, repo *gitalypb.Reposit
}
lPath := latestPath(repoStatePath)
- if err := os.MkdirAll(filepath.Dir(lPath), 0o755); err != nil {
+ if err := os.MkdirAll(filepath.Dir(lPath), perm.SharedDir); err != nil {
return "", err
}
@@ -181,7 +182,7 @@ func (keyer leaseKeyer) newPendingLease(repo *gitalypb.Repository) (string, erro
}
pDir := pendingDir(repoStatePath)
- if err := os.MkdirAll(pDir, 0o755); err != nil {
+ if err := os.MkdirAll(pDir, perm.SharedDir); err != nil {
return "", err
}
diff --git a/internal/cache/walker.go b/internal/cache/walker.go
index b14c8adf6..58ffba7af 100644
--- a/internal/cache/walker.go
+++ b/internal/cache/walker.go
@@ -16,6 +16,7 @@ import (
"github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitaly/v15/internal/dontpanic"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v15/internal/log"
)
@@ -156,7 +157,7 @@ func (c *DiskCache) moveAndClear(storage config.Storage) error {
return fmt.Errorf("temp dir: %w", err)
}
- if err := os.MkdirAll(tempPath, 0o755); err != nil {
+ if err := os.MkdirAll(tempPath, perm.SharedDir); err != nil {
return err
}
diff --git a/internal/cache/walker_test.go b/internal/cache/walker_test.go
index dc4f55f39..39ce3675e 100644
--- a/internal/cache/walker_test.go
+++ b/internal/cache/walker_test.go
@@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testcfg"
)
@@ -38,7 +39,7 @@ func TestDiskCacheObjectWalker(t *testing.T) {
require.NoError(t, err)
path := filepath.Join(cacheDir, tt.name)
- require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755))
+ require.NoError(t, os.MkdirAll(filepath.Dir(path), perm.SharedDir))
f, err := os.Create(path)
require.NoError(t, err)
@@ -79,7 +80,7 @@ func TestDiskCacheInitialClear(t *testing.T) {
require.NoError(t, err)
canary := filepath.Join(cacheDir, "canary.txt")
- require.NoError(t, os.MkdirAll(filepath.Dir(canary), 0o755))
+ require.NoError(t, os.MkdirAll(filepath.Dir(canary), perm.SharedDir))
require.NoError(t, os.WriteFile(canary, []byte("chirp chirp"), 0o755))
cache := New(cfg, locator, withDisabledWalker())
@@ -115,7 +116,7 @@ func TestCleanWalkEmptyDirs(t *testing.T) {
} {
p := filepath.Join(tmp, tt.path)
if strings.HasSuffix(tt.path, "/") {
- require.NoError(t, os.MkdirAll(p, 0o755))
+ require.NoError(t, os.MkdirAll(p, perm.SharedDir))
} else {
require.NoError(t, os.WriteFile(p, nil, 0o655))
if tt.stale {