Commit Graph

13 Commits

Author SHA1 Message Date
Charlie Egan a7fa31d56e [docs] Fix unversioned built-in docs issue (#6274)
Fixes https://github.com/open-policy-agent/opa/issues/6269

This fixes the issue by using the builtin_metadata.json file from each
version, the assumption that docs content that depends on the data
doesn't exist before this file was introduced.

I have removed the 'available' check since we haven't consistently
updated the file in the past, e.g.

* https://github.com/open-policy-agent/opa/blob/v0.41.0/builtin_metadata.json#L12710
* https://github.com/open-policy-agent/opa/blob/v0.57.0/builtin_metadata.json#L563

These examples show that sometimes the current version is included,
other times the file is updated after the release.

Video showing the correct content being displayed for various versions:

https://github.com/open-policy-agent/opa/assets/1774239/abf1af7d-9c59-4223-a019-c73d7550b322

To locally test this:

```
git clean -dfx
cd docs
make generate hugo-production-build
hugo server --source website --contentDir generated --ignoreCache --minify
```

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-10-05 09:28:40 +01:00
Charlie Egan eb03ff229d [website] Include static hugo pages in prod build (#6001)
This was only added for dev in https://github.com/open-policy-agent/opa/pull/5984/files#diff-cdec797dddf8fc387304501d6bd4f318e1e9067c6fae012dfa8b69fd85fd3248R33

I missed this as I thought the preview would run the prod commands

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-06-12 11:46:52 +01:00
Stephan Renatus e09b04f2a9 website: make local dev and PR preview not build everything (#4474)
With this change, the work done for local development, and the per-PR netlify preview changes:

It will no longer include the website stuff for versions other than edge, the current working tree.

We thus save us the time, and the flakiness, involved with

- checking if github has release binaries for all the versions
- checking out their sources
- fetching the release binaries to pre-hydrate old versions' live-blocks.

The previously-used, documented make target should still be intact.

Fixes #4379 to some extent, I hope.

* docs/website: remove "latest" binary from opa versions cache

Having a stale binary here -- one called "latest" but not actually
being "latest" -- causes issues like this: when building the website
content for the (real) latest version, the script would take the
old (previous-latest) binary, and fail because that binary didn't
know the latest future keywords.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-03-25 09:59:44 +01:00
Stephan Renatus 429cfe78a2 website/load-docs.sh: add versioned docs for latest version (#4222)
With this change, we should get both a /docs/v0.36.1 and a /docs/latest
in our deployed docs.

Before, the symlink would have made hugo only build a /docs/latest,
but not the other link.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-01-13 11:41:17 +01:00
Stephan Renatus 64cff0c5d3 website/load-docs: skip first, check later (#3987)
The website deployment takes longer than it has to because we're
checking for binaries we don't really care about: those predating
the website, and those of release candidates.

Now, we'll only curl for those we don't skip.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-11-08 14:29:44 +01:00
Torin Sandall 6fdd7f5b87 website: Do not build for versions without a GitHub release (#3982)
This should avoid transient errors when the site builds while the
release is still in-progress.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-11-06 07:54:48 +01:00
Stephan Renatus 79dbbb2450 website/build: misc changes to website build scripts (#3886)
* website/scripts/load-docs.sh: less verbose output

1. Less output: the tag semver ordering isn't something we work
   on daily, so let's silence that.

2. Use 'git archive' and tar, not a checkout:
   this way, we don't mess up the working directory or reflog. It
   should also be faster, since we don't end up writing all the
   vendor files, binary blobs, etc to disk.

3. Make the 'latest' symlink relative.

* scripts/live-blocks/inject: run preprocess with max allowed args

Before, when attempting to do this, I had used

    find ... -exec npm run preprocess {} +

and find had determined what the maximum number of allowed command
line args were, and executed that call in batches of those. `npm`,
however, would have prepended the call with its own args, thereby
exceeding the limit.

As a way out, we had used `xargs -n200`, to preprocess the files
in batches of 200 at a time.

Now, we're telling `find` the exact command needed, bypassing the
package.json helper definition.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-10-13 17:59:59 +02:00
Patrick East 7002b6f92b Add support for release candidate version tags
Any release tag with a `rc` string in the the semver
will be ignored for the docs on the website and will _not_ update the
"latest" docker image tag, or "latest" downloads url.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2020-03-26 11:55:49 -07:00
Patrick East 7a9a78fa2a docs: Use full copy for latest instead of shadow
Instead of using url rewriting tricks we will just copy the latest
docs as part of the build process for a "latest" version.

In the version selector code we need to handle this to hide the
version, but overall it simplifies the template code.. so thats nice.

Best part, and main reason for doing this, is that the pretty url
feature will now work on the `/docs/latest/*` urls. It will fix some
weirdness with the relative url links we use in the markdown content
and remove a duplicate search result.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-10 09:58:50 -07:00
Patrick East 13f1de2982 docs: Stop showing versions <0.10.7
This lets us simplify some of the code and there isn't really a great
reason to keep the older docs up at this point.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-10 09:58:50 -07:00
Patrick East 968ad5919c docs: Fix load-docs.sh when HEAD is both a tag and branch
If there was a tag and branch that both referenced HEAD it would
return to the tag instead of branch. This change gives priority to
the branch if the current HEAD corresponds to one.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-10 09:58:50 -07:00
Patrick East 994997479f Remove "RELEASES" file from docs/website build
We were using a file with hard coded versions to display docs for, but
this complicates things if/when we need to do patch releases on
different branches from master.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-06-13 11:31:58 -07:00
Patrick East 58d336aff9 Refactor doc directories
Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-04-26 17:12:15 -07:00