4

A great way to perform continuous integration with angular CLI and Jenkins

 3 years ago
source link: https://www.codesd.com/item/a-great-way-to-perform-continuous-integration-with-angular-cli-and-jenkins.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

A great way to perform continuous integration with angular CLI and Jenkins

advertisements

I trying to configure a correct way to perform a continious integration with Angular CLI.

Just for fun, I manage my Jenkins in Windows and I have created a test project with Angular CLI.

This project is bound to Bitbucket remote and I using Sourcetree as version control system.

But I have multiple questions about the correct workflow to apply because i'm pretty confused.

1) Angular CLI allow us to build a project with command ng build. It create a folder named dist. Ok, but this folder is ignored in .gitignore, why ? I mean, I need this folder because this is used by my Jenkins job for deploy it across FTP in my domain, no ? If the folder is ignored, it will not be available in remote bitbucket, so unusable by Jenkins.

2) Jenkins is used to perform some tasks for the deployment. It shouldn't be used to do the same thing like ng build ? In my mind, the concat, minification, etc... should be integrate in the job task, do I 'm right ? According this with split the "build" task ?

I need some clarification. This is the first time that I'm doing this.

Thank's you.


  1. the build artifacts, generated code, compiled classes...etc. are NOT source controlled as a best practice. the source code is your source of truth, so anything you can build/preprocess from there is ignored from source control. typically, your the jobs in your build pipeline package your application/artifacts and deploy it some repository for future use or delivery, or archive via Jenkins.

  2. in Jenkins, you can specify downstream jobs that can be manually or automatically triggered depending on the configuration. I personally prefer to have a base initial build job that gets triggered by SCM via a service hook when there is a push, which builds the artifacts/app first, and also archive the build artifacts to an artifact repository. you can have a downstream delivery job that can do the deployment of the build artifacts and here you can utilize several Jenkins plugins for the deployment depending on your use case. By the way, once you setup upstream/downstream relations in the build jobs, you can create a pipeline view by selecting the initial job. it creates a nice view of the pipeline.

I recommend you to also take a look at Jenkis downstream job fails to find upstream artifacts stackoverflow question. I hope this answers your question.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK