-
Notifications
You must be signed in to change notification settings - Fork 12k
angular-cli in a CI/CD schenario #7767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @snarum, I'm not sure I'm following one thing about your setup. When running As for gzip, that should really be done by your server. Most server environments will automatically gzip your javascript. There should be no change in there. If your setup doesn't, running Am I missing something? If not, then running Leaving this open but if we don't hear back from your we'll close this issue as answered. Cheers! |
Hi @hansl What I am struggling with is to see how angular-cli fits in a CI/CD scenario. In my head, the CI step should produce a set of artifacts and the CD step should put these artifacts in any given environment. If the tests are ok, the same artifacts could be promoted to another environment, say A-Test or Production. That way we know what artifacts we have tested, and can eliminate all build step bugs. To make angular-cli fit in such a setup I have two choices:
option 1 has the benefit of very small/few artifacts and fast deployment. but we have to decide at build time if we want to minify or not. There is also the issue with angular-cli enviroment configs. these are packed into the artifacts in option 1, so if I choose that I have to make another .json file to store my environment specific settings. I'm quite new to building javascript applications, so I'm trying to wrap my head around how this should be done. On server side code Release/debug builds causes similar issues. Any comments or recommendations are appreciated. Regards. |
Your CI should test on every PR, then whatever CI step is used for deployment (when merged in master for example), you should run Your option 1 sounds good, but with View |
Ok, but in my dream world I would build once, deploy many times. I would want to be able to reuse the artifacts from test to atest and prod if the business side or testers accepts the functionality. If I have to differentiate on In my ideal scenario So what I would like is something like this: This way I can keep my artifacts small and I can deploy the same artifacts to many servers without rebuilding. I can also decide which environments I should test the minified artifacts, and deployment would be very fast. Just my thoughts :) You can go ahead and close this issue now if you want. I realize that this is not really a problem with angular-cli, but rather a method problem. As for Release/Debug I select either Release or Debug for a project. Testing Debug and releasing Release artifacts is just too high a risk. Thanks for your time. |
The multiple environments part of this discussion is covered in #3855 by the way. Will close this as I don't think there's any action on our part now. |
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. |
ng version 1.1.3
I'm trying to make angular-cli fit in my continuous delivery setup, but I am having one issue with the way the bundling works.
In my initial setup I had a build which which did the following:
and then collected the dist folder for artifacts.
During deploy I could just copy the artifacts to my web server. This worked very well.
But then I thought, how does this setup fit when I wish to deploy to production, and want to minify and gzip my javascript? Using ng I cannot find a way to minify the artifacts, without including the source code, and running ng --prod on the source code again.
So to fix this I moved the ng build step from the build and added it to my deployment script instead, and added all source files to the artifacts of the build. This resulted in build and deploy time to go from a few seconds to 5-6 minutes on a tiny project, mostly because node_modules is included in the artifacts.
In addition to the time consuming build, with this approach is that I don't really test the same artifacts in test and prod, as I am bundling separately for each environment.
So my question is this, am I doing something stupid here? Is there better ways to do this? If not, is it possible to add an option to ng which will take an existing dist folder and gzip/minify it? This way I could add this step to deployment when targeting to Atest/prod level environments.
The text was updated successfully, but these errors were encountered: