Compare commits

..

485 Commits

Author SHA1 Message Date
c590c394ba 3.0.5 2017-08-28 02:43:48 +02:00
3a93feea26 update pull mechanism 2017-08-28 02:43:43 +02:00
3666b35ce0 3.0.4 2017-08-28 02:36:27 +02:00
45c91f3dc1 compile 2017-08-28 02:36:23 +02:00
4646862fd6 update async nature of pull and push 2017-08-28 02:36:12 +02:00
fb95bdfdc0 3.0.3 2017-08-28 02:24:15 +02:00
dca4010f97 now handles docker registries the right way 2017-08-28 02:24:06 +02:00
3b3a303c55 3.0.2 2017-08-28 01:35:28 +02:00
563414882e now working correctly and async 2017-08-28 01:35:21 +02:00
71c30e7563 3.0.1 2017-08-28 01:04:05 +02:00
d89cc90c4b update 2017-08-28 01:03:59 +02:00
108758ad19 3.0.0 2017-08-27 15:24:23 +02:00
6e816f35f6 update to new cli scheme 2017-08-27 15:24:17 +02:00
e6bc38c7e5 2.4.15 2017-08-26 12:54:25 +02:00
da3ee27d05 update to notice missing gitlab registry token 2017-08-26 12:54:24 +02:00
40a6bba338 2.4.14 2017-08-26 10:57:23 +02:00
f98f490956 update to notice missing gitlab registry token 2017-08-26 10:57:23 +02:00
15714204a6 2.4.13 2017-08-26 10:06:20 +02:00
35c4963192 clean up retagging 2017-08-26 10:06:20 +02:00
b3c5db3ed9 2.4.12 2017-08-26 09:41:08 +02:00
0701429782 compile 2017-08-26 09:41:04 +02:00
24dd9edcae update login 2017-08-26 09:40:40 +02:00
3e1397e13f 2.4.11 2017-08-26 00:23:16 +02:00
ecb21a787f update 2017-08-26 00:23:08 +02:00
10233ffae0 2.4.10 2017-08-25 23:47:34 +02:00
4cea1d29d2 update 2017-08-25 23:47:31 +02:00
3bf2502f87 2.4.9 2017-08-25 22:41:17 +02:00
c012810a8c improve log messages 2017-08-25 22:41:13 +02:00
ae5b1b1fa7 2.4.8 2017-08-25 22:13:14 +02:00
f1bf000744 update docker login handling 2017-08-25 22:13:11 +02:00
30e16cb33d 2.4.7 2017-08-25 21:07:04 +02:00
16984d811f fix tests 2017-08-25 21:07:02 +02:00
12e2509f0c 2.4.6 2017-08-25 19:30:10 +02:00
e0b8c4f263 2.4.5 2017-07-28 01:12:04 +02:00
16925a3f3f fix typo 2017-07-28 01:11:55 +02:00
1ff0337112 2.4.4 2017-07-27 21:55:13 +02:00
6b15728fbf fix gitlab ci 2017-07-27 21:55:09 +02:00
44c20deec7 2.4.3 2017-07-27 21:51:43 +02:00
6d328e263d update default publish target 2017-07-27 21:51:38 +02:00
52f09583f5 2.4.2 2017-07-27 16:42:13 +02:00
782738aae9 switch to next stabl version 2017-07-27 16:42:10 +02:00
b62104c2a5 2.4.1 2017-07-27 16:37:05 +02:00
3506d8dd21 fix npmci version 2017-07-27 16:36:58 +02:00
4328672958 2.4.0 2017-07-27 15:38:44 +02:00
1ca90eb64d remove debug messages 2017-07-27 15:38:40 +02:00
e68ee9e593 2.3.79 2017-07-27 15:27:29 +02:00
a597c1268b build in debug logs 2017-07-27 15:27:25 +02:00
0e7c942a97 2.3.78 2017-07-27 14:49:58 +02:00
c9b08b9f9d update 2017-07-27 14:49:54 +02:00
c059dff5e0 2.3.77 2017-07-27 14:24:05 +02:00
c0643edc82 2.3.76 2017-07-27 14:21:01 +02:00
a8571827b9 update to use better command recognition 2017-07-27 14:20:56 +02:00
1c0331524d 2.3.75 2017-07-27 13:15:52 +02:00
66bb3a10b7 update to support more detailed docker publishing 2017-07-27 13:15:39 +02:00
fdfb600bea update short description 2017-07-19 16:40:24 +02:00
8847d9031b update codecomments 2017-07-19 09:40:48 +02:00
90295a79d9 2.3.74 2017-06-30 23:34:00 +02:00
270ff4bb40 update 2017-06-30 23:33:56 +02:00
2d34e3e9eb 2.3.73 2017-06-30 18:57:02 +02:00
c899bfa23a upgrade to latest dependencies 2017-06-30 18:56:59 +02:00
6b23e32b13 2.3.72 2017-06-30 17:24:30 +02:00
91fe60c8c1 update dependencies 2017-06-30 17:24:27 +02:00
2fd6765385 2.3.71 2017-06-15 18:34:38 +02:00
53748a21b4 update dependencies 2017-06-15 18:34:38 +02:00
a6a3906bd5 2.3.70 2017-06-15 16:24:24 +02:00
6bfc8ac47c fix request types 2017-06-15 16:24:22 +02:00
988bc3cc5e 2.3.69 2017-06-15 15:48:35 +02:00
78eb3702b7 update test 2017-06-15 15:48:32 +02:00
9f2e629e8f update ssh module 2017-06-15 15:46:08 +02:00
Phil Kunz
419db8b197 Merge branch 'master' into 'master'
update purge

See merge request !4
2017-06-08 21:32:45 +00:00
ddf7ca0466 update purge 2017-06-07 15:16:33 +02:00
bdce1dbded add modPurge 2017-06-05 22:08:49 +02:00
8f81c71de7 now using yarn to install npmci 2017-05-25 13:28:28 +02:00
2e12fd7548 update ci 2017-05-25 13:26:06 +02:00
08152f9b51 2.3.68 2017-05-25 13:01:36 +02:00
b6f54bc967 update tests 2017-05-25 13:01:17 +02:00
faf538aa4d 2.3.67 2017-05-19 12:17:37 +02:00
8c28fcc906 add cflare 2017-05-19 12:14:43 +02:00
7c5cafeb1b complete modular transition 2017-05-19 12:09:33 +02:00
Phil Kunz
cf41e81153 Merge branch 'master' into 'master'
Go modular

See merge request !3
2017-05-18 20:40:14 +00:00
PhilKunz External
b6a85319b0 Go modular 2017-05-18 20:40:09 +00:00
6edd51c6e6 start modular infrastructure 2017-05-16 21:09:59 +02:00
eb57697f96 2.3.66 2017-05-15 18:27:17 +02:00
800e4d8956 fix environment detection 2017-05-15 18:27:13 +02:00
a5633a01c5 2.3.65 2017-05-15 18:10:48 +02:00
0694d3a393 update 2017-05-15 18:10:24 +02:00
b31cc4cbbf 2.3.64 2017-05-15 16:35:23 +02:00
d1e7448b40 update 2017-05-15 16:35:16 +02:00
e541159019 2.3.63 2017-05-15 16:07:08 +02:00
b6c06e2b17 remove bashBare 2017-05-15 16:07:05 +02:00
3505b2effc 2.3.62 2017-05-15 15:54:14 +02:00
29df49addb update 2017-05-15 15:54:09 +02:00
3484575108 2.3.61 2017-05-15 15:36:15 +02:00
7c4890f57a improve logging for docker 2017-05-15 15:36:09 +02:00
308d969540 2.3.60 2017-05-15 15:22:01 +02:00
5065587275 update 2017-05-15 15:21:56 +02:00
8f0092b2ef 2.3.59 2017-05-15 14:33:03 +02:00
e81d001aeb update base image for ci 2017-05-15 14:33:01 +02:00
993f6f691e 2.3.58 2017-05-15 14:28:20 +02:00
64053de75a update base image 2017-05-15 14:28:15 +02:00
1edea1046b 2.3.57 2017-05-15 14:20:00 +02:00
0f8a76ca02 update dependencies 2017-05-15 14:19:56 +02:00
7dc76be1bb 2.3.56 2017-04-03 00:06:04 +02:00
8920110783 update README 2017-04-03 00:06:00 +02:00
7419ee28e4 Merge branch 'master' of gitlab.com:gitzone/npmci 2017-04-02 23:57:25 +02:00
1f4ecb6ff6 2.3.55 2017-04-02 23:56:18 +02:00
a042674a81 fix gitlabTestTag 2017-04-02 23:56:15 +02:00
Phil Kunz
764cd8f7ee Update README.md 2017-04-02 21:48:51 +00:00
657c6870ec 2.3.54 2017-04-02 23:41:54 +02:00
566e074cf4 fix docker execution 2017-04-02 23:41:51 +02:00
90b9b61a37 update 2017-04-02 23:11:19 +02:00
88bc772ea7 2.3.53 2017-04-02 22:56:42 +02:00
76530985e7 now using newest npmts and uploading public docker images also to gitlab registry 2017-04-02 22:56:40 +02:00
2525bc1ad4 update ci 2017-03-24 22:00:14 +01:00
20bca85a12 2.3.52 2017-03-24 11:48:54 +01:00
dd260538a7 now using yarn upgrade instead yarn install to better reflect updates of packages for automatic triggers 2017-03-24 11:48:50 +01:00
d511e8c2f7 update 2017-03-24 11:44:58 +01:00
c44d6c036c 2.3.51 2017-03-11 15:56:51 +01:00
9cec914c94 now using yarn for dependencies as well 2017-03-11 15:56:48 +01:00
52a09bb8dd 2.3.50 2017-03-11 15:17:31 +01:00
1224fce295 fix yarn install decision 2017-03-11 15:17:24 +01:00
6343731772 2.3.49 2017-03-11 14:07:40 +01:00
129d22b537 update usage of yarn 2017-03-11 14:07:36 +01:00
8075281499 readd lodash typings 2017-03-11 11:52:47 +01:00
fe5f602aca 2.3.48 2017-03-11 03:35:18 +01:00
577a9b3e49 update source strings 2017-03-11 03:35:15 +01:00
e6ad22547c 2.3.47 2017-03-11 03:15:17 +01:00
8adeb5bb5c update deps 2017-03-11 03:15:13 +01:00
db0d55636e 2.3.46 2017-03-11 02:41:22 +01:00
0a73134e1c update smartshell 2017-03-11 02:41:18 +01:00
2994a9ef5b 2.3.45 2017-03-11 02:27:50 +01:00
af74e730cc fix async loop execution 2017-03-11 02:27:48 +01:00
798c909f1e 2.3.44 2017-03-11 01:34:06 +01:00
ba41776c0e update 2017-03-11 01:34:03 +01:00
254f7dcfa6 2.3.43 2017-03-11 01:20:08 +01:00
d1e060e1dc now fully async 2017-03-11 01:10:37 +01:00
Phil Kunz
bbc2e9002a Merge branch 'master' into 'master'
Go fully async with shelljs to reduce processor strain

Closes #2

See merge request !2
2017-03-08 19:22:39 +00:00
1db5d6e669 update async 2017-03-08 14:50:58 +01:00
a54015da16 update async functions 2017-03-08 14:50:41 +01:00
d9b8eb3bf0 update 2017-03-07 18:07:03 +01:00
5ede124f56 2.3.42 2017-02-19 14:53:00 +01:00
e835a17fe4 2.3.41 2017-02-19 14:46:14 +01:00
b86b090c07 update dependencies and add yarn 2017-02-19 14:46:05 +01:00
97d2a8d1b7 improve gitlab.yml 2017-02-08 23:44:47 +01:00
38e54f13ff 2.3.40 2017-02-08 21:32:49 +01:00
a11233ddb6 update package.json 2017-02-08 21:32:45 +01:00
7cfd5e4358 update links 2017-02-08 21:32:22 +01:00
431371db5a 2.3.39 2016-12-15 01:09:00 +01:00
e784c02a40 now correctly evaluating which output 2016-12-15 01:08:54 +01:00
f156b58b95 2.3.38 2016-12-15 00:06:15 +01:00
40a00cb1b0 readd logging 2016-12-15 00:06:11 +01:00
0f384a799a 2.3.37 2016-12-14 23:10:57 +01:00
d2f4512ca4 compile 2016-12-14 23:10:54 +01:00
Phil Kunz
ee7e7e2551 Merge branch 'master' into 'master'
fix tool Installation and bash without error.

See merge request !1
2016-12-14 22:03:00 +00:00
Philipp Kunz
4c3d284186 Update npmci.bash.ts 2016-12-14 16:45:48 +00:00
Philipp Kunz
5a472326ad Update npmci.install.ts 2016-12-14 16:38:57 +00:00
5021ee099d 2.3.36 2016-12-13 23:16:22 +01:00
cd7363625d now logging path 2016-12-13 23:16:19 +01:00
399168f5d0 2.3.35 2016-12-11 16:34:16 +01:00
a272556ccd improve README 2016-12-11 16:33:56 +01:00
172b9f9b3f 2.3.34 2016-12-11 16:20:33 +01:00
9eb3d1d06a fix README 2016-12-11 16:20:29 +01:00
4093675a9d 2.3.33 2016-12-11 16:19:46 +01:00
53a2fb4c78 update README 2016-12-11 16:19:25 +01:00
59ed6829e4 2.3.32 2016-12-10 23:27:37 +01:00
4e01b0c9b6 improve logs 2016-12-10 23:27:34 +01:00
85a6099d56 2.3.31 2016-12-10 22:43:16 +01:00
787145816a fix npm global Tool installation 2016-12-10 22:43:14 +01:00
b194bf2a0e 2.3.30 2016-12-10 22:28:30 +01:00
407d9f8237 fixup globalNpmTools 2016-12-10 22:28:27 +01:00
ec196e1d53 add base picture to README 2016-11-25 22:46:14 +01:00
305fc6e68e 2.3.29 2016-11-25 22:44:51 +01:00
35a7a83ee6 fix global install of needed tools 2016-11-25 22:44:49 +01:00
165000144c 2.3.28 2016-11-25 22:34:32 +01:00
77a4cd7a12 now checking if tool already installed 2016-11-25 22:34:28 +01:00
9822a9c867 2.3.27 2016-11-25 14:29:11 +01:00
a1209c74dd 2.3.26 2016-11-25 14:15:48 +01:00
d9f517cf46 fix cli usage 2016-11-25 14:15:44 +01:00
1e976372fa 2.3.25 2016-11-25 13:43:38 +01:00
733a35b789 improve install handling of needed global tools 2016-11-25 13:43:35 +01:00
07deb7497a 2.3.24 2016-11-25 13:26:02 +01:00
2096e27fc5 fixed 16 file Buffer overflow 2016-11-25 13:25:45 +01:00
301a317fa0 update 2016-11-25 00:07:20 +01:00
299d2567f8 test 2016-11-24 23:21:40 +01:00
09c7dae079 2.3.23 2016-11-17 23:02:45 +01:00
19c118e166 fix gitlab-ci 2016-11-17 23:02:37 +01:00
c0a5057a0d 2.3.22 2016-11-15 22:47:23 +01:00
cfdce55c9b fixed node versions 2016-11-15 22:47:21 +01:00
a364fcb961 2.3.21 2016-11-15 21:57:42 +01:00
dfb8b43559 update node versions 2016-11-15 21:57:18 +01:00
3da8e60149 change to loglevel warn 2016-11-15 13:02:56 +01:00
509b97548c 2.3.20 2016-11-15 13:00:07 +01:00
6dda67bf37 add silent install 2016-11-15 12:59:36 +01:00
1e4dd1554c update script 2016-11-15 12:55:45 +01:00
4db221ea2d update tests 2016-11-15 00:18:32 +01:00
0e63c17fc2 2.3.19 2016-11-15 00:07:58 +01:00
0427368cfa update deps and node version 2016-11-15 00:07:55 +01:00
da180b090c 2.3.18 2016-09-20 12:43:42 +02:00
22d7e83b8d update node versions 2016-09-20 12:43:37 +02:00
bb910f9fab 2.3.17 2016-09-04 19:49:48 +02:00
420c39dd5f fix ci 2016-09-04 19:49:38 +02:00
7d4c80ed04 2.3.16 2016-09-04 17:57:00 +02:00
5858682946 improve typings 2016-09-04 17:56:56 +02:00
c4aa3a8926 update commnts 2016-09-04 16:05:47 +02:00
f0e62c06e8 2.3.15 2016-09-04 13:42:34 +02:00
61ee70ea8d update docs and comments, add servezone compatibility 2016-09-04 13:42:22 +02:00
66bef3cd60 2.3.14 2016-08-02 23:11:57 +02:00
28054b17fc update nvm detection 2016-08-02 23:11:42 +02:00
8736530920 2.3.13 2016-08-02 16:20:35 +02:00
2d9c225d28 start shift to making bare bash obsolete 2016-08-02 16:20:32 +02:00
236df3388f test 2016-07-18 19:18:19 +02:00
0406998e92 test 2016-07-18 18:55:34 +02:00
4e865e7bef test 2016-07-18 18:53:17 +02:00
62e4dd23d2 2.3.12 2016-07-18 18:51:34 +02:00
2962c5f8f9 now using global npmts 2016-07-18 18:50:58 +02:00
7e506b8e69 2.3.11 2016-07-18 18:43:07 +02:00
26400b8153 update base image for CI 2016-07-18 18:43:01 +02:00
a94e1771a4 2.3.10 2016-07-18 18:39:07 +02:00
0213afa46e updated setter for environment module to comply with JS standards 2016-07-18 18:39:04 +02:00
6f4138e536 2.3.9 2016-07-18 17:20:27 +02:00
5c5ca3ebf0 recompile 2016-07-18 17:20:24 +02:00
29ccf9d866 2.3.8 2016-07-18 17:18:58 +02:00
a68fc4050f now going node 6 all the way 2016-07-18 17:17:57 +02:00
2e965bcb46 2.3.7 2016-07-18 16:58:12 +02:00
73aceb4054 2.3.6 2016-07-18 16:57:52 +02:00
9f63fba3e2 switch to ES6 2016-07-18 16:56:53 +02:00
253d69254b prepare ES6 2016-07-18 16:47:42 +02:00
44e5d3758c 2.3.5 2016-06-29 23:59:21 +02:00
9fc142d931 2.3.4 2016-06-29 23:55:50 +02:00
f4c7c0b239 fix stable version 2016-06-29 23:55:38 +02:00
5c28561c1f 2.3.3 2016-06-29 23:18:55 +02:00
d0547a78dd updated versions 2016-06-29 23:18:51 +02:00
5438b7792f 2.3.2 2016-06-26 16:18:35 +02:00
35c9bd1aff updated dependencies 2016-06-26 16:18:17 +02:00
26a5766807 2.3.1 2016-06-26 05:21:29 +02:00
ab6b447d55 fix undefined error for docker registry 2016-06-26 05:21:24 +02:00
a2a7544797 2.3.0 2016-06-26 04:54:20 +02:00
83cd4e9a13 now has <clean> command 2016-06-26 04:54:10 +02:00
21b46dd939 cleanup 2016-06-26 04:45:00 +02:00
5b86db6f98 2.2.3 2016-06-26 04:41:04 +02:00
f091fb2452 fix some config issues and update to latest smartssh 2016-06-26 04:40:58 +02:00
b59bf2de8d 2.2.2 2016-06-26 02:17:27 +02:00
3653373f12 some cosmetics 2016-06-26 02:17:17 +02:00
94e7f502b3 2.2.1 2016-06-25 19:19:43 +02:00
a699d29885 fix function call for ssh 2016-06-25 19:18:42 +02:00
85d50c868b 2.2.0 2016-06-25 18:53:44 +02:00
2b4bfbdb39 now ships with ssh support 2016-06-25 18:53:35 +02:00
e77a30b2bc update structure 2016-06-25 16:29:06 +02:00
b8a0c788eb 2.1.64 2016-06-25 12:35:13 +02:00
713338b2c3 update legacy version 2016-06-25 12:34:57 +02:00
233fa74566 2.1.63 2016-06-25 12:29:39 +02:00
8eadb7449b 2.1.62 2016-06-25 12:29:14 +02:00
3ebed47170 switched from commander to smartcli 2016-06-25 12:28:51 +02:00
9f5c7b0ca0 2.1.61 2016-06-25 11:58:38 +02:00
7de38ce050 now has working version 2016-06-25 11:58:33 +02:00
c495f20b3d 2.1.60 2016-06-25 03:21:43 +02:00
2082773f56 2.1.59 2016-06-25 03:21:08 +02:00
e27dd058cc fic some issues 2016-06-25 03:19:29 +02:00
f9cee9ac85 improve ssh implementation 2016-06-25 02:55:36 +02:00
e3c300293d 2.1.58 2016-06-24 02:55:05 +02:00
0f0eaf4c4f add version commandline option 2016-06-24 02:54:55 +02:00
57fe78c673 2.1.57 2016-06-23 22:22:11 +02:00
3298b6298e improve triggr detection 2016-06-23 22:22:03 +02:00
3e80ea15e0 update deps 2016-06-23 20:57:09 +02:00
0b5c99a516 now looking for project level config 2016-06-19 02:30:50 +02:00
a48f8b9c54 2.1.56 2016-06-11 21:14:25 +02:00
b8079e0bc9 now correctly adding spaces in wrapped commands 2016-06-11 21:14:20 +02:00
61c00f31ea 2.1.55 2016-06-11 21:02:05 +02:00
7fc8648d40 now detects wrapped command correctly 2016-06-11 21:01:44 +02:00
973c55e147 2.1.54 2016-06-11 20:45:01 +02:00
a3523ad7c4 fixed command 2016-06-11 20:44:56 +02:00
216c28d76e 2.1.53 2016-06-11 20:30:41 +02:00
b22b2fa802 fix npmci command 2016-06-11 20:30:35 +02:00
e81592ae38 2.1.52 2016-06-11 20:22:05 +02:00
b3572d512d now using npmts-g 2016-06-11 20:22:00 +02:00
d7bfaa75e1 2.1.51 2016-06-10 08:07:08 +02:00
3867000d0f fix npmci failure when repo env var not set 2016-06-10 08:07:04 +02:00
7ecb30cf0a 2.1.50 2016-06-09 03:42:25 +02:00
b45b0ea6ed now using projectinfo 2016-06-09 03:42:12 +02:00
edf7b268ab update Readme 2016-06-08 23:18:02 +02:00
2af2a71471 2.1.49 2016-06-07 23:22:15 +02:00
45e41500bc now using same docker push function across all stages 2016-06-07 23:21:56 +02:00
a4d66744be 2.1.48 2016-06-07 22:27:20 +02:00
c0d0e5154a fix tagging logic 2016-06-07 22:27:10 +02:00
e92d421bae 2.1.47 2016-06-07 19:41:20 +02:00
2f827a7696 fix tagging logic 2016-06-07 19:41:14 +02:00
11c0341c76 2.1.46 2016-06-07 14:45:42 +02:00
4bc86ad7b8 now more efficiently retagging image during release stage 2016-06-07 14:45:27 +02:00
cebcfc9fc5 2.1.45 2016-06-07 13:40:48 +02:00
ba047ed586 added some log messages for debugging 2016-06-07 13:40:42 +02:00
215d0b97bb 2.1.44 2016-06-07 12:36:07 +02:00
b1e873afa8 some cosmetics 2016-06-07 12:36:00 +02:00
cb2400652f 2.1.43 2016-06-07 12:12:25 +02:00
455247eb18 improved docker image testing 2016-06-07 12:12:19 +02:00
b7394ff730 2.1.42 2016-06-07 10:28:33 +02:00
c74bd67008 test 2016-06-07 10:28:21 +02:00
3300db61b4 2.1.41 2016-06-07 10:22:27 +02:00
eeef17c327 restructure a little bit 2016-06-07 10:21:56 +02:00
f510277c16 2.1.40 2016-06-07 08:02:15 +02:00
2d61640c91 improve mounting 2016-06-07 08:02:02 +02:00
e4507b7073 update test 2016-06-07 07:54:04 +02:00
0acb6ad351 2.1.39 2016-06-07 06:51:17 +02:00
c33e0c622b fix docker test call 2016-06-07 06:51:05 +02:00
5085e86c9b even better logs 2016-06-07 06:35:10 +02:00
3ea8265a75 now stating local build depdendencies in log 2016-06-07 06:31:53 +02:00
d7e4efc2c0 2.1.38 2016-06-07 06:14:46 +02:00
7ca0171658 fix image id inspection 2016-06-07 06:14:36 +02:00
87d8a4401e 2.1.37 2016-06-07 06:05:17 +02:00
8b5cf3bb5f fix local image dependency detection 2016-06-07 06:05:13 +02:00
f28d3cc3d8 2.1.36 2016-06-07 05:37:07 +02:00
358e4674f2 compile 2016-06-07 05:37:02 +02:00
0222ab91c3 fix bash 2016-06-07 05:36:37 +02:00
61c8cbc152 2.1.35 2016-06-07 05:20:09 +02:00
4ffb1d1e7e now checking for specific testfiles for each Image version 2016-06-07 05:20:04 +02:00
48bee2fa92 improve npmignore 2016-06-07 05:07:08 +02:00
494e3c5395 compile 2016-06-07 04:55:28 +02:00
1408cb3b3d fix bash 2016-06-07 04:55:08 +02:00
1bcb1f8fee 2.1.34 2016-06-07 04:52:13 +02:00
d98d8e9667 fix test command for docker 2016-06-07 04:50:36 +02:00
3ac486312e fix README 2016-06-07 04:40:44 +02:00
2464499214 2.1.33 2016-06-07 04:31:29 +02:00
9f4a3783a1 full docker workflow now implemented 2016-06-07 04:31:25 +02:00
fe0b99309b compile 2016-06-07 03:59:47 +02:00
5a05092bc8 improve bash, implement retagging 2016-06-07 03:57:43 +02:00
8dc0db3b71 2.1.32 2016-06-07 00:11:51 +02:00
d24ff4c67b fix another bash typo 2016-06-06 23:57:23 +02:00
821747510f 2.1.31 2016-06-06 23:53:32 +02:00
e13624fc26 fix bash 2016-06-06 23:53:14 +02:00
02e363d105 Start with docker test 2016-06-06 20:30:06 +02:00
47aac2f7c5 compile 2016-06-06 00:00:50 +02:00
832031a02a fix registry login scope 2016-06-05 23:59:10 +02:00
73b4057dc9 2.1.30 2016-06-05 23:53:30 +02:00
fcd6b81668 improve config handling 2016-06-05 23:53:01 +02:00
b84152aac2 fix typo 2016-06-05 23:27:19 +02:00
198b35b0c6 now keeping track of what has been done during a build 2016-06-05 23:24:11 +02:00
334713a344 2.1.29 2016-06-05 22:52:04 +02:00
36c4a676c7 now patching Dockerfiles to use local images during build 2016-06-05 22:51:59 +02:00
0571051009 start unclutter env 2016-06-05 21:11:30 +02:00
0d4fd9dbba 2.1.28 2016-06-05 20:51:21 +02:00
1e9c2c850c added automatic retrial of failed commands 2016-06-05 20:51:13 +02:00
2ae6fad2a1 2.1.27 2016-06-05 17:17:21 +02:00
d3dcc2f8ab now working 2016-06-05 17:17:15 +02:00
c718593162 add NpmciTest module tests 2016-06-05 16:56:07 +02:00
c9ba850b4b fix Test 2016-06-05 16:43:27 +02:00
faef4da6be now testing shell 2016-06-05 14:55:08 +02:00
3300f177ca introduce better shell interaction for testing 2016-06-05 14:33:59 +02:00
b2d56e59bb restore job queue 2016-06-05 14:28:45 +02:00
ee54cbf78d now patches local dependencies for multitag dependent docker builds 2016-06-05 14:27:56 +02:00
e3c1ac1897 started with tests 2016-06-05 13:50:45 +02:00
ea01b87949 start tests 2016-06-05 13:01:45 +02:00
229c3ae27b 2.1.26 2016-06-05 11:08:23 +02:00
19e3aa3721 better sorter function 2016-06-05 11:08:20 +02:00
a965cf38c8 2.1.25 2016-06-05 10:24:00 +02:00
7924ba26a2 now sorting Dockerfiles correctly 2016-06-05 10:23:55 +02:00
361d45e086 2.1.24 2016-06-05 10:11:07 +02:00
cb7cb852ea now sorting Dockerfiles correctly 2016-06-05 10:11:01 +02:00
61720f47be 2.1.23 2016-06-05 09:42:14 +02:00
b435fc6bdf update smartstring 2016-06-05 09:42:08 +02:00
70ad41ab86 fix gitlab.yml 2016-06-05 09:38:11 +02:00
d67109b4bc 2.1.22 2016-06-05 09:34:21 +02:00
a29e04f9e3 fix gitlab.yml 2016-06-05 09:33:51 +02:00
9634ca3b4d 2.1.21 2016-06-05 08:53:52 +02:00
d2e7488868 fix 2016-06-05 08:53:46 +02:00
bb44333d70 2.1.20 2016-06-05 08:30:12 +02:00
87f6adeda4 fix 2016-06-05 08:30:08 +02:00
6334396bfc 2.1.19 2016-06-05 08:19:59 +02:00
7a33252f2f fix 2016-06-05 08:19:03 +02:00
b7068b7b53 2.1.18 2016-06-05 08:06:35 +02:00
1e5b56a388 fix 2016-06-05 08:06:32 +02:00
786de4ae18 2.1.17 2016-06-05 08:00:53 +02:00
62ee8a26a4 fix 2016-06-05 08:00:46 +02:00
f544aef054 2.1.16 2016-06-05 07:50:11 +02:00
cb6867dbde fix 2016-06-05 07:50:04 +02:00
5316740a1a 2.1.15 2016-06-05 07:41:20 +02:00
06bc1e59f8 fix 2016-06-05 07:41:14 +02:00
bd237ccdab 2.1.14 2016-06-05 07:28:02 +02:00
f51b556fca fix 2016-06-05 07:27:58 +02:00
9ce29a7c24 improve .gitlab.yml 2016-06-05 07:24:21 +02:00
8dade860f5 2.1.13 2016-06-05 07:17:13 +02:00
9d4c8ce68b fix 2016-06-05 07:17:02 +02:00
5917c63836 2.1.12 2016-06-05 07:05:42 +02:00
af2c4b04cd fix 2016-06-05 07:05:34 +02:00
deae50007e 2.1.11 2016-06-05 06:26:08 +02:00
9ddf28f90a fix build command 2016-06-05 06:26:05 +02:00
4321ae3dab 2.1.10 2016-06-05 06:20:48 +02:00
1c7542c970 now sorting dockerfiles before build 2016-06-05 06:20:05 +02:00
839dac1fe8 2.1.9 2016-06-05 05:16:20 +02:00
9c7afba849 now building and pushing Dockerfiles with automatic tag recognition 2016-06-05 05:16:14 +02:00
6b72652c7a more docker 2016-06-05 04:48:39 +02:00
51334c297d even more docker 2016-06-05 04:45:46 +02:00
a38996b98c more docker 2016-06-05 04:19:54 +02:00
ab62b979bd start on getting some class logic to Docker 2016-06-05 02:17:55 +02:00
dd142856d0 restructure 2016-06-05 01:31:21 +02:00
c826ba3d5f update .gitlab.yml base image 2016-06-05 01:24:13 +02:00
c75e2b2e06 restructure 2016-06-05 01:22:04 +02:00
04a5b15668 test runner 2016-06-04 23:39:38 +02:00
a87fc98eb8 compile 2016-06-04 23:20:39 +02:00
9d092aa280 restructure some commands 2016-06-04 18:41:35 +02:00
7ca6578443 improve README 2016-06-04 00:59:17 +02:00
6d5865427e improve README 2016-06-04 00:41:25 +02:00
9595a82dc5 2.1.8 2016-06-04 00:35:55 +02:00
125f96edc4 update readme 2016-06-04 00:35:43 +02:00
f1244c33dc compile 2016-06-04 00:10:19 +02:00
dfe829541e start testing docker containers with npmci 2016-06-04 00:09:44 +02:00
51a695ed8e 2.1.7 2016-06-03 23:23:36 +02:00
10015aa0c1 update dependencies and add tag function 2016-06-03 23:22:50 +02:00
a65150b640 2.1.6 2016-06-03 19:45:40 +02:00
1f23b3693f compile 2016-06-03 19:45:34 +02:00
ce66e0a729 fix registry domain 2016-06-03 19:44:53 +02:00
606683aa8b cosmetics 2016-06-03 18:20:05 +02:00
b443662df8 2.1.5 2016-06-03 17:25:38 +02:00
c3179815c2 compile 2016-06-03 17:25:29 +02:00
dda4893e39 fix docker gitlab login 2016-06-03 17:24:55 +02:00
806647d7c3 2.1.4 2016-06-03 16:27:19 +02:00
6a0e74690d compile 2016-06-03 16:27:12 +02:00
27cb433c82 add docker tag push 2016-06-03 16:26:28 +02:00
e1245f24ce add some functions 2016-06-03 03:44:24 +02:00
42d3ecbe37 2.1.3 2016-06-03 02:56:26 +02:00
b19bb9569d start centralizing environment gathering 2016-06-03 02:56:20 +02:00
497659df1f compile 2016-06-03 02:11:03 +02:00
4047fc815b add build functionality 2016-06-03 02:10:34 +02:00
2a6d155a89 2.1.2 2016-06-03 01:58:44 +02:00
fa7f576ae5 add some more functionality 2016-06-03 01:58:37 +02:00
057e425824 update ci yml 2016-06-02 20:09:28 +02:00
90919ba009 2.1.1 2016-06-02 20:07:58 +02:00
7cda79daa6 fix regex targeting 2016-06-02 20:07:52 +02:00
5962339aff 2.1.0 2016-06-02 19:48:04 +02:00
6854b7a83f remove need for bash in docker environment 2016-06-02 19:47:57 +02:00
9e886db462 run trigger seperately 2016-06-02 19:41:03 +02:00
5bf8311380 2.0.29 2016-06-02 19:35:28 +02:00
6b82f8385c update triggerRegex 2016-06-02 19:35:16 +02:00
1159a9ab5c update trigger regex 2016-06-02 19:35:01 +02:00
5e4b93ed76 2.0.28 2016-06-02 18:46:34 +02:00
1b2fd33a13 2.0.27 2016-06-02 18:39:18 +02:00
5f0496ef85 fix trigger name 2016-06-02 18:39:11 +02:00
2ca886cd6e 2.0.26 2016-06-02 18:12:17 +02:00
50e69682b0 2.0.25 2016-06-02 18:09:58 +02:00
Philipp Kunz
23ca382590 always use latest npmci 2016-06-02 18:09:07 +02:00
Philipp Kunz
4e4fb1399f 2.0.24 2016-06-02 17:57:07 +02:00
Philipp Kunz
8dd0f230c0 fixed docker login 2016-06-02 17:57:01 +02:00
Philipp Kunz
677f730b34 add new env file 2016-06-02 13:39:03 +02:00
Philipp Kunz
a2a409a1ff 2.0.23 2016-06-02 13:12:48 +02:00
Philipp Kunz
d6e597111e noe handling docker as well 2016-06-02 13:08:15 +02:00
Philipp Kunz
b37a2f78c4 2.0.22 2016-06-01 11:09:24 +02:00
Philipp Kunz
396099253d 2.0.21 2016-06-01 10:26:36 +02:00
Philipp Kunz
a2a3019e6b 2.0.20 2016-06-01 08:56:40 +02:00
Philipp Kunz
5753fb80bf 2.0.19 2016-06-01 08:56:13 +02:00
Philipp Kunz
2a15b35dd5 compile 2016-06-01 08:56:06 +02:00
Philipp Kunz
27a12415e6 update trigger 2016-06-01 08:55:15 +02:00
Philipp Kunz
4c0f0f5cc6 2.0.18 2016-06-01 08:47:20 +02:00
Philipp Kunz
06d785df6b 2.0.17 2016-06-01 08:30:11 +02:00
Philipp Kunz
19dc4974b9 update gitlab ci yml 2016-06-01 08:29:14 +02:00
Philipp Kunz
ed9327db8b 2.0.16 2016-06-01 08:13:54 +02:00
Philipp Kunz
e239c8f350 now using regex to have a simpler env var format 2016-06-01 08:13:48 +02:00
7b8fc67d7f 2.0.15 2016-06-01 07:18:36 +02:00
9d3102583d now using node request 2016-06-01 07:18:30 +02:00
9e640e63d7 2.0.14 2016-06-01 07:13:06 +02:00
081520746e 2.0.13 2016-06-01 06:51:22 +02:00
88ffbf3198 2.0.12 2016-06-01 06:50:03 +02:00
db0010b3f3 compile 2016-06-01 06:49:59 +02:00
ff1a7398da 2.0.11 2016-06-01 06:39:13 +02:00
412e6ec9ba 2.0.10 2016-06-01 06:38:48 +02:00
8d67cf2a8f 2.0.9 2016-06-01 06:30:32 +02:00
3a6e2d6f3d run triggers 2016-06-01 06:30:21 +02:00
aafa5bd1e9 2.0.8 2016-06-01 06:05:17 +02:00
3c82c4c62b compile 2016-06-01 06:04:20 +02:00
a382d98892 fix legaxy tag error 2016-06-01 06:03:26 +02:00
06e96e7778 update gitlab-ci.yml 2016-06-01 05:58:43 +02:00
1efc425a46 2.0.7 2016-06-01 05:44:56 +02:00
501ff7beb7 compile 2016-06-01 05:44:48 +02:00
3fe173e59c Merge branches 'master' and 'master' of gitlab.com:pushrocks/npmci 2016-06-01 05:43:11 +02:00
8fec378a53 add prepare command 2016-06-01 05:42:37 +02:00
Philipp Kunz
3bb06781f9 2.0.6 2016-05-30 11:32:15 +02:00
Philipp Kunz
8970deec3f fix README 2016-05-30 11:08:21 +02:00
Philipp Kunz
8ff08240fd 2.0.5 2016-05-30 11:05:35 +02:00
Philipp Kunz
955474e296 Update README 2016-05-30 11:05:28 +02:00
Philipp Kunz
12e3cda903 2.0.4 2016-05-30 10:57:24 +02:00
Philipp Kunz
43726b22b2 Update README 2016-05-30 10:57:08 +02:00
34f29bb4b4 2.0.3 2016-05-30 06:07:12 +02:00
a434b366ff compile 2016-05-30 06:07:07 +02:00
827af44f9e fix version selector 2016-05-30 06:05:13 +02:00
18edee400c 2.0.2 2016-05-30 05:52:06 +02:00
bac99d4bf8 2.0.1 2016-05-30 05:40:37 +02:00
d2db827348 2.0.0 2016-05-30 05:40:05 +02:00
96981798b8 now fully working 2016-05-30 05:40:02 +02:00
112 changed files with 5824 additions and 295 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,5 @@
node_modules/
coverage/
docs/
public/
config.json
.yarn/

View File

@@ -1,13 +1,34 @@
image: hosttoday/ht-docker-node:latest
# gitzone standard
image: hosttoday/ht-docker-node:stable
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- test
- release
- trigger
- pages
before_script:
- yarn global add npmci@2.4.1
testLEGACY:
stage: test
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
@@ -15,16 +36,39 @@ testSTABLE:
stage: test
script:
- npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npm uninstall -g npmci
- npm install -g npmci
- npmci publish
- npmci publish npm
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

View File

@@ -1,2 +1,5 @@
docs/
pages/
coverage/
test/
node_modules/
config.json

View File

@@ -1,4 +0,0 @@
# NPMCI
npmci is your friend when it comes to handling npm packages during CI builds.
It is designed to work hand in hand with npmts

View File

@@ -1,10 +0,0 @@
environment:
nodejs_version: "4"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm test
build: off

3
dist/cli.js vendored Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
process.env.CLI_CALL = 'true'
var index = require("../dist/index.js");

2
dist/index.d.ts vendored
View File

@@ -1 +1 @@
import "typings-global";
import './npmci.cli';

39
dist/index.js vendored
View File

@@ -1,37 +1,4 @@
#!/usr/bin/env node
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var packJson = require("../package.json");
plugins.beautylog.log("npmci in version" + packJson.version);
var npmci_install_1 = require("./npmci.install");
var npmci_test_1 = require("./npmci.test");
var npmci_publish_1 = require("./npmci.publish");
var command;
var commandOption;
plugins.commander
.arguments('<commandarg> [commandoptionarg]')
.action(function (commandarg, commandoptionarg) {
command = commandarg;
commandOption = commandoptionarg;
});
plugins.commander.parse(process.argv);
if (typeof command === 'undefined') {
console.error('no command given!');
process.exit(1);
}
switch (command) {
case "install":
npmci_install_1.install(commandOption);
break;
case "test":
npmci_test_1.test(commandOption);
break;
case "publish":
npmci_publish_1.publish();
break;
default:
break;
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJz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ICAgY29tbWFuZE9wdGlvbiA9IGNvbW1hbmRvcHRpb25hcmc7XHJcbiAgICB9KTtcclxuIFxyXG5wbHVnaW5zLmNvbW1hbmRlci5wYXJzZShwcm9jZXNzLmFyZ3YpO1xyXG4gXHJcbmlmICh0eXBlb2YgY29tbWFuZCA9PT0gJ3VuZGVmaW5lZCcpIHtcclxuICAgIGNvbnNvbGUuZXJyb3IoJ25vIGNvbW1hbmQgZ2l2ZW4hJyk7XHJcbiAgICBwcm9jZXNzLmV4aXQoMSk7XHJcbn1cclxuXHJcbnN3aXRjaCAoY29tbWFuZCl7XHJcbiAgICBjYXNlIFwiaW5zdGFsbFwiOlxyXG4gICAgICAgIGluc3RhbGwoY29tbWFuZE9wdGlvbik7XHJcbiAgICAgICAgYnJlYWs7XHJcbiAgICBjYXNlIFwidGVzdFwiOlxyXG4gICAgICAgIHRlc3QoY29tbWFuZE9wdGlvbik7XHJcbiAgICAgICAgYnJlYWs7XHJcbiAgICBjYXNlIFwicHVibGlzaFwiOlxyXG4gICAgICAgIHB1Ymxpc2goKTtcclxuICAgICAgICBicmVhaztcclxuICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgYnJlYWs7XHJcbn1cclxuXHJcbiJdfQ==
Object.defineProperty(exports, "__esModule", { value: true });
require("./npmci.cli");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVCQUFvQiJ9

4
dist/mod_clean/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* cleans npmci config files
*/
export declare let clean: () => Promise<void>;

20
dist/mod_clean/index.js vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const paths = require("../npmci.paths");
/**
* cleans npmci config files
*/
exports.clean = () => __awaiter(this, void 0, void 0, function* () {
plugins.smartfile.fs.removeSync(paths.NpmciPackageConfig);
return;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xlYW4vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHlDQUF3QztBQUN4Qyx3Q0FBdUM7QUFFdkM7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRztJQUNqQixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLGtCQUFrQixDQUFDLENBQUE7SUFDekQsTUFBTSxDQUFBO0FBQ1IsQ0FBQyxDQUFBLENBQUEifQ==

1
dist/mod_clean/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../npmci.plugins';

7
dist/mod_clean/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xlYW4vbW9kLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxzQ0FBZ0MifQ==

6
dist/mod_cloudflare/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
export declare let purge: (argvArg: any) => Promise<void>;

36
dist/mod_cloudflare/index.js vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
let npmciCflare = new plugins.cflare.CflareAccount();
/**
* handle cli input
* @param argvArg
*/
exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () {
if (argvArg._.length >= 2) {
let action = argvArg._[1];
switch (action) {
default:
plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`);
}
}
else {
plugins.beautylog.log(`>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.`);
}
});
exports.purge = (argvArg) => __awaiter(this, void 0, void 0, function* () {
npmciCflare.auth({
email: '',
key: ''
});
npmciCflare.purgeZone(argvArg._[1]);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xvdWRmbGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBRXhDLElBQUksV0FBVyxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQTtBQUVwRDs7O0dBR0c7QUFDUSxRQUFBLFNBQVMsR0FBRyxDQUFPLE9BQU87SUFDbkMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxNQUFNLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUMxQixJQUFJLE1BQU0sR0FBVyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ2pDLE1BQU0sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFDZjtnQkFDRSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxxQ0FBcUMsTUFBTSxrQkFBa0IsQ0FBQyxDQUFBO1FBQzFGLENBQUM7SUFDSCxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxrRkFBa0YsQ0FBQyxDQUFBO0lBQzNHLENBQUM7QUFDSCxDQUFDLENBQUEsQ0FBQTtBQUVVLFFBQUEsS0FBSyxHQUFHLENBQU8sT0FBTztJQUMvQixXQUFXLENBQUMsSUFBSSxDQUFDO1FBQ2YsS0FBSyxFQUFFLEVBQUU7UUFDVCxHQUFHLEVBQUUsRUFBRTtLQUNSLENBQUMsQ0FBQTtJQUNGLFdBQVcsQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBQ3JDLENBQUMsQ0FBQSxDQUFBIn0=

3
dist/mod_cloudflare/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from '../npmci.plugins';
import * as cflare from 'cflare';
export { cflare };

9
dist/mod_cloudflare/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
const cflare = require("cflare");
exports.cflare = cflare;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xvdWRmbGFyZS9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQztBQUVoQyxpQ0FBZ0M7QUFHNUIsd0JBQU0ifQ==

1
dist/mod_command/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare let command: () => Promise<void>;

24
dist/mod_command/index.js vendored Normal file
View File

@@ -0,0 +1,24 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const npmci_bash_1 = require("../npmci.bash");
exports.command = () => __awaiter(this, void 0, void 0, function* () {
let wrappedCommand = '';
let argvArray = process.argv;
for (let i = 3; i < argvArray.length; i++) {
wrappedCommand = wrappedCommand + argvArray[i];
if (i + 1 !== argvArray.length) {
wrappedCommand = wrappedCommand + ' ';
}
}
yield npmci_bash_1.bash(wrappedCommand);
return;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY29tbWFuZC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQ0EsOENBQW9DO0FBRXpCLFFBQUEsT0FBTyxHQUFHO0lBQ25CLElBQUksY0FBYyxHQUFXLEVBQUUsQ0FBQTtJQUMvQixJQUFJLFNBQVMsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFBO0lBQzVCLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsU0FBUyxDQUFDLE1BQU0sRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDO1FBQzFDLGNBQWMsR0FBRyxjQUFjLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQzlDLEVBQUUsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLEtBQUssU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFBQyxjQUFjLEdBQUcsY0FBYyxHQUFHLEdBQUcsQ0FBQTtRQUFDLENBQUM7SUFDM0UsQ0FBQztJQUNELE1BQU0saUJBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQTtJQUMxQixNQUFNLENBQUE7QUFDUixDQUFDLENBQUEsQ0FBQSJ9

1
dist/mod_command/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../npmci.plugins';

7
dist/mod_command/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY29tbWFuZC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9

24
dist/mod_docker/index.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
import * as helpers from './mod.helpers';
import { Dockerfile } from './mod.classes.dockerfile';
export { Dockerfile, helpers };
export declare let modArgvArg: any;
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export declare let build: () => Promise<void>;
/**
* login to the DockerRegistries
*/
export declare let login: () => Promise<void>;
/**
* logs in docker
*/
export declare let prepare: () => Promise<void>;
export declare let push: (argvArg: any) => Promise<void>;
export declare let pull: (argvArg: any) => Promise<void>;
export declare let test: () => Promise<Dockerfile[]>;

130
dist/mod_docker/index.js vendored Normal file
View File

@@ -0,0 +1,130 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const helpers = require("./mod.helpers");
exports.helpers = helpers;
// classes
const mod_classes_dockerfile_1 = require("./mod.classes.dockerfile");
exports.Dockerfile = mod_classes_dockerfile_1.Dockerfile;
const mod_classes_dockerregistry_1 = require("./mod.classes.dockerregistry");
const mod_classes_registrystorage_1 = require("./mod.classes.registrystorage");
// instances
let npmciRegistryStorage = new mod_classes_registrystorage_1.RegistryStorage();
/**
* handle cli input
* @param argvArg
*/
exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () {
exports.modArgvArg = argvArg;
if (argvArg._.length >= 2) {
let action = argvArg._[1];
switch (action) {
case 'build':
yield exports.build();
break;
case 'login':
yield exports.login();
break;
case 'test':
yield exports.test();
break;
case 'push':
yield exports.push(argvArg);
break;
case 'pull':
yield exports.pull(argvArg);
break;
default:
plugins.beautylog.error(`>>npmci docker ...<< action >>${action}<< not supported`);
}
}
else {
plugins.beautylog.log(`>>npmci docker ...<< cli arguments invalid... Please read the documentation.`);
}
});
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
exports.build = () => __awaiter(this, void 0, void 0, function* () {
yield exports.prepare();
plugins.beautylog.log('now building Dockerfiles...');
yield helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles)
.then(helpers.buildDockerfiles);
});
/**
* login to the DockerRegistries
*/
exports.login = () => __awaiter(this, void 0, void 0, function* () {
yield exports.prepare();
yield npmciRegistryStorage.loginAll();
});
/**
* logs in docker
*/
exports.prepare = () => __awaiter(this, void 0, void 0, function* () {
// Always login to GitLab Registry
if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
plugins.beautylog.error('No registry token specified by gitlab!');
process.exit(1);
}
npmciRegistryStorage.addRegistry(new mod_classes_dockerregistry_1.DockerRegistry({
registryUrl: 'registry.gitlab.com',
username: 'gitlab-ci-token',
password: process.env.CI_BUILD_TOKEN
}));
// handle registries
yield plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', (envString) => __awaiter(this, void 0, void 0, function* () {
npmciRegistryStorage.addRegistry(mod_classes_dockerregistry_1.DockerRegistry.fromEnvString(envString));
}));
return;
});
exports.push = (argvArg) => __awaiter(this, void 0, void 0, function* () {
yield exports.prepare();
let registryUrlArg = argvArg._[2];
let suffix = null;
if (argvArg._.length >= 4) {
suffix = argvArg._[3];
}
let dockerfileArray = yield helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles);
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
if (!localDockerRegistry) {
plugins.beautylog.error(`Cannot push to registry ${registryUrlArg}, because it was not found in the authenticated registry list.`);
process.exit(1);
}
for (let dockerfile of dockerfileArray) {
yield dockerfile.push(localDockerRegistry, suffix);
}
});
exports.pull = (argvArg) => __awaiter(this, void 0, void 0, function* () {
yield exports.prepare();
let registryUrlArg = argvArg._[2];
let suffix = null;
if (argvArg._.length >= 4) {
suffix = argvArg._[3];
}
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
let dockerfileArray = yield helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles);
for (let dockerfile of dockerfileArray) {
yield dockerfile.pull(localDockerRegistry, suffix);
}
});
exports.test = () => __awaiter(this, void 0, void 0, function* () {
yield exports.prepare();
return yield helpers.readDockerfiles()
.then(helpers.testDockerfiles);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFJeEMseUNBQXdDO0FBWXRDLDBCQUFPO0FBVlQsVUFBVTtBQUNWLHFFQUFxRDtBQVFuRCxxQkFSTyxtQ0FBVSxDQVFQO0FBUFosNkVBQTZEO0FBQzdELCtFQUErRDtBQUUvRCxZQUFZO0FBQ1osSUFBSSxvQkFBb0IsR0FBRyxJQUFJLDZDQUFlLEVBQUUsQ0FBQTtBQVNoRDs7O0dBR0c7QUFDUSxRQUFBLFNBQVMsR0FBRyxDQUFPLE9BQU87SUFDbkMsa0JBQVUsR0FBRyxPQUFPLENBQUE7SUFDcEIsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxNQUFNLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUMxQixJQUFJLE1BQU0sR0FBVyxPQUFPLENBQUMsQ0FBQyxDQUFFLENBQUMsQ0FBRSxDQUFBO1FBQ25DLE1BQU0sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7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ile on disk in npmci
*/
export declare class Dockerfile {
filePath: string;
repo: string;
version: string;
cleanTag: string;
buildTag: string;
containerName: string;
content: string;
baseImage: string;
localBaseImageDependent: boolean;
localBaseDockerfile: Dockerfile;
constructor(options: {
filePath?: string;
fileContents?: string | Buffer;
read?: boolean;
});
/**
* builds the Dockerfile
*/
build(): Promise<void>;
/**
* pushes the Dockerfile to a registry
*/
push(dockerRegistryArg: DockerRegistry, versionSuffix?: string): Promise<void>;
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg: DockerRegistry, versionSuffixArg?: string): Promise<void>;
/**
* tests the Dockerfile;
*/
test(): Promise<void>;
/**
* gets the id of a Dockerfile
*/
getId(): Promise<string>;
}

View File

@@ -0,0 +1,96 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const NpmciEnv = require("../npmci.env");
const npmci_bash_1 = require("../npmci.bash");
const paths = require("../npmci.paths");
const helpers = require("./mod.helpers");
/**
* class Dockerfile represents a Dockerfile on disk in npmci
*/
class Dockerfile {
constructor(options) {
this.filePath = options.filePath;
this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo;
this.version = helpers.dockerFileVersion(plugins.path.parse(options.filePath).base);
this.cleanTag = this.repo + ':' + this.version;
this.buildTag = this.cleanTag;
this.containerName = 'dockerfile-' + this.version;
if (options.filePath && options.read) {
this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath));
}
this.baseImage = helpers.dockerBaseImage(this.content);
this.localBaseImageDependent = false;
}
/**
* builds the Dockerfile
*/
build() {
return __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag);
let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .`;
yield npmci_bash_1.bash(buildCommand);
return;
});
}
/**
* pushes the Dockerfile to a registry
*/
push(dockerRegistryArg, versionSuffix = null) {
return __awaiter(this, void 0, void 0, function* () {
let pushTag = helpers.getDockerTagString(dockerRegistryArg.registryUrl, this.repo, this.version, versionSuffix);
yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${pushTag}`);
yield npmci_bash_1.bash(`docker push ${pushTag}`);
});
}
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg, versionSuffixArg = null) {
return __awaiter(this, void 0, void 0, function* () {
let pullTag = helpers.getDockerTagString(registryArg.registryUrl, this.repo, this.version, versionSuffixArg);
yield npmci_bash_1.bash(`docker pull ${pullTag}`);
yield npmci_bash_1.bash(`docker tag ${pullTag} ${this.buildTag}`);
});
}
/**
* tests the Dockerfile;
*/
test() {
return __awaiter(this, void 0, void 0, function* () {
let testFile = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh');
let testFileExists = plugins.smartfile.fs.fileExistsSync(testFile);
if (testFileExists) {
// run tests
yield npmci_bash_1.bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test');
yield npmci_bash_1.bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh');
yield npmci_bash_1.bash('docker commit npmci_test_container npmci_test_image');
yield npmci_bash_1.bash('docker run npmci_test_image sh /npmci_test/test.sh');
yield npmci_bash_1.bash('docker rm npmci_test_container');
yield npmci_bash_1.bash('docker rmi --force npmci_test_image');
}
else {
plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!');
}
});
}
/**
* gets the id of a Dockerfile
*/
getId() {
return __awaiter(this, void 0, void 0, function* () {
let containerId = yield npmci_bash_1.bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag);
return containerId;
});
}
}
exports.D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0FBQyxDQUFBO2dCQUNoRSxNQUFNLGlCQUFJLENBQUMsZ0NBQWdDLENBQUMsQ0FBQTtnQkFDNUMsTUFBTSxpQkFBSSxDQUFDLHFDQUFxQyxDQUFDLENBQUE7WUFDbkQsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLHFCQUFxQixHQUFHLElBQUksQ0FBQyxRQUFRLEdBQUcsaUNBQWlDLENBQUMsQ0FBQTtZQUNuRyxDQUFDO1FBQ0gsQ0FBQztLQUFBO0lBRUQ7O09BRUc7SUFDRyxLQUFLOztZQUNULElBQUksV0FBVyxHQUFHLE1BQU0saUJBQUksQ0FBQyxtREFBbUQsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUE7WUFDakcsTUFBTSxDQUFDLFdBQVcsQ0FBQTtRQUNwQixDQUFDO0tBQUE7Q0FDRjtBQWhGRCxnQ0FnRkMifQ==

View File

@@ -0,0 +1,13 @@
export interface IDockerRegistryConstructorOptions {
registryUrl: string;
username: string;
password: string;
}
export declare class DockerRegistry {
registryUrl: string;
username: string;
password: string;
constructor(optionsArg: IDockerRegistryConstructorOptions);
static fromEnvString(envString: string): DockerRegistry;
login(): Promise<void>;
}

View File

@@ -0,0 +1,50 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const npmci_bash_1 = require("../npmci.bash");
class DockerRegistry {
constructor(optionsArg) {
this.registryUrl = optionsArg.registryUrl;
this.username = optionsArg.username;
this.password = optionsArg.password;
plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`);
}
static fromEnvString(envString) {
let dockerRegexResultArray = envString.split('|');
if (dockerRegexResultArray.length !== 3) {
plugins.beautylog.error('malformed docker env var...');
process.exit(1);
return;
}
let registryUrl = dockerRegexResultArray[0];
let username = dockerRegexResultArray[1];
let password = dockerRegexResultArray[2];
return new DockerRegistry({
registryUrl: registryUrl,
username: username,
password: password
});
}
login() {
return __awaiter(this, void 0, void 0, function* () {
if (this.registryUrl === 'docker.io') {
yield npmci_bash_1.bash(`docker login -u ${this.username} -p ${this.password}`);
plugins.beautylog.info('Logged in to standard docker hub');
}
else {
yield npmci_bash_1.bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`);
}
plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`);
});
}
}
exports.DockerRegistry = DockerRegistry;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLmNsYXNzZXMuZG9ja2VycmVnaXN0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL21vZC5jbGFzc2VzLmRvY2tlcnJlZ2lzdHJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFDeEMsOENBQW9DO0FBUXBDO0lBSUUsWUFBYSxVQUE2QztRQUN4RCxJQUFJLENBQUMsV0FBVyxHQUFHLFVBQVUsQ0FBQyxXQUFXLENBQUE7UUFDekMsSUFBSSxDQUFDLFFBQVEsR0FBRyxVQUFVLENBQUMsUUFBUSxDQUFBO1FBQ25DLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFDLFFBQVEsQ0FBQTtRQUNuQyxPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyw4QkFBOEIsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUE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0FBQyxDQUFDO2dCQUNOLE1BQU0saUJBQUksQ0FBQyxtQkFBbUIsSUFBSSxDQUFDLFFBQVEsT0FBTyxJQUFJLENBQUMsUUFBUSxJQUFJLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQyxDQUFBO1lBQ3hGLENBQUM7WUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyw0QkFBNEIsSUFBSSxDQUFDLFdBQVcsR0FBRyxDQUFDLENBQUE7UUFDdkUsQ0FBQztLQUFBO0NBQ0Y7QUFyQ0Qsd0NBcUNDIn0=

View File

@@ -0,0 +1,9 @@
import { Objectmap } from 'lik';
import { DockerRegistry } from './mod.classes.dockerregistry';
export declare class RegistryStorage {
objectMap: Objectmap<DockerRegistry>;
constructor();
addRegistry(registryArg: DockerRegistry): void;
getRegistryByUrl(registryUrlArg: string): DockerRegistry;
loginAll(): Promise<void>;
}

View File

@@ -0,0 +1,36 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const lik_1 = require("lik");
class RegistryStorage {
constructor() {
this.objectMap = new lik_1.Objectmap();
// Nothing here
}
addRegistry(registryArg) {
this.objectMap.add(registryArg);
}
getRegistryByUrl(registryUrlArg) {
return this.objectMap.find(registryArg => {
return registryArg.registryUrl === registryUrlArg;
});
}
loginAll() {
return __awaiter(this, void 0, void 0, function* () {
yield this.objectMap.forEach((registryArg) => __awaiter(this, void 0, void 0, function* () {
yield registryArg.login();
}));
plugins.beautylog.success('logged in successfully into all available DockerRegistries!');
});
}
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@@
import { Dockerfile } from './mod.classes.dockerfile';
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export declare let readDockerfiles: () => Promise<Dockerfile[]>;
/**
* sorts Dockerfiles into a dependency chain
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* tests all Dockerfiles in by calling class Dockerfile.test();
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
*/
export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* returns a version for a docker file
* @execution SYNC
*/
export declare let dockerFileVersion: (dockerfileNameArg: string) => string;
/**
* returns the docker base image for a Dockerfile
*/
export declare let dockerBaseImage: (dockerfileContentArg: string) => string;
/**
* returns the docker tag
*/
export declare let getDockerTagString: (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string) => string;
/**
*
*/
export declare let cleanTagsArrayFunction: (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]) => string[];

152
dist/mod_docker/mod.helpers.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/mod_docker/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../npmci.plugins';

7
dist/mod_docker/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0=

10
dist/mod_node/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* Install a specific version of node
* @param versionArg
*/
export declare let install: (versionArg: any) => Promise<void>;

85
dist/mod_node/index.js vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("../npmci.plugins");
const npmciConfig = require("../npmci.config");
const npmci_bash_1 = require("../npmci.bash");
/**
* handle cli input
* @param argvArg
*/
exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () {
if (argvArg._.length >= 3) {
let action = argvArg._[1];
switch (action) {
case 'install':
yield exports.install(argvArg._[2]);
break;
default:
plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`);
}
}
else {
plugins.beautylog.error(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`);
}
});
/**
* Install a specific version of node
* @param versionArg
*/
exports.install = (versionArg) => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.log(`now installing node version ${versionArg}`);
let version;
if (versionArg === 'stable') {
version = 'stable';
}
else if (versionArg === 'lts') {
version = '6';
}
else if (versionArg === 'legacy') {
version = '6';
}
else {
version = versionArg;
}
if (yield npmci_bash_1.nvmAvailable.promise) {
yield npmci_bash_1.bash(`nvm install ${version} && nvm alias default ${version}`);
plugins.beautylog.success(`Node version ${version} successfully installed!`);
}
else {
plugins.beautylog.warn('Nvm not in path so staying at installed node version!');
}
yield npmci_bash_1.bash('node -v');
yield npmci_bash_1.bash('npm -v');
// lets look for further config
yield npmciConfig.getConfig()
.then((configArg) => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.log('Now checking for needed global npm tools...');
for (let npmTool of configArg.globalNpmTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`);
let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`);
let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === '');
if (toolAvailable) {
plugins.beautylog.log(`Tool ${npmTool} is available`);
}
else {
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
if (yield npmci_bash_1.yarnAvailable.promise) {
yield npmci_bash_1.bash(`yarn global add ${npmTool}`);
}
else {
yield npmci_bash_1.bash(`npm install ${npmTool} -q -g`);
}
}
}
plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!');
}));
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfbm9kZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsNENBQTJDO0FBQzNDLCtDQUE4QztBQUM5Qyw4Q0FLc0I7QUFFdEI7OztHQUdHO0FBQ1EsUUFBQSxTQUFTLEdBQUcsQ0FBTyxPQUFPO0lBQ25DLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFBTSxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDMUIsSUFBSSxNQUFNLEdBQVcsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMs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BQUE7WUFDdEYsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxPQUFPLGVBQWUsQ0FBQyxDQUFBO1lBQ3ZELENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyx1QkFBdUIsT0FBTyxXQUFXLENBQUMsQ0FBQTtnQkFDakUsRUFBRSxDQUFDLENBQUMsTUFBTSwwQkFBYSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7b0JBQ2hDLE1BQU0saUJBQUksQ0FBQyxtQkFBbUIsT0FBTyxFQUFFLENBQUMsQ0FBQTtnQkFDMUMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLGlCQUFJLENBQUMsZUFBZSxPQUFPLFFBQVEsQ0FBQyxDQUFBO2dCQUM1QyxDQUFDO1lBQ0gsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxvRUFBb0UsQ0FBQyxDQUFBO0lBQ2pHLENBQUMsQ0FBQSxDQUFDLENBQUE7QUFDTixDQUFDLENBQUEsQ0FBQSJ9

6
dist/mod_npm/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
export declare let test: () => Promise<void>;

68
dist/mod_npm/index.js vendored Normal file
View File

@@ -0,0 +1,68 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
const npmci_bash_1 = require("../npmci.bash");
/**
* handle cli input
* @param argvArg
*/
exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () {
if (argvArg._.length >= 2) {
let action = argvArg._[1];
switch (action) {
case 'install':
yield install();
break;
case 'prepare':
yield prepare();
break;
case 'test':
yield exports.test();
break;
default:
plugins.beautylog.error(`>>npmci npm ...<< action >>${action}<< not supported`);
}
}
else {
plugins.beautylog.log(`>>npmci npm ...<< cli arguments invalid... Please read the documentation.`);
}
});
/**
* authenticates npm with token from env var
*/
let prepare = () => __awaiter(this, void 0, void 0, function* () {
let npmrcPrefix = '//registry.npmjs.org/:_authToken=';
let npmToken = process.env.NPMCI_TOKEN_NPM;
let npmrcFileString = npmrcPrefix + npmToken;
if (npmToken) {
plugins.beautylog.info('found access token');
}
else {
plugins.beautylog.error('no access token found! Exiting!');
process.exit(1);
}
plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc');
return;
});
let install = () => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now installing dependencies:');
if (yield npmci_bash_1.yarnAvailable.promise) {
yield npmci_bash_1.bash('yarn install');
}
else {
yield npmci_bash_1.bash('npm install');
}
});
exports.test = () => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now starting tests:');
yield npmci_bash_1.bash('yarn test');
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEMsOENBS3NCO0FBRXRCOzs7R0FHRztBQUNRLFFBQUEsU0FBUyxHQUFHLENBQU8sT0FBTztJQUNuQ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BQUksQ0FBQyxDQUFDO1FBQ04sT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsaUNBQWlDLENBQUMsQ0FBQTtRQUMxRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ2pCLENBQUM7SUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsZUFBZSxFQUFFLGNBQWMsQ0FBQyxDQUFBO0lBQ2xFLE1BQU0sQ0FBQTtBQUNSLENBQUMsQ0FBQSxDQUFBO0FBRUQsSUFBSSxPQUFPLEdBQUc7SUFDWixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyw4QkFBOEIsQ0FBQyxDQUFBO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sMEJBQWEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQ2hDLE1BQU0saUJBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQTtJQUM1QixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixNQUFNLGlCQUFJLENBQUMsYUFBYSxDQUFDLENBQUE7SUFDM0IsQ0FBQztBQUNILENBQUMsQ0FBQSxDQUFBO0FBRVUsUUFBQSxJQUFJLEdBQUc7SUFDaEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMscUJBQXFCLENBQUMsQ0FBQTtJQUM3QyxNQUFNLGlCQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7QUFDekIsQ0FBQyxDQUFBLENBQUEifQ==

1
dist/mod_npm/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../npmci.plugins';

7
dist/mod_npm/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0=

5
dist/mod_ssh/index.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/
export declare let prepare: () => Promise<void>;

66
dist/mod_ssh/index.js vendored Normal file
View File

@@ -0,0 +1,66 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
let sshInstance;
exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () {
if (argvArg._.length >= 2) {
let action = argvArg._[1];
switch (action) {
case 'prepare':
yield exports.prepare();
break;
default:
plugins.beautylog.error(`action >>${action}<< not supported`);
}
}
});
/**
* checks if not undefined
*/
let notUndefined = (stringArg) => {
return (stringArg && stringArg !== 'undefined' && stringArg !== '##');
};
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/
exports.prepare = () => __awaiter(this, void 0, void 0, function* () {
sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv);
if (!process.env.NPMTS_TEST) {
sshInstance.writeToDisk();
}
else {
plugins.beautylog.log('In test mode, so not storing SSH keys to disk!');
}
});
/**
* gets called for each found SSH ENV Var and deploys it
*/
let evaluateSshEnv = (sshkeyEnvVarArg) => __awaiter(this, void 0, void 0, function* () {
let sshEnvArray = sshkeyEnvVarArg.split('|');
let sshKey = new plugins.smartssh.SshKey();
plugins.beautylog.info('Found SSH identity for ' + sshEnvArray[1]);
if (notUndefined(sshEnvArray[0])) {
plugins.beautylog.log('---> host defined!');
sshKey.host = sshEnvArray[0];
}
if (notUndefined(sshEnvArray[1])) {
plugins.beautylog.log('---> privKey defined!');
sshKey.privKeyBase64 = sshEnvArray[1];
}
if (notUndefined(sshEnvArray[2])) {
plugins.beautylog.log('---> pubKey defined!');
sshKey.pubKeyBase64 = sshEnvArray[2];
}
sshInstance.addKey(sshKey);
return;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfc3NoL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFDeEMsSUFBSSxXQUF5QyxDQUFBO0FBRWxDLFFBQUEsU0FBUyxHQUFHLENBQU8sT0FBTztJQUNuQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzFCLElBQUksTUFBTSxHQUFXLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDakMsTUFBTSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztZQUNmLEtBQUssU0FBUztnQkFDWixNQUFNLGVBQU8sRUFBRSxDQUFBO2dCQUNmLEtBQUssQ0FBQTtZQUNQO2dCQUNFLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFlBQV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";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfc3NoL21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0=

1
dist/mod_trigger/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export declare let trigger: () => Promise<void>;

35
dist/mod_trigger/index.js vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./mod.plugins");
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
exports.trigger = () => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.info('now running triggers');
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger);
});
let evaluateTrigger = (triggerEnvVarArg) => __awaiter(this, void 0, void 0, function* () {
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg);
let regexDomain = triggerRegexResultArray[1];
let regexProjectId = triggerRegexResultArray[2];
let regexProjectTriggerToken = triggerRegexResultArray[3];
let regexRefName = triggerRegexResultArray[4];
let regexTriggerName;
if (triggerRegexResultArray.length === 6) {
regexTriggerName = triggerRegexResultArray[5];
}
else {
regexTriggerName = 'Unnamed Trigger';
}
plugins.beautylog.info('Found Trigger!');
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
plugins.request.post('https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds', { form: { token: regexProjectTriggerToken, ref: regexRefName }
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdHJpZ2dlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBR3hDLElBQUksaUJBQWlCLEdBQUcsZ0dBQWdHLENBQUE7QUFFN0csUUFBQSxPQUFPLEdBQUc7SUFDbkIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsc0JBQXNCLENBQUMsQ0FBQTtJQUM5QyxPQUFPLENBQUMsVUFBVSxDQUFDLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsaUJBQWlCLEVBQUUsZUFBZSxDQUFDLENBQUE7QUFDdEYsQ0FBQyxDQUFBLENBQUE7QUFFRCxJQUFJLGVBQWUsR0FBRyxDQUFPLGdCQUFnQjtJQUMzQyxJQUFJLHVCQUF1QixHQUFHLGlCQUFpQixDQUFDLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO0lBQ3RFLElBQUksV0FBVyxHQUFHLHVCQUF1QixDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQzVDLElBQUksY0FBYyxHQUFHLHVCQUF1QixDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQy9DLElBQUksd0JBQXdCLEdBQUcsdUJBQXVCLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDekQsSUFBSSxZQUFZLEdBQUcsdUJBQXVCLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDN0MsSUFBSSxnQkFBZ0IsQ0FBQTtJQUNwQixFQUFFLENBQUMsQ0FBQyx1QkFBdUIsQ0FBQyxNQUFNLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUN6QyxnQkFBZ0IsR0FBRyx1QkFBdUIsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUMvQyxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixnQkFBZ0IsR0FBRyxpQkFBaUIsQ0FBQTtJQUN0QyxDQUFDO0lBQ0QsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtJQUN4QyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQywyQkFBMkIsR0FBRyxZQUFZLEdBQUcsTUFBTSxHQUFHLGdCQUFnQixDQUFDLENBQUE7SUFDN0YsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQ2xCLHFDQUFxQyxHQUFHLGNBQWMsR0FBRyxpQkFBaUIsRUFDMUUsRUFBRSxJQUFJLEVBQUUsRUFBRSxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsR0FBRyxFQUFFLFlBQVksRUFBRTtLQUMvRCxDQUFDLENBQUE7QUFDSixDQUFDLENBQUEsQ0FBQSJ9

1
dist/mod_trigger/mod.plugins.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../npmci.plugins';

7
dist/mod_trigger/mod.plugins.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdHJpZ2dlci9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9

18
dist/npmci.bash.d.ts vendored
View File

@@ -1,2 +1,16 @@
import "typings-global";
export declare let bash: (commandArg: any) => void;
import * as plugins from './npmci.plugins';
/**
* wether nvm is available or not
*/
export declare let nvmAvailable: plugins.q.Deferred<boolean>;
export declare let yarnAvailable: plugins.q.Deferred<boolean>;
/**
* bash() allows using bash with nvm in path
* @param commandArg - The command to execute
* @param retryArg - The retryArg: 0 to any positive number will retry, -1 will always succeed, -2 will return undefined
*/
export declare let bash: (commandArg: string, retryArg?: number) => Promise<string>;
/**
* bashNoError allows executing stuff without throwing an error
*/
export declare let bashNoError: (commandArg: string) => Promise<string>;

113
dist/npmci.bash.js vendored
View File

@@ -1,13 +1,106 @@
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
exports.bash = function (commandArg) {
var exitCode = plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\"").code;
if (exitCode !== 0) {
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
const smartq = require("smartq");
/**
* wether nvm is available or not
*/
exports.nvmAvailable = smartq.defer();
exports.yarnAvailable = smartq.defer();
/**
* the smartshell instance for npmci
*/
let npmciSmartshell = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: []
});
/**
* check for tools.
*/
let checkToolsAvailable = () => __awaiter(this, void 0, void 0, function* () {
// check for nvm
if (!process.env.NPMTS_TEST) {
if ((yield plugins.smartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0) {
npmciSmartshell.addSourceFiles([`/usr/local/nvm/nvm.sh`]);
exports.nvmAvailable.resolve(true);
}
else if ((yield plugins.smartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0) {
npmciSmartshell.addSourceFiles([`~/.nvm/nvm.sh`]);
exports.nvmAvailable.resolve(true);
}
else {
exports.nvmAvailable.resolve(false);
}
// check for yarn
yield plugins.smartshell.which('yarn').then(() => __awaiter(this, void 0, void 0, function* () {
yield plugins.smartshell.exec(`yarn config set cache-folder ${plugins.path.join(paths.cwd, '.yarn')}`);
exports.yarnAvailable.resolve(true);
}), () => { exports.yarnAvailable.resolve(false); });
}
else {
exports.nvmAvailable.resolve(true);
exports.yarnAvailable.resolve(true);
}
});
checkToolsAvailable();
/**
* bash() allows using bash with nvm in path
* @param commandArg - The command to execute
* @param retryArg - The retryArg: 0 to any positive number will retry, -1 will always succeed, -2 will return undefined
*/
exports.bash = (commandArg, retryArg = 2) => __awaiter(this, void 0, void 0, function* () {
yield exports.nvmAvailable.promise; // make sure nvm check has run
let execResult;
// determine if we fail
let failOnError = true;
if (retryArg === -1) {
failOnError = false;
retryArg = 0;
}
if (!process.env.NPMTS_TEST) {
for (let i = 0; i <= retryArg; i++) {
if (process.env.DEBUG_NPMCI === 'true') {
console.log(commandArg);
}
execResult = yield npmciSmartshell.exec(commandArg);
// determine how bash reacts to error and success
if (execResult.exitCode !== 0 && i === retryArg) {
if (failOnError) {
plugins.beautylog.error('something went wrong and retries are exhausted');
process.exit(1);
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQ2hDLFlBQUksR0FBRyxVQUFDLFVBQVU7SUFDekIsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQy9CLDJDQUEyQztRQUMzQyxVQUFVO1FBQ1YsSUFBSSxDQUNQLENBQUMsSUFBSSxDQUFDO0lBQ1AsRUFBRSxDQUFBLENBQUMsUUFBUSxLQUFLLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDZixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3BCLENBQUM7QUFDTCxDQUFDLENBQUEiLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vbnBtY2kucGx1Z2luc1wiO1xyXG5leHBvcnQgbGV0IGJhc2ggPSAoY29tbWFuZEFyZykgPT4ge1xyXG4gICAgbGV0IGV4aXRDb2RlID0gcGx1Z2lucy5zaGVsbGpzLmV4ZWMoXHJcbiAgICAgICAgXCJiYXNoIC1jIFxcXCJzb3VyY2UgL3Vzci9sb2NhbC9udm0vbnZtLnNoICYmXCIgK1xyXG4gICAgICAgIGNvbW1hbmRBcmcgK1xyXG4gICAgICAgIFwiXFxcIlwiXHJcbiAgICApLmNvZGU7XHJcbiAgICBpZihleGl0Q29kZSAhPT0gMCl7XHJcbiAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xyXG4gICAgfVxyXG59Il19
}
else if (execResult.exitCode === 0) {
i = retryArg + 1; // retry +1 breaks for loop, if everything works out ok retrials are not wanted
}
else {
plugins.beautylog.warn('Something went wrong! Exit Code: ' + execResult.exitCode.toString());
plugins.beautylog.info('Retry ' + (i + 1).toString() + ' of ' + retryArg.toString());
}
}
}
else {
plugins.beautylog.log('ShellExec would be: ' + commandArg);
execResult = {
exitCode: 0,
stdout: 'testOutput'
};
}
return execResult.stdout;
});
/**
* bashNoError allows executing stuff without throwing an error
*/
exports.bashNoError = (commandArg) => __awaiter(this, void 0, void 0, function* () {
return yield exports.bash(commandArg, -1);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLDJDQUEwQztBQUMxQyx1Q0FBc0M7QUFFdEMsaUNBQWdDO0FBRWhDOztHQUVHO0FBQ1EsUUFBQSxZQUFZLEdBQUcsTUFBTSxDQUFDLEtBQUssRUFBVyxDQUFBO0FBQ3RDLFFBQUEsYUFBYSxHQUFHLE1BQU0sQ0FBQyxLQUFLLEVBQVcsQ0FBQTtBQUNsRDs7R0FFRztBQUNILElBQUksZUFBZSxHQUFHLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUM7SUFDdEQsUUFBUSxFQUFFLE1BQU07SUFDaEIsZUFBZSxFQUFFLEVBQUU7Q0FDcEIsQ0FBQyxDQUFBO0FBRUY7O0dBRUc7QUFDSCxJQUFJLG1CQUFtQixHQUFHO0lBQ3hCLGdCQUFnQjtJQUNoQixFQUFFLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztRQUM1QixFQUFFLENBQUMsQ0FDRCxDQUFDLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsd0NBQXdDLENBQUMsQ0FBQyxDQUFDLFFBQVEsS0FBSyxDQUMvRixDQUFDLENBQUMsQ0FBQztZQUNELGVBQWUsQ0FBQyxjQUFjLENBQUMsQ0FBRS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UMsQ0FBQSxDQUFBO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLFdBQVcsR0FBRyxDQUFPLFVBQWtCO0lBQ2hELE1BQU0sQ0FBQyxNQUFNLFlBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQTtBQUNuQyxDQUFDLENBQUEsQ0FBQSJ9

0
dist/npmci.cli.d.ts vendored Normal file
View File

88
dist/npmci.cli.js vendored Normal file
View File

@@ -0,0 +1,88 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
plugins.beautylog.log('npmci version: ' + npmciInfo.version);
const npmciMods = require("./npmci.mods");
let smartcli = new plugins.smartcli.Smartcli();
smartcli.addVersion(npmciInfo.version);
// clean
smartcli.addCommand('clean')
.then((argv) => __awaiter(this, void 0, void 0, function* () {
let modClean = yield npmciMods.modClean.load();
yield modClean.clean();
})).catch(err => {
console.log(err);
process.exit(1);
});
// cloudflare
smartcli.addCommand('cloudflare')
.then((argvArg) => __awaiter(this, void 0, void 0, function* () {
let modPurge = yield npmciMods.modCloudflare.load();
yield modPurge.handleCli(argvArg);
})).catch(err => {
console.log(err);
});
// command
smartcli.addCommand('command')
.then((argv) => __awaiter(this, void 0, void 0, function* () {
let modCommand = yield npmciMods.modCommand.load();
yield modCommand.command();
})).catch(err => {
console.log(err);
process.exit(1);
});
// build
smartcli.addCommand('docker')
.then((argvArg) => __awaiter(this, void 0, void 0, function* () {
let modDocker = yield npmciMods.modDocker.load();
yield modDocker.handleCli(argvArg);
})).catch(err => {
console.log(err);
process.exit(1);
});
// node
smartcli.addCommand('node')
.then((argvArg) => __awaiter(this, void 0, void 0, function* () {
let modNode = yield npmciMods.modNode.load();
yield modNode.handleCli(argvArg);
})).catch(err => {
console.log(err);
});
// npm
smartcli.addCommand('npm')
.then((argvArg) => __awaiter(this, void 0, void 0, function* () {
let modNpm = yield npmciMods.modNpm.load();
yield modNpm.handleCli(argvArg);
})).catch(err => {
console.log(err);
});
// trigger
smartcli.addCommand('ssh')
.then((argvArg) => __awaiter(this, void 0, void 0, function* () {
let modSsh = yield npmciMods.modSsh.load();
yield modSsh.handleCli(argvArg);
})).catch(err => {
console.log(err);
process.exit(1);
});
// trigger
smartcli.addCommand('trigger')
.then((argv) => __awaiter(this, void 0, void 0, function* () {
let modTrigger = yield npmciMods.modTrigger.load();
yield modTrigger.trigger();
})).catch(err => {
console.log(err);
process.exit(1);
});
smartcli.startParse();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY2xpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLElBQUksU0FBUyxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUE7QUFDOUUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO0FBSTVELDBDQUF5QztBQUV6QyxJQUFJLFFBQVEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxFQU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M1QixDQUFDLENBQUEsQ0FBQyxDQUFDLEtBQUssQ0FBQyxHQUFHO0lBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUNoQixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBQ2pCLENBQUMsQ0FBQyxDQUFBO0FBRUosUUFBUSxDQUFDLFVBQVUsRUFBRSxDQUFBIn0=

4
dist/npmci.config.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export interface INpmciOptions {
globalNpmTools: string[];
}
export declare let getConfig: () => Promise<INpmciOptions>;

21
dist/npmci.config.js vendored Normal file
View File

@@ -0,0 +1,21 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
exports.getConfig = () => __awaiter(this, void 0, void 0, function* () {
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
let defaultConfig = {
globalNpmTools: []
};
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
return npmciConfig;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBTTNCLFFBQUEsU0FBUyxHQUFHO0lBQ3JCLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQzVELElBQUksYUFBYSxHQUFrQjtRQUNqQyxjQUFjLEVBQUUsRUFBRTtLQUNuQixDQUFBO0lBQ0QsSUFBSSxXQUFXLEdBQUcsYUFBYSxDQUFDLE9BQU8sQ0FBZ0IsT0FBTyxFQUFFLGFBQWEsQ0FBQyxDQUFBO0lBQzlFLE1BQU0sQ0FBQyxXQUFXLENBQUE7QUFDcEIsQ0FBQyxDQUFBLENBQUEifQ==

5
dist/npmci.env.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { GitRepo } from 'smartstring';
/**
* a info instance about the git respoitory at cwd :)
*/
export declare let repo: GitRepo;

7
dist/npmci.env.js vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartstring_1 = require("smartstring");
if (process.env.CI_REPOSITORY_URL) {
exports.repo = new smartstring_1.GitRepo(process.env.CI_REPOSITORY_URL);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsNkNBQXFDO0FBT3JDLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsQ0FBQyxDQUFDO0lBQ2xDLFlBQUksR0FBRyxJQUFJLHFCQUFPLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFBO0FBQ25ELENBQUMifQ==

View File

@@ -1,2 +0,0 @@
import "typings-global";
export declare let install: (versionArg: any) => any;

25
dist/npmci.install.js vendored
View File

@@ -1,25 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var npmci_bash_1 = require("./npmci.bash");
exports.install = function (versionArg) {
var done = plugins.q.defer();
var version;
if (versionArg = "lts") {
version = "4";
}
else {
version = versionArg;
}
;
plugins.beautylog.log("now installing " + "node ".green + ("version " + version).yellow);
npmci_bash_1.bash("nvm install " + version +
" && nvm alias default " + version);
plugins.beautylog.success("Node version " + version + " successfully installed!");
npmci_bash_1.bash("node -v");
npmci_bash_1.bash("npm -v");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUV2QixlQUFPLEdBQUcsVUFBQyxVQUFVO0lBQzVCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxPQUFjLENBQUM7SUFDbkIsRUFBRSxDQUFBLENBQUMsVUFBVSxHQUFHLEtBQUssQ0FBQyxDQUFBLENBQUM7UUFDbkIsT0FBTyxHQUFHLEdBQUcsQ0FBQztJQUNsQixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLEdBQUcsVUFBVSxDQUFDO0lBQ3pCLENBQUM7SUFBQSxDQUFDO0lBQ0YsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsT0FBTyxDQUFDLEtBQUssR0FBRyxDQUFDLFVBQVUsR0FBRyxPQUFPLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN6RixpQkFBSSxDQUNBLGNBQWMsR0FBRyxPQ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gICAgICAgIFwiICYmIG52bSBhbGlhcyBkZWZhdWx0IFwiICsgdmVyc2lvblxyXG4gICAgKTtcclxuICAgIHBsdWdpbnMuYmVhdXR5bG9nLnN1Y2Nlc3MoXCJOb2RlIHZlcnNpb24gXCIgKyB2ZXJzaW9uICsgXCIgc3VjY2Vzc2Z1bGx5IGluc3RhbGxlZCFcIik7XHJcbiAgICBiYXNoKFwibm9kZSAtdlwiKTtcclxuICAgIGJhc2goXCJucG0gLXZcIik7XHJcbiAgICBkb25lLnJlc29sdmUoKTtcclxuICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbn0iXX0=

17
dist/npmci.mods.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
import * as _modClean from './mod_clean/index';
import * as _modCloudflare from './mod_cloudflare/index';
import * as _modCommand from './mod_command/index';
import * as _modDocker from './mod_docker/index';
import * as _modNpm from './mod_npm/index';
import * as _modNode from './mod_node/index';
import * as _modSsh from './mod_ssh/index';
import * as _modTrigger from './mod_trigger/index';
import { LazyModule } from 'smartsystem';
export declare let modClean: LazyModule<typeof _modClean>;
export declare let modCloudflare: LazyModule<typeof _modCloudflare>;
export declare let modCommand: LazyModule<typeof _modCommand>;
export declare let modDocker: LazyModule<typeof _modDocker>;
export declare let modNode: LazyModule<typeof _modNode>;
export declare let modNpm: LazyModule<typeof _modNpm>;
export declare let modSsh: LazyModule<typeof _modSsh>;
export declare let modTrigger: LazyModule<typeof _modTrigger>;

12
dist/npmci.mods.js vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartsystem_1 = require("smartsystem");
exports.modClean = new smartsystem_1.LazyModule('./mod_clean/index', __dirname);
exports.modCloudflare = new smartsystem_1.LazyModule('./mod_cloudflare/index', __dirname);
exports.modCommand = new smartsystem_1.LazyModule('./mod_command/index', __dirname);
exports.modDocker = new smartsystem_1.LazyModule('./mod_docker/index', __dirname);
exports.modNode = new smartsystem_1.LazyModule('./mod_node/index', __dirname);
exports.modNpm = new smartsystem_1.LazyModule('./mod_npm/index', __dirname);
exports.modSsh = new smartsystem_1.LazyModule('./mod_ssh/index', __dirname);
exports.modTrigger = new smartsystem_1.LazyModule('./mod_trigger/index', __dirname);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kubW9kcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLm1vZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFTQSw2Q0FBd0M7QUFFN0IsUUFBQSxRQUFRLEdBQUcsSUFBSSx3QkFBVSxDQUFtQixtQkFBbUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUMzRSxRQUFBLGFBQWEsR0FBRyxJQUFJLHdCQUFVLENBQXdCLHdCQUF3QixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQzFGLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDakYsUUFBQSxTQUFTLEdBQUcsSUFBSSx3QkFBVSxDQUFvQixvQkFBb0IsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUM5RSxRQUFBLE9BQU8sR0FBRyxJQUFJLHdCQUFVLENBQWtCLGtCQUFrQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQ3hFLFFBQUEsTUFBTSxHQUFHLElBQUksd0JBQVUsQ0FBaUIsaUJBQWlCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDckUsUUFBQSxNQUFNLEdBQUcsSUFBSSx3QkFBVSxDQUFpQixpQkFBaUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUNyRSxRQUFBLFVBQVUsR0FBRyxJQUFJLHdCQUFVLENBQXFCLHFCQUFxQixFQUFFLFNBQVMsQ0FBQyxDQUFBIn0=

2
dist/npmci.monitor.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Smartmonitor } from 'smartmonitor';
export declare let npmciMonitor: Smartmonitor;

18
dist/npmci.monitor.js vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
const smartmonitor_1 = require("smartmonitor");
exports.npmciMonitor = new smartmonitor_1.Smartmonitor();
let monitorEnvString = process.env.NPMCI_MONITOR;
if (monitorEnvString) {
let npmciMonitorKeys = monitorEnvString.split('|');
exports.npmciMonitor.addInstrumental({
apiKey: process.env.NPMCI_MONITOR
});
plugins.beautylog.info('Monitoring activated');
}
else {
plugins.beautylog.warn('Monitoring could not be enabled due to missing API-KEY');
}
exports.npmciMonitor.increment('lossless-ci.builds', 1);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kubW9uaXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLm1vbml0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMEM7QUFHMUMsK0NBQTJDO0FBRWhDLFFBQUEsWUFBWSxHQUFHLElBQUksMkJBQVksRUFBRSxDQUFBO0FBRTVDLElBQUksZ0JBQWdCLEdBQVcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUE7QUFFeEQsRUFBRSxDQUFDLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDO0lBQ3JCLElBQUksZ0JBQWdCLEdBQWEsZ0JBQWdCLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQzVELG9CQUFZLENBQUMsZUFBZSxDQUFDO1FBQzNCLE1BQU0sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWE7S0FDbEMsQ0FBQyxDQUFBO0lBQ0YsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsc0JBQXNCLENBQUMsQ0FBQTtBQUNoRCxDQUFDO0FBQUMsSUFBSSxDQUFDLENBQUM7SUFDTixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyx3REFBd0QsQ0FBQyxDQUFBO0FBQ2xGLENBQUM7QUFFRCxvQkFBWSxDQUFDLFNBQVMsQ0FBQyxvQkFBb0IsRUFBRSxDQUFDLENBQUMsQ0FBQSJ9

5
dist/npmci.paths.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export declare let cwd: string;
export declare let NpmciPackageRoot: string;
export declare let NpmciPackageConfig: string;
export declare let NpmciProjectDir: string;
export declare let NpmciTestDir: string;

9
dist/npmci.paths.js vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
exports.cwd = process.cwd();
exports.NpmciPackageRoot = plugins.path.join(__dirname, '../');
exports.NpmciPackageConfig = plugins.path.join(exports.NpmciPackageRoot, './config.json');
exports.NpmciProjectDir = exports.cwd;
exports.NpmciTestDir = plugins.path.join(exports.cwd, './test');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEwQztBQUUvQixRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7QUFFbkIsUUFBQSxnQkFBZ0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsS0FBSyxDQUFDLENBQUE7QUFDckQsUUFBQSxrQkFBa0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBZ0IsRUFBQyxlQUFlLENBQUMsQ0FBQTtBQUN4RSxRQUFBLGVBQWUsR0FBRyxXQUFHLENBQUE7QUFDckIsUUFBQSxZQUFZLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBRyxFQUFDLFFBQVEsQ0FBQyxDQUFBIn0=

View File

@@ -1,6 +1,22 @@
import "typings-global";
export import beautylog = require("beautylog");
export declare let commander: any;
export declare let q: any;
export declare let shelljs: any;
export import smartfile = require("smartfile");
export import beautylog = require('beautylog');
export declare let gulp: any;
export import gulpFunction = require('gulp-function');
export import lodash = require('lodash');
export import npmextra = require('npmextra');
export import path = require('path');
export import projectinfo = require('projectinfo');
export import q = require('smartq');
export declare let request: any;
export import smartcli = require('smartcli');
export import smartdelay = require('smartdelay');
export import smartfile = require('smartfile');
export import shelljs = require('shelljs');
export import smartmonitor = require('smartmonitor');
export import smartparam = require('smartparam');
export import smartq = require('smartq');
export import smartshell = require('smartshell');
export import smartsocket = require('smartsocket');
export import smartsystem = require('smartsystem');
export import smartssh = require('smartssh');
export import smartstring = require('smartstring');
export import through2 = require('through2');

28
dist/npmci.plugins.js vendored
View File

@@ -1,9 +1,25 @@
"use strict";
require("typings-global");
Object.defineProperty(exports, "__esModule", { value: true });
exports.beautylog = require("beautylog");
exports.commander = require("commander");
exports.q = require("q");
exports.shelljs = require("shelljs");
exports.gulp = require('gulp');
exports.gulpFunction = require("gulp-function");
exports.lodash = require("lodash");
exports.npmextra = require("npmextra");
exports.path = require("path");
exports.projectinfo = require("projectinfo");
exports.q = require("smartq");
exports.request = require('request');
exports.smartcli = require("smartcli");
exports.smartdelay = require("smartdelay");
exports.smartfile = require("smartfile");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDakMsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNqQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMiLCJmaWxlIjoibnBtY2kucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmV4cG9ydCBpbXBvcnQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcclxuZXhwb3J0IGxldCBjb21tYW5kZXIgPSByZXF1aXJlKFwiY29tbWFuZGVyXCIpO1xyXG5leHBvcnQgbGV0IHEgPSByZXF1aXJlKFwicVwiKTtcclxuZXhwb3J0IGxldCBzaGVsbGpzID0gcmVxdWlyZShcInNoZWxsanNcIik7XHJcbmV4cG9ydCBpbXBvcnQgc21hcnRmaWxlID0gcmVxdWlyZShcInNtYXJ0ZmlsZVwiKTsiXX0=
exports.shelljs = require("shelljs");
exports.smartmonitor = require("smartmonitor");
exports.smartparam = require("smartparam");
exports.smartq = require("smartq");
exports.smartshell = require("smartshell");
exports.smartsocket = require("smartsocket");
exports.smartsystem = require("smartsystem");
exports.smartssh = require("smartssh");
exports.smartstring = require("smartstring");
exports.through2 = require("through2");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBOEM7QUFDbkMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO0FBQ2pDLGdEQUFxRDtBQUNyRCxtQ0FBd0M7QUFDeEMsdUNBQTRDO0FBQzVDLCtCQUFvQztBQUNwQyw2Q0FBa0Q7QUFDbEQsOEJBQW1DO0FBQ3hCLFFBQUEsT0FBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQTtBQUN2Qyx1Q0FBNEM7QUFDNUMsMkNBQWdEO0FBQ2hELHlDQUE4QztBQUM5QyxxQ0FBMEM7QUFDMUMsK0NBQW9EO0FBQ3BELDJDQUFnRDtBQUNoRCxtQ0FBd0M7QUFDeEMsMkNBQWdEO0FBQ2hELDZDQUFrRDtBQUNsRCw2Q0FBa0Q7QUFDbEQsdUNBQTRDO0FBQzVDLDZDQUFrRDtBQUNsRCx1Q0FBNEMifQ==

View File

@@ -1,2 +0,0 @@
import "typings-global";
export declare let publish: () => any;

23
dist/npmci.publish.js vendored
View File

@@ -1,23 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var npmci_bash_1 = require("./npmci.bash");
var npmrcPrefix = "//registry.npmjs.org/:_authToken=";
var npmToken = process.env.NPMCITOKEN;
var npmrcFileString = npmrcPrefix + npmToken;
exports.publish = function () {
var done = plugins.q.defer();
if (npmToken) {
plugins.beautylog.info("found access token");
}
else {
plugins.beautylog.error("no access token found! Exiting!");
process.exit(1);
}
plugins.smartfile.memory.toFsSync(npmrcFileString, { fileName: ".npmrc", filePath: "/root" });
npmci_bash_1.bash("npm publish");
plugins.beautylog.ok("Done!");
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUVsQyxJQUFJLFdBQVcsR0FBVSxtQ0FBbUMsQ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bWNpLmJhc2hcIjtcclxuXHJcbmxldCBucG1yY1ByZWZpeDpzdHJpbmcgPSBcIi8vcmVnaXN0cnkubnBtanMub3JnLzpfYXV0aFRva2VuPVwiO1xyXG5sZXQgbnBtVG9rZW46c3RyaW5nID0gcHJvY2Vzcy5lbnYuTlBNQ0lUT0tFTjtcclxubGV0IG5wbXJjRmlsZVN0cmluZyA9IG5wbXJjUHJlZml4ICsgbnBtVG9rZW47XHJcblxyXG5cclxuZXhwb3J0IGxldCBwdWJsaXNoID0gKCkgPT4ge1xyXG4gICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgIGlmKG5wbVRva2VuKXtcclxuICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5pbmZvKFwiZm91bmQgYWNjZXNzIHRva2VuXCIpO1xyXG4gICAgfSBlbHNlIHtcclxuICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcIm5vIGFjY2VzcyB0b2tlbiBmb3VuZCEgRXhpdGluZyFcIik7XHJcbiAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xyXG4gICAgfVxyXG4gICAgcGx1Z2lucy5zbWFydGZpbGUubWVtb3J5LnRvRnNTeW5jKG5wbXJjRmlsZVN0cmluZyx7ZmlsZU5hbWU6XCIubnBtcmNcIixmaWxlUGF0aDpcIi9yb290XCJ9KTtcclxuICAgIGJhc2goXCJucG0gcHVibGlzaFwiKTtcclxuICAgIHBsdWdpbnMuYmVhdXR5bG9nLm9rKFwiRG9uZSFcIilcclxuICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbn07Il19

View File

@@ -1,2 +0,0 @@
import "typings-global";
export declare let test: (versionArg: any) => any;

20
dist/npmci.test.js vendored
View File

@@ -1,20 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var npmci_bash_1 = require("./npmci.bash");
var npmci_install_1 = require("./npmci.install");
exports.test = function (versionArg) {
var done = plugins.q.defer();
npmci_install_1.install(versionArg)
.then(function () {
plugins.beautylog.info("now installing dependencies:");
npmci_bash_1.bash("npm install");
plugins.beautylog.info("now starting tests:");
npmci_bash_1.bash("npm test");
plugins.beautylog.success("test finished");
done.resolve();
});
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUNsQyw4QkFBc0IsaUJBQWlCLENBQUMsQ0FBQTtBQUU3QixZQUFJLEdBQUcsVUFBQyxVQUFVO0lBQ3pCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsdUJBQU8sQ0FBQyxVQUFVLENBQUM7U0FDZCxJQUFJLENBQUM7UUFDRixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyw4QkFBOEIsQ0FBQyxDQUFDO1FBQ3ZELGlCQUFJLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDcEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMscUJBQXFCLENBQUMsQ0FBQztRQUM5QyxpQkFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBQ2pCLE9BQU8sQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQzNDLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNuQixDQUFDLENBQUMsQ0FBQTtJQUNOLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQSIsImZpbGUiOiJucG1jaS50ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcclxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9ucG1jaS5wbHVnaW5zXCI7XHJcbmltcG9ydCB7YmFzaH0gZnJvbSBcIi4vbnBtY2kuYmFzaFwiO1xyXG5pbXBvcnQge2luc3RhbGx9IGZyb20gXCIuL25wbWNpLmluc3RhbGxcIjtcclxuXHJcbmV4cG9ydCBsZXQgdGVzdCA9ICh2ZXJzaW9uQXJnKSA9PiB7XHJcbiAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgaW5zdGFsbCh2ZXJzaW9uQXJnKVxyXG4gICAgICAgIC50aGVuKGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmluZm8oXCJub3cgaW5zdGFsbGluZyBkZXBlbmRlbmNpZXM6XCIpO1xyXG4gICAgICAgICAgICBiYXNoKFwibnBtIGluc3RhbGxcIik7XHJcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmluZm8oXCJub3cgc3RhcnRpbmcgdGVzdHM6XCIpO1xyXG4gICAgICAgICAgICBiYXNoKFwibnBtIHRlc3RcIik7XHJcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLnN1Y2Nlc3MoXCJ0ZXN0IGZpbmlzaGVkXCIpO1xyXG4gICAgICAgICAgICBkb25lLnJlc29sdmUoKTtcclxuICAgICAgICB9KVxyXG4gICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxufSJdfQ==

99
docs/index.md Normal file
View File

@@ -0,0 +1,99 @@
# npmci
node and docker in gitlab ci on steroids
## Availabililty
[![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmci)
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmci/)
## Status for master
[![build status](https://GitLab.com/gitzone/npmci/badges/master/build.svg)](https://GitLab.com/gitzone/npmci/commits/master)
[![coverage report](https://GitLab.com/gitzone/npmci/badges/master/coverage.svg)](https://GitLab.com/gitzone/npmci/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/npmci.svg)](https://www.npmjs.com/package/npmci)
[![Dependency Status](https://david-dm.org/gitzonetools/npmci.svg)](https://david-dm.org/gitzonetools/npmci)
[![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/npmci/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/npmci/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/gitzonetools/npmci/badges/code.svg)](https://www.bithound.io/github/gitzonetools/npmci)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
Use TypeScript for best in class instellisense.
npmci is designed to work in docker CI environments. The following docker images come with npmci presinstalled:
Docker Hub:
* [hosttoday/ht-docker-node:npmci](https://hub.docker.com/r/hosttoday/ht-docker-node/)
has LTS node version and npmci preinstalled.
* [hosttoday/ht-docker-dbase](https://hub.docker.com/r/hosttoday/ht-docker-dbase/)
based on docker:git, can be used to build docker images in conjunction with docker:dind
npmci can be called from commandline:
```shell
# Install any node version:
npmci install lts # will install latest LTS node version and update PATH for node and npm versions
npmci install stable # will install latest stable node version and update PATH for node and npm
npmci install legacy # will install latest legacy node version and update PATH for node and npm
npmci install x.x.x # will install any specific node version.
# Install any node version, install dependencies and run test in cwd:
npmci test lts # will install latest lts node version and run "npm install" and "npm test".
npmci test stable # will install latest stable node version and run "npm install" and "npm test".
npmci test legacy # will install latest legacy node version and run "npm install" and "npm test".
npmci test x.x.x # will install any specific node version and run "npm install" and "npm test".
npmci test docker # will test any build image with tests defined in ./npmci/dockertest_1.sh to ./npmci/dockertest_100.sh
## npmci test docker will look at all Dockerfiles and look for according tags on GitLab container registry
# prepare tools
npmci prepare npm # will look for $NPMCI_TOKEN_NPM env var and create .npmrc, so npm is authenticated
npmci prepare docker # will look for $NPMCI_LOGIN_DOCKER in form username|password and authenticate docker
npmci prepare docker-gitlab # will authenticate docker for gitlab container registry
# build containers
npmci build docker # will build containers
## all Dockerfiles named Dockerfile* are picked up.
## specify tags like this Dockerfile_[tag]
## uploads all built images as [username]/[reponame]:[tag]_test to GitLab
## then test in next step with "npmci test docker"
# publish npm module
npmci publish npm # will look vor $NPMCI_TOKEN_NPM env var and push any module in cwd to npm
npmci publish docker
# trigger webhooks
npmci trigger # will look for NPMCI_TRIGGER_1 to NPMCI_TRIGGER_100 in form domain|id|token|ref|name
```
## Configuration
npmci supports the use of npmextra.
To configure npmci create a `npmextra.json` file at the root of your project
```json
{
"npmci": {
"globalNpmTools": [
"npm-check-updates",
"protractor",
"npmts",
"gitzone"
]
}
}
```
**Available options**
setting | example | description
--- | --- | ---
globalNpmTools | "globalNpmTools": ["gitbook"] | Will look for the specified package names locally and (if not yet present) install them from npm.
For further information read the linked docs at the top of this README.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

19
docs/ssh.md Normal file
View File

@@ -0,0 +1,19 @@
# SSH
npmci allows easy usage of ssh:
## Add the SSH KEY to the environment
To make npmci aware of any SSH KEY add it to the environment in the following format
```
# Key
NPMCI_SSHKEY_[A_NAME_FROM_YOU]
# Value:
[targeted host]|[privatekey as base64]|***
```
## Use npmci cli tool in your ci script
```
npmci prepare ssh
npmci command git remote add heroku ssh://git@heroku.com/[you project name].git
npmci command git push heroku master
```

16
npmextra.json Normal file
View File

@@ -0,0 +1,16 @@
{
"npmts":{
"mode":"default",
"coverageTreshold": "70",
"cli": true
},
"npmci": {
"globalNpmTools": [
"npmts"
]
},
"npmdocker":{
"baseImage":"hosttoday/ht-docker-node:npmci",
"command": "npmci test stable"
}
}

View File

@@ -1,33 +1,56 @@
{
"name": "npmci",
"version": "1.0.21",
"description": "",
"version": "3.0.5",
"description": "node and docker in gitlab ci on steroids",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"bin": {
"npmci": "dist/index.js"
"npmci": "dist/cli.js"
},
"scripts": {
"test": "(npmts)"
"test": "(rm -f config.json) && (npmts) && (npm run testVersion)",
"testVersion": "(cd test/assets/ && node ../../dist/cli.js -v)"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/pushrocks/npmci.git"
"url": "git+ssh://git@gitlab.com/gitzone/npmci.git"
},
"author": "Lossless GmbH",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/pushrocks/npmci/issues"
"url": "https://gitlab.com/gitzone/npmci/issues"
},
"homepage": "https://gitlab.com/pushrocks/npmci#README",
"homepage": "https://gitlab.com/gitzone/npmci#README",
"devDependencies": {
"npmts": "^5.1.18"
"tapbundle": "^1.1.1"
},
"dependencies": {
"beautylog": "^5.0.6",
"commander": "^2.9.0",
"q": "^1.4.1",
"shelljs": "^0.7.0",
"smartfile": "^3.0.10",
"typings-global": "^1.0.3"
"@types/lodash": "^4.14.74",
"@types/node": "^8.0.25",
"@types/shelljs": "^0.7.4",
"@types/through2": "^2.0.33",
"beautylog": "^6.1.10",
"cflare": "^1.0.5",
"gulp": "^3.9.1",
"gulp-function": "^2.2.9",
"lik": "^1.0.40",
"lodash": "^4.17.4",
"npmextra": "^2.0.9",
"projectinfo": "^3.0.2",
"request": "^2.81.0",
"shelljs": "^0.7.8",
"smartcli": "^2.0.7",
"smartdelay": "^1.0.3",
"smartfile": "^4.2.20",
"smartmonitor": "^1.0.3",
"smartparam": "^1.0.2",
"smartq": "^1.1.6",
"smartshell": "^1.0.13",
"smartsocket": "^1.1.10",
"smartssh": "^1.2.2",
"smartstring": "^2.0.24",
"smartsystem": "^2.0.2",
"through2": "^2.0.3",
"typings-global": "^1.0.20"
}
}

29
readme.md Normal file
View File

@@ -0,0 +1,29 @@
# npmci
node and docker in gitlab ci on steroids
## Availabililty
[![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmci)
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmci/)
## Status for master
[![build status](https://GitLab.com/gitzone/npmci/badges/master/build.svg)](https://GitLab.com/gitzone/npmci/commits/master)
[![coverage report](https://GitLab.com/gitzone/npmci/badges/master/coverage.svg)](https://GitLab.com/gitzone/npmci/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/npmci.svg)](https://www.npmjs.com/package/npmci)
[![Dependency Status](https://david-dm.org/gitzonetools/npmci.svg)](https://david-dm.org/gitzonetools/npmci)
[![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/npmci/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/npmci/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/gitzonetools/npmci/badges/code.svg)](https://www.bithound.io/github/gitzonetools/npmci)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

2
test/assets/Dockerfile Normal file
View File

@@ -0,0 +1,2 @@
FROM ubuntu
RUN apt-get update

View File

@@ -0,0 +1,2 @@
FROM mygroup/myrepo:sometag2
RUN apt-get update

View File

@@ -0,0 +1 @@
FROM mygroup/myrepo:latest

View File

@@ -0,0 +1,2 @@
npm -v
node -v

141
test/test.ts Normal file
View File

@@ -0,0 +1,141 @@
import { tap, expect } from 'tapbundle'
import * as path from 'path'
// Setup test
process.env.NPMTS_TEST = 'true'
// set up environment
process.env.CI_REPOSITORY_URL = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git'
process.env.CI_BUILD_TOKEN = 'kjlkjfiudofiufs'
// Docker
process.env.NPMCI_LOGIN_DOCKER = 'docker.io|someuser|somepass'
// SSH env
process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##'
process.cwd = () => {
return path.join(__dirname, 'assets/')
}
// require NPMCI files
import '../ts/index'
import npmciModDocker = require('../ts/mod_docker/index')
import npmciModNpm = require('../ts/mod_npm/index')
import npmciModNode = require('../ts/mod_node/index')
import npmciModSsh = require('../ts/mod_ssh/index')
import npmciEnv = require('../ts/npmci.env')
// ======
// Docker
// ======
let dockerfile1: npmciModDocker.Dockerfile
let dockerfile2: npmciModDocker.Dockerfile
let sortableArray: npmciModDocker.Dockerfile[]
tap.test('should return valid Dockerfiles', async () => {
dockerfile1 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile', read: true })
dockerfile2 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true })
expect(dockerfile1.version).to.equal('latest')
return expect(dockerfile2.version).to.equal('sometag1')
})
tap.test('should read a directory of Dockerfiles', async () => {
return npmciModDocker.helpers.readDockerfiles()
.then(async (readDockerfilesArrayArg: npmciModDocker.Dockerfile[]) => {
sortableArray = readDockerfilesArrayArg
return expect(readDockerfilesArrayArg[1].version).to.equal('sometag1')
})
})
tap.test('should sort an array of Dockerfiles', async () => {
return npmciModDocker.helpers.sortDockerfiles(sortableArray)
.then(async (sortedArrayArg: npmciModDocker.Dockerfile[]) => {
console.log(sortedArrayArg)
})
})
tap.test('should build all Dockerfiles', async () => {
return npmciModDocker.handleCli({
_: [
'docker',
'build'
]
})
})
tap.test('should test all Dockerfiles', async () => {
return await npmciModDocker.handleCli({
_: [
'docker',
'test'
]
})
})
tap.test('should test dockerfiles', async () => {
return await npmciModDocker.handleCli({
_: [
'docker',
'test'
]
})
})
tap.test('should login docker daemon', async () => {
return await npmciModDocker.handleCli({
_: [
'docker',
'login'
]
})
})
// ===
// SSH
// ===
tap.test('should prepare SSH keys', async () => {
return await npmciModSsh.handleCli({
_: [
'ssh',
'prepare'
]
})
})
// ====
// node
// ====
tap.test('should install a certain version of node', async () => {
await npmciModNode.handleCli({
_: [
'node',
'install',
'stable'
]
})
await npmciModNode.handleCli({
_: [
'node',
'install',
'lts'
]
})
await npmciModNode.handleCli({
_: [
'node',
'install',
'legacy'
]
})
})
// make sure test ends all right
tap.test('reset paths', async () => {
process.cwd = () => {
return path.join(__dirname, '../')
}
})
tap.start()

View File

@@ -1,44 +1,2 @@
#!/usr/bin/env node
import "typings-global";
import * as plugins from "./npmci.plugins";
let packJson = require("../package.json");
plugins.beautylog.log("npmci in version" + packJson.version);
import {install} from "./npmci.install";
import {test} from "./npmci.test";
import {publish} from "./npmci.publish";
let command;
let commandOption;
plugins.commander
.arguments('<commandarg> [commandoptionarg]')
.action(function (commandarg, commandoptionarg) {
command = commandarg;
commandOption = commandoptionarg;
});
plugins.commander.parse(process.argv);
if (typeof command === 'undefined') {
console.error('no command given!');
process.exit(1);
}
switch (command){
case "install":
install(commandOption);
break;
case "test":
test(commandOption);
break;
case "publish":
publish();
break;
default:
break;
}
import './npmci.cli'

10
ts/mod_clean/index.ts Normal file
View File

@@ -0,0 +1,10 @@
import * as plugins from './mod.plugins'
import * as paths from '../npmci.paths'
/**
* cleans npmci config files
*/
export let clean = async (): Promise<void> => {
plugins.smartfile.fs.removeSync(paths.NpmciPackageConfig)
return
}

View File

@@ -0,0 +1 @@
export * from '../npmci.plugins'

View File

@@ -0,0 +1,27 @@
import * as plugins from './mod.plugins'
let npmciCflare = new plugins.cflare.CflareAccount()
/**
* handle cli input
* @param argvArg
*/
export let handleCli = async (argvArg) => {
if (argvArg._.length >= 2) {
let action: string = argvArg._[1]
switch (action) {
default:
plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`)
}
} else {
plugins.beautylog.log(`>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.`)
}
}
export let purge = async (argvArg) => {
npmciCflare.auth({
email: '',
key: ''
})
npmciCflare.purgeZone(argvArg._[1])
}

View File

@@ -0,0 +1,7 @@
export * from '../npmci.plugins'
import * as cflare from 'cflare'
export {
cflare
}

13
ts/mod_command/index.ts Normal file
View File

@@ -0,0 +1,13 @@
import * as plugins from './mod.plugins'
import { bash } from '../npmci.bash'
export let command = async () => {
let wrappedCommand: string = ''
let argvArray = process.argv
for (let i = 3; i < argvArray.length; i++) {
wrappedCommand = wrappedCommand + argvArray[i]
if (i + 1 !== argvArray.length) { wrappedCommand = wrappedCommand + ' ' }
}
await bash(wrappedCommand)
return
}

View File

@@ -0,0 +1 @@
export * from '../npmci.plugins'

138
ts/mod_docker/index.ts Normal file
View File

@@ -0,0 +1,138 @@
import * as plugins from './mod.plugins'
import * as paths from '../npmci.paths'
import { bash } from '../npmci.bash'
import * as helpers from './mod.helpers'
// classes
import { Dockerfile } from './mod.classes.dockerfile'
import { DockerRegistry } from './mod.classes.dockerregistry'
import { RegistryStorage } from './mod.classes.registrystorage'
// instances
let npmciRegistryStorage = new RegistryStorage()
export {
Dockerfile,
helpers
}
export let modArgvArg // will be set through the build command
/**
* handle cli input
* @param argvArg
*/
export let handleCli = async (argvArg) => {
modArgvArg = argvArg
if (argvArg._.length >= 2) {
let action: string = argvArg._[ 1 ]
switch (action) {
case 'build':
await build()
break
case 'login':
await login()
break
case 'test':
await test()
break
case 'push':
await push(argvArg)
break
case 'pull':
await pull(argvArg)
break
default:
plugins.beautylog.error(`>>npmci docker ...<< action >>${action}<< not supported`)
}
} else {
plugins.beautylog.log(`>>npmci docker ...<< cli arguments invalid... Please read the documentation.`)
}
}
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export let build = async () => {
await prepare()
plugins.beautylog.log('now building Dockerfiles...')
await helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles)
.then(helpers.buildDockerfiles)
}
/**
* login to the DockerRegistries
*/
export let login = async () => {
await prepare()
await npmciRegistryStorage.loginAll()
}
/**
* logs in docker
*/
export let prepare = async () => {
// Always login to GitLab Registry
if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
plugins.beautylog.error('No registry token specified by gitlab!')
process.exit(1)
}
npmciRegistryStorage.addRegistry(new DockerRegistry({
registryUrl: 'registry.gitlab.com',
username: 'gitlab-ci-token',
password: process.env.CI_BUILD_TOKEN
}))
// handle registries
await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => {
npmciRegistryStorage.addRegistry(
DockerRegistry.fromEnvString(envString)
)
})
return
}
export let push = async (argvArg) => {
await prepare()
let registryUrlArg = argvArg._[ 2 ]
let suffix = null
if (argvArg._.length >= 4) {
suffix = argvArg._[ 3 ]
}
let dockerfileArray = await helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles)
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg)
if (!localDockerRegistry) {
plugins.beautylog.error(`Cannot push to registry ${registryUrlArg}, because it was not found in the authenticated registry list.`)
process.exit(1)
}
for (let dockerfile of dockerfileArray) {
await dockerfile.push(localDockerRegistry, suffix)
}
}
export let pull = async (argvArg) => {
await prepare()
let registryUrlArg = argvArg._[ 2 ]
let suffix = null
if (argvArg._.length >= 4) {
suffix = argvArg._[ 3 ]
}
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg)
let dockerfileArray = await helpers.readDockerfiles()
.then(helpers.sortDockerfiles)
.then(helpers.mapDockerfiles)
for (let dockerfile of dockerfileArray) {
await dockerfile.pull(localDockerRegistry, suffix)
}
}
export let test = async () => {
await prepare()
return await helpers.readDockerfiles()
.then(helpers.testDockerfiles)
}

View File

@@ -0,0 +1,92 @@
import * as plugins from './mod.plugins'
import * as NpmciEnv from '../npmci.env'
import { bash } from '../npmci.bash'
import * as paths from '../npmci.paths'
import { DockerRegistry } from './mod.classes.dockerregistry'
import * as helpers from './mod.helpers'
/**
* class Dockerfile represents a Dockerfile on disk in npmci
*/
export class Dockerfile {
filePath: string
repo: string
version: string
cleanTag: string
buildTag: string
containerName: string
content: string
baseImage: string
localBaseImageDependent: boolean
localBaseDockerfile: Dockerfile
constructor (options: { filePath?: string, fileContents?: string | Buffer, read?: boolean }) {
this.filePath = options.filePath
this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo
this.version = helpers.dockerFileVersion(plugins.path.parse(options.filePath).base)
this.cleanTag = this.repo + ':' + this.version
this.buildTag = this.cleanTag
this.containerName = 'dockerfile-' + this.version
if (options.filePath && options.read) {
this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath))
}
this.baseImage = helpers.dockerBaseImage(this.content)
this.localBaseImageDependent = false
}
/**
* builds the Dockerfile
*/
async build () {
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag)
let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .`
await bash(buildCommand)
return
}
/**
* pushes the Dockerfile to a registry
*/
async push (dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
let pushTag = helpers.getDockerTagString(dockerRegistryArg.registryUrl, this.repo, this.version, versionSuffix)
await bash(`docker tag ${this.buildTag} ${pushTag}`)
await bash(`docker push ${pushTag}`)
}
/**
* pulls the Dockerfile from a registry
*/
async pull (registryArg: DockerRegistry, versionSuffixArg: string = null) {
let pullTag = helpers.getDockerTagString(registryArg.registryUrl,this.repo, this.version, versionSuffixArg)
await bash(`docker pull ${pullTag}`)
await bash(`docker tag ${pullTag} ${this.buildTag}`)
}
/**
* tests the Dockerfile;
*/
async test () {
let testFile: string = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh')
let testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile)
if (testFileExists) {
// run tests
await bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test')
await bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh')
await bash('docker commit npmci_test_container npmci_test_image')
await bash('docker run npmci_test_image sh /npmci_test/test.sh')
await bash('docker rm npmci_test_container')
await bash('docker rmi --force npmci_test_image')
} else {
plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!')
}
}
/**
* gets the id of a Dockerfile
*/
async getId () {
let containerId = await bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag)
return containerId
}
}

View File

@@ -0,0 +1,47 @@
import * as plugins from './mod.plugins'
import { bash } from '../npmci.bash'
export interface IDockerRegistryConstructorOptions {
registryUrl: string,
username: string,
password: string
}
export class DockerRegistry {
registryUrl: string
username: string
password: string
constructor (optionsArg: IDockerRegistryConstructorOptions) {
this.registryUrl = optionsArg.registryUrl
this.username = optionsArg.username
this.password = optionsArg.password
plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`)
}
static fromEnvString (envString: string): DockerRegistry {
let dockerRegexResultArray = envString.split('|')
if (dockerRegexResultArray.length !== 3) {
plugins.beautylog.error('malformed docker env var...')
process.exit(1)
return
}
let registryUrl = dockerRegexResultArray[0]
let username = dockerRegexResultArray[1]
let password = dockerRegexResultArray[2]
return new DockerRegistry({
registryUrl: registryUrl,
username: username,
password: password
})
}
async login () {
if (this.registryUrl === 'docker.io') {
await bash(`docker login -u ${this.username} -p ${this.password}`)
plugins.beautylog.info('Logged in to standard docker hub')
} else {
await bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`)
}
plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`)
}
}

View File

@@ -0,0 +1,28 @@
import * as plugins from './mod.plugins'
import { Objectmap } from 'lik'
import { DockerRegistry } from './mod.classes.dockerregistry'
export class RegistryStorage {
objectMap = new Objectmap<DockerRegistry>()
constructor () {
// Nothing here
}
addRegistry (registryArg: DockerRegistry) {
this.objectMap.add(registryArg)
}
getRegistryByUrl (registryUrlArg: string) {
return this.objectMap.find(registryArg => {
return registryArg.registryUrl === registryUrlArg
})
}
async loginAll () {
await this.objectMap.forEach(async registryArg => {
await registryArg.login()
})
plugins.beautylog.success('logged in successfully into all available DockerRegistries!')
}
}

View File

@@ -0,0 +1,154 @@
import * as plugins from './mod.plugins'
import * as paths from '../npmci.paths'
import * as NpmciEnv from '../npmci.env'
import { bash } from '../npmci.bash'
import { Dockerfile } from './mod.classes.dockerfile'
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export let readDockerfiles = async (): Promise<Dockerfile[]> => {
let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*')
// create the Dockerfile array
let readDockerfilesArray: Dockerfile[] = []
plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`)
console.log(fileTree)
for (let dockerfilePath of fileTree) {
let myDockerfile = new Dockerfile({
filePath: dockerfilePath,
read: true
})
readDockerfilesArray.push(myDockerfile)
}
return readDockerfilesArray
}
/**
* sorts Dockerfiles into a dependency chain
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfile[]> => {
let done = plugins.q.defer<Dockerfile[]>()
plugins.beautylog.info('sorting Dockerfiles:')
let sortedArray: Dockerfile[] = []
let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray)
let sorterFunctionCounter: number = 0
let sorterFunction = function () {
sortableArrayArg.forEach((dockerfileArg) => {
let cleanTags = cleanTagsArrayFunction(sortableArrayArg, sortedArray)
if (cleanTags.indexOf(dockerfileArg.baseImage) === -1 && sortedArray.indexOf(dockerfileArg) === -1) {
sortedArray.push(dockerfileArg)
}
if (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) {
dockerfileArg.localBaseImageDependent = true
}
})
if (sortableArrayArg.length === sortedArray.length) {
let counter = 1
for (let dockerfile of sortedArray) {
plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`)
counter++
}
done.resolve(sortedArray)
} else if (sorterFunctionCounter < 10) {
sorterFunctionCounter++
sorterFunction()
}
}
sorterFunction()
return done.promise
}
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export let mapDockerfiles = async (sortedArray: Dockerfile[]): Promise<Dockerfile[]> => {
sortedArray.forEach((dockerfileArg) => {
if (dockerfileArg.localBaseImageDependent) {
sortedArray.forEach((dockfile2: Dockerfile) => {
if (dockfile2.cleanTag === dockerfileArg.baseImage) {
dockerfileArg.localBaseDockerfile = dockfile2
}
})
}
})
return sortedArray
}
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
for (let dockerfileArg of sortedArrayArg) {
await dockerfileArg.build()
}
return sortedArrayArg
}
/**
* tests all Dockerfiles in by calling class Dockerfile.test();
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
*/
export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
for (let dockerfileArg of sortedArrayArg) {
await dockerfileArg.test()
}
return sortedArrayArg
}
/**
* returns a version for a docker file
* @execution SYNC
*/
export let dockerFileVersion = (dockerfileNameArg: string): string => {
let versionString: string
let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/
let regexResultArray = versionRegex.exec(dockerfileNameArg)
if (regexResultArray && regexResultArray.length === 2) {
versionString = regexResultArray[ 1 ]
} else {
versionString = 'latest'
}
return versionString
}
/**
* returns the docker base image for a Dockerfile
*/
export let dockerBaseImage = function (dockerfileContentArg: string) {
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/
let regexResultArray = baseImageRegex.exec(dockerfileContentArg)
return regexResultArray[ 1 ]
}
/**
* returns the docker tag
*/
export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string {
// determine wether the suffix is needed
let version = versionArg
if (suffixArg) {
version = versionArg + '_' + suffixArg
}
let tagString = `${registryArg}/${repoArg}:${version}`
return tagString
}
/**
*
*/
export let cleanTagsArrayFunction = function (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]): string[] {
let cleanTagsArray: string[] = []
dockerfileArrayArg.forEach(function (dockerfileArg) {
if (trackingArrayArg.indexOf(dockerfileArg) === -1) {
cleanTagsArray.push(dockerfileArg.cleanTag)
}
})
return cleanTagsArray
}

View File

@@ -0,0 +1,3 @@
export * from '../npmci.plugins'

75
ts/mod_node/index.ts Normal file
View File

@@ -0,0 +1,75 @@
import * as plugins from '../npmci.plugins'
import * as npmciConfig from '../npmci.config'
import {
bash,
bashNoError,
nvmAvailable,
yarnAvailable
} from '../npmci.bash'
/**
* handle cli input
* @param argvArg
*/
export let handleCli = async (argvArg) => {
if (argvArg._.length >= 3) {
let action: string = argvArg._[1]
switch (action) {
case 'install':
await install(argvArg._[2])
break
default:
plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`)
}
} else {
plugins.beautylog.error(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`)
}
}
/**
* Install a specific version of node
* @param versionArg
*/
export let install = async (versionArg) => {
plugins.beautylog.log(`now installing node version ${versionArg}`)
let version: string
if (versionArg === 'stable') {
version = 'stable'
} else if (versionArg === 'lts') {
version = '6'
} else if (versionArg === 'legacy') {
version = '6'
} else {
version = versionArg
}
if (await nvmAvailable.promise) {
await bash(`nvm install ${version} && nvm alias default ${version}`)
plugins.beautylog.success(`Node version ${version} successfully installed!`)
} else {
plugins.beautylog.warn('Nvm not in path so staying at installed node version!')
}
await bash('node -v')
await bash('npm -v')
// lets look for further config
await npmciConfig.getConfig()
.then(async configArg => {
plugins.beautylog.log('Now checking for needed global npm tools...')
for (let npmTool of configArg.globalNpmTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`)
let whichOutput: string = await bashNoError(`which ${npmTool}`)
let toolAvailable: boolean = !((/not\sfound/.test(whichOutput)) || whichOutput === '')
if (toolAvailable) {
plugins.beautylog.log(`Tool ${npmTool} is available`)
} else {
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
if (await yarnAvailable.promise) {
await bash(`yarn global add ${npmTool}`)
} else {
await bash(`npm install ${npmTool} -q -g`)
}
}
}
plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!')
})
}

64
ts/mod_npm/index.ts Normal file
View File

@@ -0,0 +1,64 @@
import * as plugins from './mod.plugins'
import * as configModule from '../npmci.config'
import {
bash,
bashNoError,
nvmAvailable,
yarnAvailable
} from '../npmci.bash'
/**
* handle cli input
* @param argvArg
*/
export let handleCli = async (argvArg) => {
if (argvArg._.length >= 2) {
let action: string = argvArg._[1]
switch (action) {
case 'install':
await install()
break
case 'prepare':
await prepare()
break
case 'test':
await test()
break
default:
plugins.beautylog.error(`>>npmci npm ...<< action >>${action}<< not supported`)
}
} else {
plugins.beautylog.log(`>>npmci npm ...<< cli arguments invalid... Please read the documentation.`)
}
}
/**
* authenticates npm with token from env var
*/
let prepare = async () => {
let npmrcPrefix: string = '//registry.npmjs.org/:_authToken='
let npmToken: string = process.env.NPMCI_TOKEN_NPM
let npmrcFileString: string = npmrcPrefix + npmToken
if (npmToken) {
plugins.beautylog.info('found access token')
} else {
plugins.beautylog.error('no access token found! Exiting!')
process.exit(1)
}
plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc')
return
}
let install = async (): Promise<void> => {
plugins.beautylog.info('now installing dependencies:')
if (await yarnAvailable.promise) {
await bash('yarn install')
} else {
await bash('npm install')
}
}
export let test = async (): Promise<void> => {
plugins.beautylog.info('now starting tests:')
await bash('yarn test')
}

View File

@@ -0,0 +1 @@
export * from '../npmci.plugins'

59
ts/mod_ssh/index.ts Normal file
View File

@@ -0,0 +1,59 @@
import * as plugins from './mod.plugins'
let sshInstance: plugins.smartssh.SshInstance
export let handleCli = async (argvArg) => {
if (argvArg._.length >= 2) {
let action: string = argvArg._[1]
switch (action) {
case 'prepare':
await prepare()
break
default:
plugins.beautylog.error(`action >>${action}<< not supported`)
}
}
}
/**
* checks if not undefined
*/
let notUndefined = (stringArg: string) => {
return (stringArg && stringArg !== 'undefined' && stringArg !== '##')
}
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/
export let prepare = async () => {
sshInstance = new plugins.smartssh.SshInstance() // init ssh instance
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv)
if (!process.env.NPMTS_TEST) {
sshInstance.writeToDisk()
} else {
plugins.beautylog.log('In test mode, so not storing SSH keys to disk!')
}
}
/**
* gets called for each found SSH ENV Var and deploys it
*/
let evaluateSshEnv = async (sshkeyEnvVarArg: string) => {
let sshEnvArray = sshkeyEnvVarArg.split('|')
let sshKey = new plugins.smartssh.SshKey()
plugins.beautylog.info('Found SSH identity for ' + sshEnvArray[1])
if (notUndefined(sshEnvArray[0])) {
plugins.beautylog.log('---> host defined!')
sshKey.host = sshEnvArray[0]
}
if (notUndefined(sshEnvArray[1])) {
plugins.beautylog.log('---> privKey defined!')
sshKey.privKeyBase64 = sshEnvArray[1]
}
if (notUndefined(sshEnvArray[2])) {
plugins.beautylog.log('---> pubKey defined!')
sshKey.pubKeyBase64 = sshEnvArray[2]
}
sshInstance.addKey(sshKey)
return
}

View File

@@ -0,0 +1 @@
export * from '../npmci.plugins'

29
ts/mod_trigger/index.ts Normal file
View File

@@ -0,0 +1,29 @@
import * as plugins from './mod.plugins'
import { bash } from '../npmci.bash'
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/
export let trigger = async () => {
plugins.beautylog.info('now running triggers')
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger)
}
let evaluateTrigger = async (triggerEnvVarArg) => {
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg)
let regexDomain = triggerRegexResultArray[1]
let regexProjectId = triggerRegexResultArray[2]
let regexProjectTriggerToken = triggerRegexResultArray[3]
let regexRefName = triggerRegexResultArray[4]
let regexTriggerName
if (triggerRegexResultArray.length === 6) {
regexTriggerName = triggerRegexResultArray[5]
} else {
regexTriggerName = 'Unnamed Trigger'
}
plugins.beautylog.info('Found Trigger!')
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName)
plugins.request.post(
'https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds',
{ form: { token: regexProjectTriggerToken, ref: regexRefName }
})
}

View File

@@ -0,0 +1 @@
export * from '../npmci.plugins'

View File

@@ -1,12 +1,105 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
export let bash = (commandArg) => {
let exitCode = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
).code;
if(exitCode !== 0){
process.exit(1);
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
import * as smartq from 'smartq'
/**
* wether nvm is available or not
*/
export let nvmAvailable = smartq.defer<boolean>()
export let yarnAvailable = smartq.defer<boolean>()
/**
* the smartshell instance for npmci
*/
let npmciSmartshell = new plugins.smartshell.Smartshell({
executor: 'bash',
sourceFilePaths: []
})
/**
* check for tools.
*/
let checkToolsAvailable = async () => {
// check for nvm
if (!process.env.NPMTS_TEST) {
if (
(await plugins.smartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0
) {
npmciSmartshell.addSourceFiles([ `/usr/local/nvm/nvm.sh` ])
nvmAvailable.resolve(true)
} else if (
(await plugins.smartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0
) {
npmciSmartshell.addSourceFiles([ `~/.nvm/nvm.sh` ])
nvmAvailable.resolve(true)
} else {
nvmAvailable.resolve(false)
}
// check for yarn
await plugins.smartshell.which('yarn').then(
async () => {
await plugins.smartshell.exec(`yarn config set cache-folder ${plugins.path.join(paths.cwd, '.yarn')}`)
yarnAvailable.resolve(true)
},
() => { yarnAvailable.resolve(false) }
)
} else {
nvmAvailable.resolve(true)
yarnAvailable.resolve(true)
}
}
checkToolsAvailable()
/**
* bash() allows using bash with nvm in path
* @param commandArg - The command to execute
* @param retryArg - The retryArg: 0 to any positive number will retry, -1 will always succeed, -2 will return undefined
*/
export let bash = async (commandArg: string, retryArg: number = 2): Promise<string> => {
await nvmAvailable.promise // make sure nvm check has run
let execResult: plugins.smartshell.IExecResult
// determine if we fail
let failOnError: boolean = true
if (retryArg === -1) {
failOnError = false
retryArg = 0
}
if (!process.env.NPMTS_TEST) { // NPMTS_TEST is used during testing
for (let i = 0; i <= retryArg; i++) {
if (process.env.DEBUG_NPMCI === 'true') {
console.log(commandArg)
}
execResult = await npmciSmartshell.exec(commandArg)
// determine how bash reacts to error and success
if (execResult.exitCode !== 0 && i === retryArg) { // something went wrong and retries are exhausted
if (failOnError) {
plugins.beautylog.error('something went wrong and retries are exhausted')
process.exit(1)
}
} else if (execResult.exitCode === 0) { // everything went fine, or no error wanted
i = retryArg + 1 // retry +1 breaks for loop, if everything works out ok retrials are not wanted
} else {
plugins.beautylog.warn('Something went wrong! Exit Code: ' + execResult.exitCode.toString())
plugins.beautylog.info('Retry ' + (i + 1).toString() + ' of ' + retryArg.toString())
}
}
} else {
plugins.beautylog.log('ShellExec would be: ' + commandArg)
execResult = {
exitCode: 0,
stdout: 'testOutput'
}
}
return execResult.stdout
}
/**
* bashNoError allows executing stuff without throwing an error
*/
export let bashNoError = async (commandArg: string): Promise<string> => {
return await bash(commandArg, -1)
}

Some files were not shown because too many files have changed in this diff Show More