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

chore: add a tool to check links [POC] #618

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

tbouffard
Copy link
Member

@tbouffard tbouffard commented Sep 15, 2023

WIP
Covers #430 and #594.

Use htmltest: https://github.com/wjdp/htmltest

Configuration of the preview script use to build the site that is checked. This is why we are not using the production build for the checks:

  • only build the supported version: out-of-support content is not updated
  • no "edit this page": generate a lot of links to GitHub, this is an Antora feature, we don't want to test that
  • force usage of the production navbar to have the content as close as possible of the production site
  • use a dedicated "type" option to produce convenient HTML files for URL checks (HTML extension for local file browsing, no redirect pages)

The GH workflow enables the real use of Antora Atlas to resolve links to pages not built in the preview (links to pages related to unsupported versions). This may consume extra bandwidth in our Netlify plan.

Remaining tasks

  • explain how to install locally in the readme or in a dedicated doc file. Including links resolutions to pages of unsupported version (with Antora Atlas)
  • upload the artifact of the build site
  • upload the artifact of htmltest logs
  • configure user agent to better simulate a user. LinkedIn reject request from htmltest or curl without specific user agent. Work with curl by setting "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0"
  • review the htmltest configuration to ignore dependencies pages as they are generated and we cannot changes wrong external links. Try to use the IgnoreURLs option - IgnoreDirs cannot be used as the dependencies pages are located in the ROOT module at the root of the directory.
  • how do we handle refcache update? commit the cache periodically by creating a PR after the execution ?
  • build on schedule: do we send a slack notification on error?
  • remove extra changes used during development
  • plan fixes in the documentation content repository

Example of preview commands to generate the site to check locally

Single component version

./build-preview-dev.bash --hide-edit-page-links true --force-production-navbar true --type links-check --local-sources --component bonita --branch 2022.2
./build-preview-dev.bash --hide-edit-page-links true --force-production-navbar true --type links-check --local-sources --component cloud --branch master

Note:

  • it is possible to activate Atlas reference resolution by installing Antora 3.2 alpha
  • in this case, the link resolution is done with the production site if the page is not available locally
  • this could help to test smaller part of the site by also checking some part of the production site (consume more bandwith for the Netlify site)

Build whole site (include bonita out of support version)

./build-preview-dev.bash --hide-edit-page-links true --force-production-navbar true --type links-check --local-sources --use-all-repositories true

Command to only build supported versions
The real check requires to enable Antora Atlas.
Otherwise, some cross references are not resolved like WARN: missing ref for bonita 2021.1 - some content have xref to this version

./build-preview-dev.bash \
  --hide-edit-page-links true \
  --force-production-navbar \
  --type links-check \
  --use-multi-repositories \
  --component-with-branches bcd:3.6,4.0 \
  --component-with-branches bonita:archives,2021.2,2022.1,2022.2,2023.1,2023.2 \
  --component-with-branches central:1.0 \
  --component-with-branches cloud:master \
  --component-with-branches labs:master \
  --component-with-branches test-toolkit:1.0,2.0 \
  --local-sources

Output

analysis of supported versions (without bonita 2021.1) 2023-09-01
✘✘✘ failed in 11m27.1693513s
987 errors in 3135 documents

Installation options

$ curl https://htmltest.wjdp.uk | bash -s -- -h
bash: download go binaries for wjdp/htmltest

Usage: bash [-b] bindir [-d] [tag]
  -b sets bindir or installation directory, Defaults to ./bin
  -d turns on debug logging
   [tag] is a tag from
   https://github.com/wjdp/htmltest/releases
   If tag is missing, then the latest will be used.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2023

🎊 PR Preview c7f6a8f has been successfully built and deployed to https://bonitasoft-bonita-documentation-site-test-pr-618.surge.sh

🕐 Build time: 0.013s

🤖 By surge-preview

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2023

🎊 PR Preview 944a9bb has been successfully built and deployed to https://bonitasoft-bonita-documentation-site-site-pr-618.surge.sh

🕐 Build time: 0.013s

🤖 By surge-preview

@sonarcloud
Copy link

sonarcloud bot commented Sep 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

run: npm install --save-dev [email protected]
- name: Build site
run: |
./build-preview-dev.bash --hide-edit-page-links true --force-production-navbar true --type links-check --component bonita --branch 2023.1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Currently, we only check a single bonita branch, we should check the whole site

Copy link

sonarcloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

# Conflicts:
#	.github/workflows/build-pr-site.yml
#	.github/workflows/publish-pr-preview.yml
Copy link

sonarcloud bot commented Oct 23, 2024

rbioteau pushed a commit to bonitasoft/bonita-doc that referenced this pull request Oct 28, 2024
The former URL was still used and hardcoded in the "Studio Update" page.

### Notes

Detected with
bonitasoft/bonita-documentation-site#618 as part
of bonitasoft/bonita-documentation-site#594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant