1. 27 10月, 2020 1 次提交
    • A
      Rewrite the link re-writing logic · c09354a6
      Andrea Frittoli 提交于
      The previous logic parses URLs with a regex first and then using
      the markdown library. It then uses urlopen().read() to validate
      links.
      
      We use now the markdown library only to extract the list of links,
      and then urlparse to deconstruct, analyse, adapt and reconstract
      the link. We do not attempt to fetch links anymore, which means
      that external links are not guaranteed to be working.
      
      Absolute URLs are not changed (they may be external)
      Fragments are relative to the page and do not need changes
      Path only links should point to a file synced to the website
      but sometimes the file may be missing (if it's not in the sync
      configuration), so we follow this approach:
      - prefix with base_path and check for the file locally
      - if not found, prefix with base_url instead
      
      Note that urlparse treats URLs without scheme like path only
      URLs, so 'github.com' will be rewritten to base_url/github.com
      Signed-off-by: NAndrea Frittoli <andrea.frittoli@gmail.com>
      c09354a6
  2. 21 10月, 2020 1 次提交
    • P
      refactor sync script · c4894b3a
      popcor255 提交于
      As a developer, it is difficult to make changes to a script and ensure that nothing is broken without tests. Test are added in this patch with 80% code coverage. The script has also been refactored to increase readability. This refactor is not a pure refactor. The sync did not work properly. There is a list of bugs that reported the script generating broken links, #160, #126, #158, #133, #134. This refactor also includes a patch that fixes these bugs. The patch redirects a user to github if there is a relative link to a file that does not exist. This is important because some links will reference a snippet of code, test, or example. These artifacts are not docs, they are not rendered properly on the site. It is better to redirect the user to the intended artifact if the file is not synced. This prevents random 404s, and preserves the original behavior of the sync script. There are other approaches to fix this bug. This includes, manually editing links, downloading the files that the broken link are referencing in the sync config file, or removing the broken links. This is the best approach because broken links are automatically fixed and do not require manual intervention. This approach causes a side effect of not requiring the config file to be up-to date because the script will redirect the user to github. We want to encourage frequent sync. So eventually, this script should become tekton-ified (tekton task) and placed into the tekton catalog repo. Sync needs to become a tekon task in order for every repo to sync docs on push event.
      c4894b3a
  3. 15 6月, 2020 1 次提交
    • B
      Dockerize sync tool. · 85a5dcbf
      Billy Lynch 提交于
      This achieves a few things:
      
      1. Creates Dockerfile for sync tool, so that it can be invoked from
         Tekton tasks.
      2. Makes sync config directory configurable by flag, so that the tool
         can be ran from any directory. This defaults to sync/config (same as
         before).
      
      Symlinks are retainined in the root directory for requirements.txt and
      runtime.txt to satisfy Netlify Build requirements:
      https://docs.netlify.com/configure-builds/manage-dependencies/#python
      
      Issue: #34
      85a5dcbf
  4. 17 2月, 2020 2 次提交