Skip to content

Commit 03e76cc

Browse files
authored
Docker: Fix building x-pack references (#664)
Fixes building the x-pack reference books with `--doc`. They require a special directory layout that `build_docs.pl` relied on the user to build manually. `build_docs` builds the docker filesystem agnostic of the user's filesystem and without this change would stuff all of the source repos into `/doc` in the docker image. For example, the `elasticsearch` and `x-pack-elasticsearch` repo expect to be layed out like this: ``` + elasticsearch \ elasticsearch-extra + x-pack-elasticsearch ``` but docker was putting them in `/docs/elasticsearch` and `/docs/x-pack-elasticsearch`. This changes how they are mounted in the docker image so they'll build. Now all repos with names like `x-pack-foo` are mounted in `foo-extra`. This isn't the cleanest thing in the world, but I expect we can revert it once we no longer have to support building the docs outside of docker.
1 parent 7d243dd commit 03e76cc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

build_docs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ def run_build_docs(args):
9393
cwd=repo_search_path)
9494
repo_root = repo_root.decode('utf-8').strip()
9595
repo_name = basename(repo_root)
96+
if 'x-pack-' in repo_name:
97+
# x-pack-foo repositories expect to be mounted in the foo-extra
98+
# directory so we should oblige them so they'll build. This
99+
# information is sort of available in conf.yaml but it is
100+
# mixed into each book even though it is a property of the
101+
# repository. Thus we hard code it here. Sad, but much less
102+
# complex than digging it out of conf.yaml. Prior to the build_docs
103+
# folks had to check the repos out into a particular directory
104+
# structure but build_docs is host-machine directory structure
105+
# agnostic and we like it that way.
106+
extra_name = repo_name.replace('x-pack-', '')
107+
repo_mount = '/doc/%s-extra/%s' % (extra_name, repo_name)
108+
else:
109+
repo_mount = '/doc/' + repo_name
96110
if repo_root not in mounted_doc_repo_roots:
97111
if repo_name in mounted_doc_repo_names:
98112
raise ArgError("Can't mount two repos with the same " +
@@ -101,10 +115,10 @@ def run_build_docs(args):
101115
mounted_doc_repo_names.add(repo_name)
102116
docker_args.extend([
103117
'-v',
104-
'%s:/doc/%s:ro,cached' % (repo_root, repo_name)
118+
'%s:%s:ro,cached' % (repo_root, repo_mount)
105119
])
106120
build_docs_args.append(
107-
'/doc/' + repo_name + path.replace(repo_root, ''))
121+
repo_mount + path.replace(repo_root, ''))
108122

109123
open_browser = False
110124
args = Args(args)

0 commit comments

Comments
 (0)