diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-28 10:05:51 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-09-28 10:11:43 +0300 |
commit | daa09a2653d890fea607b2885de4d25267b30b47 (patch) | |
tree | 7359d833c1e08268824d0a1a5b7fed1c6043e43f | |
parent | c5215c0795cc04d895500ce5e9c54f2bb6723db6 (diff) |
Ignore `@ hashed` directory for disk source
-rw-r--r-- | acceptance_test.go | 11 | ||||
-rw-r--r-- | internal/source/disk/map.go | 8 | ||||
-rw-r--r-- | shared/pages/@hashed/hashed.gitlab.io/config.json | 7 | ||||
-rw-r--r-- | shared/pages/@hashed/hashed.gitlab.io/public/index.html | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/acceptance_test.go b/acceptance_test.go index 02c71f1d..7817bf81 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -1900,6 +1900,17 @@ func TestDomainsSource(t *testing.T) { apiCalled: false, }, }, + { + name: "disk_source_domain_should_not_exist_under_hashed_dir", + args: args{ + configSource: "disk", + domain: "hashed.com", + }, + want: want{ + statusCode: http.StatusNotFound, + apiCalled: false, + }, + }, // TODO: modify mock so we can test domain-config-source=auto when API/disk is not ready https://gitlab.com/gitlab-org/gitlab/-/issues/218358 } diff --git a/internal/source/disk/map.go b/internal/source/disk/map.go index 5c053fcb..874565a6 100644 --- a/internal/source/disk/map.go +++ b/internal/source/disk/map.go @@ -16,6 +16,10 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/metrics" ) +// preventive measure to skip `@hashed` dir for new zip deployments when sourcing config from disk +// https://gitlab.com/gitlab-org/gitlab-pages/-/issues/468 +const skipHashedDir = "@hashed" + // Map maps domain names to Domain instances. type Map map[string]*domain.Domain @@ -180,6 +184,10 @@ func (dm Map) ReadGroups(rootDomain string, fis godirwalk.Dirents) { buf := make([]byte, 2*os.Getpagesize()) for group := range fanOutGroups { + if group == skipHashedDir { + continue + } + started := time.Now() readProjects(group, "", 0, buf, fanIn) diff --git a/shared/pages/@hashed/hashed.gitlab.io/config.json b/shared/pages/@hashed/hashed.gitlab.io/config.json new file mode 100644 index 00000000..100963e4 --- /dev/null +++ b/shared/pages/@hashed/hashed.gitlab.io/config.json @@ -0,0 +1,7 @@ +{ + "Domains": [ + { + "Domain": "hashed.com" + } + ] +} diff --git a/shared/pages/@hashed/hashed.gitlab.io/public/index.html b/shared/pages/@hashed/hashed.gitlab.io/public/index.html new file mode 100644 index 00000000..175ec469 --- /dev/null +++ b/shared/pages/@hashed/hashed.gitlab.io/public/index.html @@ -0,0 +1 @@ +@hashed/index.html |