Commit Graph

46 Commits

Author SHA1 Message Date
George Kalpakas 5e8bf2f88d build(docs-infra): ensure `dist/` directory is cleaned before running `tsc --watch` (#24372)
PR Close #24372
2018-06-11 09:18:46 -07:00
George Kalpakas ea143e7498 build(docs-infra): upgrade preview server to latest `@types/shelljs` (#24372)
PR Close #24372
2018-06-11 09:18:46 -07:00
George Kalpakas 68078fd620 build(aio): run the upload server as a non-previleged user
closes #19352

Previously, the upload server (for PR previews) was run as root and
"downleveled" to a non-privileged user from inside the node script.

Now, with the latest version of `pm2` (which is used to run the upload server
scripts), we can get rid of that workaround and set the desired UID directly
through `pm2`.
2017-09-25 12:01:42 -07:00
George Kalpakas 620407720c build(aio): upgrade all preview server dependencies 2017-09-25 12:01:22 -07:00
Georgios Kalpakas 06faac8b5c fix(aio): skip PWA test when redeploying non-public commit 2017-08-10 15:59:00 -07:00
Georgios Kalpakas 20556346a3 feat(aio): add API endpoint for notifying about PR updates
This commit adds an API endpoint for notifying the preview server about PR
updates (`/pr-updated`). According to the update, the preview server can take
several actions. Currently, it will only check and (if necessary) update the
PR's preview visibility (but more actions could be supported in the future).
The API can be used with an automatic trigger (e.g. a GitHub webhook) to
instantly update a PR's preview visibility when it changes.

Fixes #16526
2017-07-10 12:30:45 +01:00
Georgios Kalpakas 5a417b8514 feat(aio): implement a way to check and update a PR\'s preview visibility
Previously, `BuildCreator#changePrVisibility()` would throw an error if the PR's
visibility was already up-to-date or if the PR directory did not exist (e.g. was
removed). This method was only used from inside `BuildCreator#create()`, which
had already checked for the existence of the directories.

This commit renames `changePrVisibility()` to `updatePrVisibility()` and makes
it more "forgiving" (i.e. it will only throw if both public and non-public
directories exist). This allows it to be used on events that may or may not have
caused the PR's visibility to change (e.g. a GitHub webhook triggered whenever a
PR's labels change).
2017-07-10 12:30:45 +01:00
Georgios Kalpakas 8cfc2e2ec0 refactor(aio): unify error messages for invalid requests to upload-server
Previously, there was a distinction between GET requests to invalid URLs and all
other requests. This was mainly because the upload-server only accepts GET
requests, but that is not a hard limitation and may change in the future.

Thus, it makes sense to return a 404 response for requests to invalid URLs
regardless of the method used.
2017-07-10 12:30:45 +01:00
Georgios Kalpakas 11647e4c78 refactor(aio): use dedicated `constants.ts` file for e2e-specific constants 2017-07-10 12:30:45 +01:00
Georgios Kalpakas 9e1b61326c refactor(aio): move script to a more relevant directory 2017-07-10 12:30:45 +01:00
Georgios Kalpakas 4268c82898 feat(aio): use shorter URLs for previews
Use the 7 first characters of the 40-chars long SHAs for shorter/cleaner URLs.
The collision probability is extremely low (since all SHAs are further
"namespaced" under the corresponding PR). In case of a collision, the second PR
will not be deployed, in order to avoid overwriting the original build.

(This is a design decision to keep the implementation simple. It can be changed
later if necessary.)
2017-06-29 09:35:22 -07:00
Georgios Kalpakas 3c4eef99be fix(aio): clean up non-public previews
The previous clean-up code for PR directories on the preview server assumed that
all directories were named after the PR number. With the changes introduced
in #17640 it is possible to have PR directories that do not follow that naming
convention (e.g. "non-public" directories).

This PR ensures that both public and non-public directories are removed when
cleaning up.
2017-06-29 09:35:22 -07:00
Georgios Kalpakas f90b35a85e test(aio): add e2e tests for non-public previews 2017-06-23 11:54:20 -07:00
Georgios Kalpakas 8ae0eec230 feat(aio): enable previews for any PR
This commit introduces the ability to show previews for PRs by any author. It works as follows:

- The build artifacts of all PRs are uploaded to the preview server.
- Automatically verified PRs (i.e. from trusted authors or having a specific label) are deployed and
  publicly accessible as usual.
- PRs that could not be automatically verified are stored for later use (after re-verification).
- A PR can be marked as "trusted" and make its preview publicly accessible by adding the GitHub
  label specified in the `AIO_TRUSTED_PR_LABEL` env var of the preview server.

At the moment, there is no automatic mechanism for notifying the preview server about changes to the
PR's verification status. The PR's "visibility" will be checked and updated every time a new build
is uploaded.
2017-06-23 11:54:20 -07:00
Georgios Kalpakas 0fe685102f refactor(aio): simplify preview server build events 2017-06-23 11:54:20 -07:00
Georgios Kalpakas a98440bb85 test(aio): add missing unit test for preview server 2017-06-23 11:54:20 -07:00
Georgios Kalpakas 3112311134 test(aio): fix preview server tests on Windows 2017-06-23 11:54:20 -07:00
Georgios Kalpakas 1b13bdea4b build(aio): upgrade preview server dependencies 2017-06-23 11:54:20 -07:00
George Kalpakas 593fe5ed25 build(aio): enable HTTP/2 on the preview server (#16826)
Fixes #16780
2017-05-16 21:07:28 -07:00
Georgios Kalpakas 21d213dfc7 refactor(aio): drop `run` (from `yarn run`), rename script and remove unnecessary cmds 2017-05-12 11:37:21 -07:00
Georgios Kalpakas bcefc61da4 ci(aio): correctly catch PR preview pre-verification errors
Previously, `aio/aio-builds-setup/scripts/travis-preverify-pr.sh` was supposed
to exit with 1 if a PR did not meet the preconditions and 2 if an error occurred
during pre-verification.
It relied on the exit codes of the node script that did the actual work, but
didn't account for errors that would be thrown in the `sh` script itself (e.g.
if the node script was not available). This caused such errors to appear as
non-verified PRs, instead of real errors that should fail the build.

This commit swaps the exit codes, so that now a 2 means non-verified PR and 1
designates an error.
2017-05-12 11:37:21 -07:00
George Kalpakas 14b7dfa007 fix(aio): create a proper commit link on preview comments (#15941)
Previously, only a few characters of the SHA would appear on the preview link
comment posted on the PR. This was usually enough for GitHub to create a link to
the corresponding commit, but it was possible to have collisions with other
commits with the same first characters (which prevented GitHub from identifying
the correct commit and create a link.)

This commit fixes this issue by including the full SHA on the commentso GitHub
can identify the correct commit and create the link. GitHub will automatically
truncate the link text (by default to 7 chars unless more are necessary to
uniquely identify the commit).
2017-04-13 11:55:33 -07:00
Georgios Kalpakas d263595c63 ci(aio): do not fail when re-deploying preview for the same PR/SHA
Previously, when trying to upload the build artifacts for a PR/SHA that was
already successfully deployed (e.g. when re-running a Travis job), the preview
server would return a 403 and the build would fail.

Since we have other mechanisms to verify that the PR author is trusted and the
artifacts do indeed come from the specified PR and since the new artifacts
should be the same with the already deployed ones (same SHA), there is no reason
to fail the build. The preview server will reject the request with a special
HTTP status code (409 - Conflict), which the `deploy-preview` script will
recognize and exit with 0.
2017-04-13 11:26:21 +01:00
Georgios Kalpakas 15662efec4 build(aio): update project config for @angular/cli v1.0.0
This is a follow-up to 487a0e1. The changes are based on [this wiki entry][1].

[1]: https://github.com/angular/angular-cli/wiki/stories-1.0-update.
2017-03-27 11:55:26 -07:00
Georgios Kalpakas 0c5f893f6e test(aio): improve test description and expectations 2017-03-13 10:30:49 -07:00
Georgios Kalpakas 17f5f3b32c ci(aio): fix clean-up script on `ngbuilds.io` 2017-03-13 10:30:49 -07:00
Georgios Kalpakas cbde75e77b feat(aio): redirect HTTP to HTTPS 2017-03-13 10:30:49 -07:00
George Kalpakas fa1920a02b feat(aio): enable deep-linking on deployed apps (until prerendering is done) (#15049) 2017-03-13 09:35:16 -07:00
Georgios Kalpakas 174d4c8ef7 ci(aio): do not deploy PR if preconditions not met
This avoids incorrectly failing the build if the PR author is not a member of one of the whitelisted GitHub teams.
2017-03-07 18:24:45 -08:00
Georgios Kalpakas 4210d2b4b1 test(aio): fix e2e tests 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 03a5fd01c9 fix(aio): do not hardcode the domain in preview link comments 2017-03-07 18:24:45 -08:00
Georgios Kalpakas d28ea80db8 build(aio): always compile before running tests 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 0e9277b4c3 style(aio): change mock value for consistency 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 2796790c7d feat(aio): verify uploaded builds based on JWT from Travis 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 3ed1f64d43 feat(aio): implement `BuildVerifier` 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 96f11dad18 feat(aio): implement `GithubTeams` 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 060d02eb82 fix(aio): remove unnecessary `repoSlug` parameter from `GithubApi` 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 951e653b0c feat(aio): implement `GithubApi.getPaginated()` 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 37348989f0 feat(aio): make `githubToken` mandatory for `GithubApi` 2017-03-07 18:24:45 -08:00
Georgios Kalpakas c5644e5a0d refactor(aio): add `assertNotMissingOrEmpty()` helper 2017-03-07 18:24:45 -08:00
Georgios Kalpakas c8d87a936b feat(aio): add support for HTTPS (certificates provided by host - fallback to self-signed) 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 6b8413f7b3 build(aio): update TypeScript (and other dependencies) 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 8a8d4fe24f test(aio): fix typos (repoSlag --> repoSlug) 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 9df9bdc0f5 style(aio): correctly type tuple 2017-03-07 18:24:45 -08:00
Georgios Kalpakas c8ead9bcd0 refactor(aio): use types intead of interfaces for functions 2017-03-07 18:24:45 -08:00
Georgios Kalpakas 115164033b ci(aio): add initial implementation for aio-builds setup 2017-03-07 18:24:45 -08:00