Strider-CD / strider-node

Run Node.js tests in strider
11 stars 13 forks source link

Cached node_modules are not deleted #26

Open oliversalzburg opened 9 years ago

oliversalzburg commented 9 years ago

I just noticed that I have multiple cached node_modules for several projects on our build system.

drwxr-xr-x 40 strider strider 4.0K May  3 22:32 162668eaf52eeaf110ccfd616abbc11f/
drwxr-xr-x 41 strider strider 4.0K Jun 11 18:03 1aa2f65cd8433e479e2be326ea93094c/
drwxr-xr-x 41 strider strider 4.0K Jun 11 18:21 2121d30ee2ebda5e9060e9e7f5cbfb2f/
drwxr-xr-x 42 strider strider 4.0K Aug 25 15:28 24413a3f8426b13b65cdbb04ac98d3d8/
drwxr-xr-x 41 strider strider 4.0K Aug  5 12:43 311dad20cdb2fa193f40099f9bd038a7/
drwxr-xr-x 37 strider strider 4.0K May  3 18:14 40313efd98675a2ec0caa8a8f82d37ef/
drwxr-xr-x 41 strider strider 4.0K Jun 12 12:28 53ac9344462bae64468f510dd6c8b55d/
drwxr-xr-x 41 strider strider 4.0K Jul 21 18:33 54694375ede9810d1a0106b5de4ca6bc/
drwxr-xr-x 40 strider strider 4.0K May 31 20:19 77f7203394448fa841cbe09bf46cc7ce/
drwxr-xr-x 40 strider strider 4.0K May  3 21:06 7d2f48fb2c1696496950d7e19825923d/
drwxr-xr-x 36 strider strider 4.0K May  3 18:02 9dfef3978091c4d3fbf301af127031f0/
drwxr-xr-x 39 strider strider 4.0K May  3 19:27 afabb8fa3c2140d4825c368d68370850/
drwxr-xr-x 40 strider strider 4.0K May  3 20:28 c31a897e3376b19b406bb14dd841bafc/
drwxr-xr-x 41 strider strider 4.0K Jun  4 01:46 d8ca82bac2bbb0ac211655a2d31763b5/
drwxr-xr-x 36 strider strider 4.0K May  3 18:40 d8d653030aabf05006625f65324a1f5a/
drwxr-xr-x 42 strider strider 4.0K Aug 25 15:31 dev/
drwxr-xr-x 41 strider strider 4.0K Jul 20 13:34 fbe0f67f406d9f3f04feeebba20a00ff/
drwxr-xr-x 41 strider strider 4.0K Jul 20 13:35 master/

I'm not quite sure this many caches should exist.

Was: https://github.com/Strider-CD/strider/issues/853

knownasilya commented 8 years ago

Related to #19

oliversalzburg commented 8 years ago

@knownasilya Can you shed some light on how the module caching works? I see two types of caches, one for the hash of the current set and one for the branch. Why do both exist?

knownasilya commented 8 years ago

This should be fixed with the latest version of strider-node. The dirkeeper was working incorrectly.

knownasilya commented 8 years ago

Hashes are from the initiated jobs, while the others are from manual triggers.

knownasilya commented 8 years ago

Looks like we don't use dirkeeper, and we need to implement a deleting strategy..

crobinson42 commented 8 years ago

I would propose something simple as appending the branch name after the md5 hash. When a change is detected that triggers npm install, first delete any existing hash-branchname.

knownasilya commented 8 years ago

Could be done in the cachier after the update: https://github.com/Strider-CD/strider-simple-runner/blob/master/lib/cachier.js#L23 or locally here https://github.com/Strider-CD/strider-node/blob/master/worker.js#L62