elastic/docs

Building ES docs against git worktree fails

henningandersen opened this issue · 4 comments

Using git worktree for different branches of ES is common. Running the docs build in a worktree (or perhaps just a folder not called elasticsearch) does not seem to work.

My setup is that I have a GIT_HOME with:

docs
elasticsearch (master)
elasticsearch-7.x (worktree)
elasticsearch-7.11 (worktree)
...

I can successfully run the docs build from the master git directory. But if I run it from any of my worktrees it fails:

cd $GIT_HOME/elasticsearch
git worktree add ../elasticsearch-7.x 7.x
cd $GIT_HOME/elasticsearch-7.x
$GIT_HOME/docs/build_docs --doc $GIT_HOME/elasticsearch-7.x/docs/reference/index.asciidoc --resource=$GIT_HOME/elasticsearch-7.x/x-pack/docs/ --chunk 1
INFO:build_docs:Building HTML from /doc/elasticsearch-7.x/docs/reference/index.asciidoc
INFO:build_docs:Couldn't find repo toplevel for /doc/elasticsearch-7.x/docs/reference
INFO:build_docs:Guessed toplevel=[/doc/elasticsearch-7.x/docs/reference] remote=[0] branch=[master] repo=[repo]
INFO:build_docs:Couldn't find repo toplevel for /doc/elasticsearch-7.x/x-pack/docs
INFO:build_docs:
INFO:build_docs:asciidoctor: ERROR: modules/cluster/misc.asciidoc: line 123: include file not found: /doc/elasticsearch-7.x/docs/reference/modules/cluster/{elasticsearch-root}/docs/reference/indices/dangling-indices-list.asciidoc
...
(lots of errors)

I can workaround this by checking out the branch in my master elasticsearch dir, but it is a bit inconvenient. Thus not urgent in any way.

It seems worktree support was added in #860.

Thanks, @henningandersen!

perhaps just a folder not called elasticsearch

I think this is the important factor.

As I understand it, #860 allowed $GIT_HOME/elasticsearch/ to be a worktree, but there's a lot of code (and references within AsciiDoc files) that still depends on it being named exactly elasticsearch. If you made the "main working tree" at elasticsearch-master and then a "linked working tree" with 7.x at elasticsearch, it should still work.

The amount of work needed to fix this would be pretty large, I think, so I don't expect to have time to fix it anytime soon. But I'll leave this open in case anyone else comes across the issue.

I'm experiencing doc build failures for the kibana docs too whereas the docs used to build for me around 2 months ago.

@TinaHeiligers I wanted to check and make sure your failures didn't have anything to do with worktrees, and that your problems were fixed by #2586 ?

Magic! Thanks for looking into it @gtback
Screen Shot 2022-12-22 at 12 45 25 PM