Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Do not rewrite links in symlinked files #305

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

giordano
Copy link
Member

@giordano giordano commented Apr 8, 2024

If we rewrite the hyperlinks in symlinked files we risk to accidentally append duplicate ${PREVIEW_SUBDIR}, depending on the order with which find operates on the files.

Should fix #304.

@giordano giordano added the documentation Improvements or additions to documentation label Apr 8, 2024
@giordano
Copy link
Member Author

giordano commented Apr 8, 2024

@tkoskela I'm not crazy, right? This line after rewriting the links is

- [Installation](https://ukri-excalibur.github.io/excalibur-tests/preview/PR305/install/)

right? But then the generated website has the duplicate subdir

<li><a href="https://ukri-excalibur.github.io/excalibur-tests/preview/PR305/preview/PR305/install/">Installation</a></li>

@giordano
Copy link
Member Author

giordano commented Apr 8, 2024

As far as I understand: the link rewriting command is working as intended, but mkdocs sometimes is doing something stupid when generating the HTML files. I say "sometimes" because in #295 it was working correctly.

@giordano giordano force-pushed the mg/fix-rewrite-preview-links branch 2 times, most recently from c1dca41 to 45e2fdc Compare April 9, 2024 17:37
@giordano giordano changed the title [CI] Debug wrong links in docs previews [CI] Do not rewrite link in symlinked files Apr 9, 2024
@giordano giordano changed the title [CI] Do not rewrite link in symlinked files [CI] Do not rewrite links in symlinked files Apr 9, 2024
If we rewrite the hyperlinks in symlinked files we risk to accidentally append
duplicate `${PREVIEW_SUBDIR}`, depending on the order with which `find` operates
on the files.
@giordano giordano force-pushed the mg/fix-rewrite-preview-links branch from 45e2fdc to 120e706 Compare April 9, 2024 17:38
@giordano giordano marked this pull request as ready for review April 9, 2024 17:39
@giordano
Copy link
Member Author

giordano commented Apr 9, 2024

After a long time staring at the screen to spot the error, I believe now I understand the problem: the find command is editing all *.md files, but some of them are symlinks, and so there's the risk to rewrite the links twice if the original file is modified first, and the symlink is modified afterwards (once the symlink is modified by sed it's turned into a real file and the symlink is broken, if the order is inverted we wouldn't get double rewrite of the same file).

This probably also explains why the error was occurring occasionally: the occurrence of the error depends on the order with which find operates on the files, which is probably unspecified and can change from run to run.

Note that the links are finally correct in 22d3f8e (triggered by adf2e95) and stayed the same in the three subsequent commits (22d3f8e...3e11c4b)

@giordano giordano requested a review from tkoskela April 9, 2024 17:48
@giordano giordano merged commit 47da51d into main Apr 10, 2024
2 checks passed
@giordano giordano deleted the mg/fix-rewrite-preview-links branch April 10, 2024 12:36
github-actions bot pushed a commit that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken URLs in preview docs
2 participants