0

Multiple development teams are developing angular 7 projects built using npm, where package.json has all its dependencies.

These development teams provide the code to single DevOps team to build the code.


Say, for angular project1 npm install will install all the dependencies mentioned by package.json that will get installed on jenkins worker node. These dependencies are required to build angular source code with command npm run build


My understanding is,

For angular project2, package.json may have different version of similar dependencies.

So, npm install for angular project2 may not install required dependencies on same jenkins worker node, this looks like an issue, because project 1 has installed those dependencies( but with different version).


1) Is it recommended to build multiple angular projects on single worker node(jenkins)?

2) If no, does each angular project build should happen on separate docker container(running Jenkins) to resolve this problem?

overexchange
  • 15,768
  • 30
  • 152
  • 347

1 Answers1

1

Fortunately and unfortunately, there are a lot of ways to do this.

1) It's "ok" to build multiple projects with a single node, but it might take some folder/archive steps to avoid removing/reinstalling the dependencies every time. You might be able to save dependencies for different builds in an archive file so they don't end up conflicting. See this answer for a starting point.

2) I've found that isolating projects from each other is the cleanest solution when building projects. While I believe this is the best way to go, I'm not sure if it's a fact. Can anybody else weigh in?

  • Firstly, does `npm install` create conflicts? As we are running for different projects... currently we have 3 different angular projects to be built on same node... – overexchange Feb 13 '19 at 03:54
  • Good question. I'm not familiar enough with the multiple ways to do this to know for sure. If you're resetting the source code/cleaning the files between projects, I don't believe it will create conflicts since the modules get installed at the project level. So if project 1 and project 2 have different names/file locations (if this is a way to do it), they should not conflict. –  Feb 13 '19 at 03:56
  • `npm install` will install dependencies in filesystem space used by multiple projects...what do you mean... dependencies get installed at project level? – overexchange Feb 13 '19 at 04:00
  • Developers write their code and throw to DevOps team to build the code thru Jenkins. We get multiple projects to build from multiple development teams... – overexchange Feb 13 '19 at 04:04
  • Yes, I understand that. But if you look at the level the modules are getting installed, the typical Angular project installs them at project -> node_modules. I don't have any idea how your pipeline is actually set up (as mentioned there are many ways). So, if you're doing something like `cd my-project-1` or `cd my-project-2` then `npm install`, they won't conflict since they'll be installed in that projectls level. –  Feb 13 '19 at 04:16
  • Every project has its own folder..in jenkins pipeline. – overexchange Feb 13 '19 at 04:17
  • Alright, so you *should* be able to install at the project level and be fine. –  Feb 13 '19 at 04:19
  • if the project folder gets deleted, then does all the dependencies get deleted? – overexchange Feb 13 '19 at 04:19
  • I believe so, since they should be installed at the project level. –  Feb 13 '19 at 04:22