ci(aio): change AIO preview server stuff to use CircleCI#23576
ci(aio): change AIO preview server stuff to use CircleCI#23576petebacondarwin merged 11 commits intoangular:masterfrom
Conversation
d9fe1fa to
7b4459a
Compare
aio/scripts/build-artifacts.sh
Outdated
There was a problem hiding this comment.
can we call this file with a more specific name? maybe aio-snapshot.tgz?
There was a problem hiding this comment.
How about aio/aio-snapshot.tgz?
c068ebd to
a5a8942
Compare
439f2d1 to
d50ffdc
Compare
gkalpak
left a comment
There was a problem hiding this comment.
Half-way through (mostly reviewed anything outside scripts-js/).
.circleci/config.yml
Outdated
There was a problem hiding this comment.
AFAICT, destination needs to be kept in sync with AIO_ARTIFACT_PATH in preview server's Dockerfile. It is a good idea to add a comment about that too 😁
There was a problem hiding this comment.
This is because we want to test failures where the artifact is too large. Rather than having to create an enormous file, I just set this a "bit" lower :-)
There was a problem hiding this comment.
But why set it a "bit" lower (for tests)?
There was a problem hiding this comment.
I don't understand the question. I set it lower because in the tests we now actually create a mock file that is returned from the mock CircleCI API. To test that the max-size check is working we would have to create a mock file that is larger than 20971520 bytes. What is the point of that when we can just set the limit to something smaller?
There was a problem hiding this comment.
could we jump to v10 instead?
There was a problem hiding this comment.
I'll see if we can
There was a problem hiding this comment.
It looks like the JS tests all pass so we should be fine with Node 10
aio/aio-builds-setup/docs/_TOC.md
Outdated
There was a problem hiding this comment.
Note: These files are made executable on the preview server. So there is no need to have them executable here (unless you want to execute them outside of the docker container...which you probably shouldn't be doing 😛).
There was a problem hiding this comment.
These new scripts (dev.sh, run-tests.sh, test-env.sh) should be documented in overview--scripts-and-commands.md.
There was a problem hiding this comment.
They are actually documented in misc--debug-docker-container.md. I'll add a bit to overview--scripts-and-commands.md for good measure.
There was a problem hiding this comment.
I feel a littlevery uncomfortable having this on the production server 😱
There was a problem hiding this comment.
Still feeling uncomfortable.
As discussed, we could have these scripts in a directory that is not included in the docker container by default, but could be explicitly attached (e.g. as a volume).
There was a problem hiding this comment.
This file no longer exists. It has been replaced by verify-setup-and-log, which no longer deletes anything:
aio-verify-setup
ls -t /var/log/aio/upload-server-verify* | head -1 | xargs cat
d50ffdc to
ffb223d
Compare
|
@gkalpak I have addressed yourr comments and reordered the commits. But I still have some tidying up to do in the TypeScript files - later today. |
There was a problem hiding this comment.
So the key change here is that we now must also clean the downloads folder, which is populated with artifacts downloaded from CircleCI.
There was a problem hiding this comment.
Note that the specific GitHub API classes (like Teams and Pull Requests) now use this helper class by composition rather than inheritance. Therefore I had to make getPaginated a public method to expose it to these classes.
There was a problem hiding this comment.
Why using composition over inheritance?
There was a problem hiding this comment.
Composition provides a number of benefits. We only need to create on instance of the underlying GithubApi service, we can test that service independently of the subclasses that use it; and the clients of this service get a clean public API to work against.
There was a problem hiding this comment.
Throwing and catching is simply to capture the stack trace to make debugging easier.
ffb223d to
a91bb05
Compare
There was a problem hiding this comment.
I wonder if we need to use a Dependency Injection framework here? :-P
There was a problem hiding this comment.
I converted these methods to static because really creating an instance of this class was unnecessary - there is not state in the class. The only reason I didn't pull them out into independent exported functions is that it is nice to have them in a container so that it is simple to spy/mock them for testing.
There was a problem hiding this comment.
Here is the meat of the change to this file - the new handler for the circle-build request.
There was a problem hiding this comment.
I don't believe I made any substantive change to the pr-updated request handler, other than a sprinkling of await.
c0012b4 to
2c4fc68
Compare
|
You can preview 2c4fc68 at https://pr23576-2c4fc68.ngbuilds.io/. |
The server no longer has files uploaded to it. Instead it is more accurate to refer to it as dealing with "previews" of PRs.
fba0882 to
92c8752
Compare
Related discussion: angular#23576 (comment).
…anges Mostly (but not exclusively) a follow-up to angular#23576.
Related discussion: #23576 (comment). PR Close #25671
Related discussion: #23576 (comment). PR Close #25671
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The system now waits for a CircleCI webhook to tell the upload server that a build has completed.
The upload server then pulls down the build artifact and passes it along as before to the rest of the preview creation logic.
This means that there is no need to store a secret on CircleCI for pushing the artifacts to the upload server; which means that we no longer rely upon JWT.
The downloaded artifact is stored in a temp location; this is cleared out along with the actual preview builds by the periodic cleanup task.
There are some (self-serving) changes to the testing of components that were not significantly changed for this PR. This includes more use of
async/awaitfor managing async tests; and also making some API public (rather than protected). This allows us to unit test, while maintaining type safety. Previously, we had to cast toanywhich meant that changes to the API may not be passed through to the unit tests.TODO: