Build: expose VCS-related environment variables (#10168)
* Build: export `READTHEDOCS_CANONICAL_URL` variable
This variable communicates what's the canonical URL for the version it's running
the build. It will allow doctool/theme authors to implement the correct HTML tag
required:
```
<link rel="canonical" href="" />
```
Note the final `href` on each page will be `READTHEDOCS_CANONICAL_URL` + `page`.
Closes https://github.com/readthedocs/readthedocs-ops/issues/1320
* Docs: document `READTHEDOCS_CANONICAL_URL`
Add it to the reference page.
* Docs: add another example
* Test: check the `READTHEDOCS_CANONICAL_URL` is present
* Apply suggestions from code review
Co-authored-by: Benjamin Balder Bach <benjamin@readthedocs.org>
* Update docs/user/reference/environment-variables.rst
Co-authored-by: Benjamin Balder Bach <benjamin@readthedocs.org>
* Docs: fix references
* Test: check for `canonical_url` on Version endpoint
* Build: expose VCS-related environment variables
Introduce 3 new variables:
* `READTHEDOCS_REPOSITORY_URL`
* `READTHEDOCS_REPOSITORY_IDENTIFIER`
* `READTHEDOCS_REPOSITORY_IDENTIFIER_HASH`
Closes #9423
* Apply suggestions from code review
Co-authored-by: Benjamin Balder Bach <benjamin@readthedocs.org>
* Update docs/user/reference/environment-variables.rst
* Build: rename the env variable to use CLONE_URL
We will want to expose `HTML_URL` as well, but that will require some extra work
since we don't have access to `RemoteRepository` from the builder.
I'm keeping it commented for now, but reserving the names.
* Build: rename env variables to use GIT on their names
---------
Co-authored-by: Benjamin Balder Bach <benjamin@readthedocs.org>