runtime-version: Update for custom hosts and lts#695
runtime-version: Update for custom hosts and lts#695sebastianbenz merged 3 commits intoampproject:masterfrom
Conversation
* Prefer the /rtv/metadata endpoint if available, but fall back to
constructing an RTV from the release type (prod, canary, or lts)
code and the version, available from /version.txt. This broadens
support for self-hosted runtimes. If /rtv/metadata data is available,
continue trusting it without additional validation. If the version is
retrieved from /version.txt, then ensure /rtv/<rtv>/version.txt also
exists before assuming it is valid.
* Remove unnecessary RTV padding. There is nothing in amphtml that
prevents a version from being defined by
gulp dist --version_override="v1.2a"
* Support lts flag, both as an argument to .getVersion() and as a CLI
argument.
* Update test spec to use fetch-mock so network requests are not made.
|
Here are some samples of runtime version lookups supported by this PR: AMP Project LTS Self-hosted runtime with custom version string Self-hosted canary runtime with custom version string Bing does not have Bing does not have canary releases and |
|
With respect to bullet point "Remove unnecessary RTV padding. There is nothing in amphtml that |
We only have to worry about 15-digit RTVs. I still question any benefit of padding a result from |
The padding is a leftover from the time before we had a /rtv/metadata endpoint. |
| let response; | ||
| try { | ||
| response = await this.fetch_(versionTxtUrl); | ||
| } catch (ex) {} |
There was a problem hiding this comment.
please add a comment explaining why we can ignore the exception
There was a problem hiding this comment.
Comment added. Thanks for reviewing!
|
Thanks! |
ltsflag, both as an argument to.getVersion()and as aCLI argument.
/version.txtif/rtv/metadatais not available.This feature is only available for standard
prodlookups, itis not used when a
canaryorltsrelease is requested. Thislessens the requirements for self-hosting the runtime.
the result is going to ever result in a valid RTV.
undefined(or empty string in CLI) when versionis not available.