renovate 42.68.3 → 42.68.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/manager/fingerprint.generated.js +1 -1
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/github-actions/extract.js +120 -89
- package/dist/modules/manager/github-actions/extract.js.map +1 -1
- package/dist/modules/manager/github-actions/parse.d.ts +70 -0
- package/dist/modules/manager/github-actions/parse.js +167 -0
- package/dist/modules/manager/github-actions/parse.js.map +1 -0
- package/dist/util/exec/common.d.ts +1 -1
- package/dist/util/exec/common.js +18 -5
- package/dist/util/exec/common.js.map +1 -1
- package/dist/util/exec/types.d.ts +1 -0
- package/dist/util/exec/types.js.map +1 -1
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js +3 -0
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -42,7 +42,7 @@ exports.hashMap.set('fleet', '642e8e7ab739fba65bce7222b6f3e80fe44806c4190c8e93c5
|
|
|
42
42
|
exports.hashMap.set('flux', '3b87b351f98c11ca0e6cb275deb708dc9bf601a7e578f7a3a7e83fe6e15eb540');
|
|
43
43
|
exports.hashMap.set('fvm', 'aa154dd5ffe3caced30713a9a55967360b7a0f35edd2fc06bd6f3e73c5c87570');
|
|
44
44
|
exports.hashMap.set('git-submodules', 'b5d78ab86025516b8cc52ede93b390c45a1a46e7ca338e1d2b7f1d57481ebf43');
|
|
45
|
-
exports.hashMap.set('github-actions', '
|
|
45
|
+
exports.hashMap.set('github-actions', 'c27d8bb80e1e7f864a1c2e2964e40f171d72d0c4f83673de8d8cfe750b7c5c82');
|
|
46
46
|
exports.hashMap.set('gitlabci', '1f2e3e3a3013488e68d2aa0e39d80ee3bfbc9a01d817874f4c8195f8aff1fac9');
|
|
47
47
|
exports.hashMap.set('gitlabci-include', '5bc01de9b40ecc8888a37690152f4a2f9cacc509b9cb5902aac024ca7a7c8e65');
|
|
48
48
|
exports.hashMap.set('glasskube', 'fd415356a866ad174a5b70522d662e4289a2c5d5e34c55d57542b0d8968f1645');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.generated.js","sourceRoot":"","sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD,eAAO,CAAC,GAAG,CAAC,SAAS,EAAC,kEAAkE,CAAC,CAAC;AAC1F,eAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,kEAAkE,CAAC,CAAC;AACjG,eAAO,CAAC,GAAG,CAAC,QAAQ,EAAC,kEAAkE,CAAC,CAAC;AACzF,eAAO,CAAC,GAAG,CAAC,MAAM,EAAC,kEAAkE,CAAC,CAAC;AACvF,eAAO,CAAC,GAAG,CAAC,iBAAiB,EAAC,kEAAkE,CAAC,CAAC;AAClG,eAAO,CAAC,GAAG,CAAC,QAAQ,EAAC,kEAAkE,CAAC,CAAC;AACzF,eAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,kEAAkE,CAAC,CAAC;AACjG,eAAO,CAAC,GAAG,CAAC,OAAO,EAAC,kEAAkE,CAAC,CAAC;AACxF,eAAO,CAAC,GAAG,CAAC,cAAc,EAAC,kEAAkE,CAAC,CAAC;AAC/F,eAAO,CAAC,GAAG,CAAC,UAAU,EAAC,kEAAkE,CAAC,CAAC;AAC3F,eAAO,CAAC,GAAG,CAAC,OAAO,EAAC,kEAAkE,CAAC,CAAC;AACxF,eAAO,CAAC,GAAG,CAAC,qBAAqB,EAAC,kEAAkE,CAAC,CAAC;AACtG,eAAO,CAAC,GAAG,CAAC,SAAS,EAAC,kEAAkE,CAAC,CAAC;AAC1F,eAAO,CAAC,GAAG,CAAC,WAAW,EAAC,kEAAkE,CAAC,CAAC;AAC5F,eAAO,CAAC,GAAG,CAAC,YAAY,EAAC,kEAAkE,CAAC,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768392545924fa9b139f8d177f15b6aa46776cf063860a1d36e48c7');\nhashMap.set('ansible-galaxy','a211e40f5c8613986ac16bc8d5389ea23d145cd643091d1b951a7f65926e99ff');\nhashMap.set('argocd','8619ed756b6f7249ea836e14e8f8660ee5f971992e3862d43f19d42f10762560');\nhashMap.set('asdf','e7f29eb8157e6ca5928890a0cc2fc88d57ddcf7b426dad1c4f15386858d3cd6a');\nhashMap.set('azure-pipelines','0b741b2629f6d94589524ce9b3886765e5c5648c9b6d707bb0b5fede276f9c09');\nhashMap.set('batect','523e8d7a309b4814a02819371313b2dac3764eab64cabfaf1d58b6e89de4ce43');\nhashMap.set('batect-wrapper','90941650f810adb3d7abe476da7221ff3434aa9d09ffc3d310e35108f360f364');\nhashMap.set('bazel','19e8ee20f9882e3023b2126d4b8335693cae9fb2b908f59803bbdfd432055d28');\nhashMap.set('bazel-module','4e3d00184b146e5c0ad69433697076f722afe933701ab08676af13e47d289eac');\nhashMap.set('bazelisk','6fbef61d534724ff259ea6e4fc1cd0a3d5a46d740c375128fa59b225daddd39f');\nhashMap.set('bicep','fbbd74998411012cfba829526701109d1fc184ade0cb11a28e4ca2956174b0f1');\nhashMap.set('bitbucket-pipelines','98c0d715a7eb4e41b8231091b83385f325966373f37dc7d6bc10b1febb6f605e');\nhashMap.set('bitrise','d18d2dcd356e19c4cd94912511a88636198c23b64e54f31da273be11044970cf');\nhashMap.set('buildkite','ac713ce38da057ff3ceb08d092291356dfc74f5b33b75f010bb9db1a211439c0');\nhashMap.set('buildpacks','cc8bbe937416a012df36a5c7ab01ae3cdedbed03615549bbe9f0f27fa40a150b');\nhashMap.set('bun','512695cbae4bf6bd17bad3c176b6e715d2cf0d7cbe5bef49da7f44f350161f6b');\nhashMap.set('bun-version','49194d7fcb6b7bdd7e7a1264f71532bb2be8142d48478bf74716f7a9d4b306b9');\nhashMap.set('bundler','7df6f082c34b90b660b70197906fdc3ad299e6650999bb3f8a0fddb7edeb398e');\nhashMap.set('cake','a04160b352550cb470acb62f9a532361842c12f2ffbcd473bffca3de024522d9');\nhashMap.set('cargo','5612a7b7bb5ccd007fed48ff7f345092ffe987d9f1086505d8ac03a436420251');\nhashMap.set('cdnurl','70281459e771df007787fc25dba16e4d5109865f97209dcf4f572ddd287d538a');\nhashMap.set('circleci','c7c7a1b71385f0ea7cf1e9fc24c37a1d5dabf13d6952e1e3b2179861b55f4e44');\nhashMap.set('cloudbuild','e4f926bfb907220e97dce98335837c52b4e0fe66d813593a7e572736acfc53f7');\nhashMap.set('cocoapods','1ff72f39f8c04e4a0253eb598906adebcaa5bc37b68f40e23317482f29936948');\nhashMap.set('composer','35f91e3dcc754668a42b18f5c2c9bd5a337d83eef1b80845fed8fd453074d020');\nhashMap.set('conan','4df92ebfa53ec6b7103030316ff70822d18f73cca8c71f2dca1d71c0d00b9353');\nhashMap.set('copier','34a3f985c82673bb7a2828ef644e271e5031da873e8cd44bf992a1826b3e40db');\nhashMap.set('cpanfile','9b354db9666eee2485b27e44a6e61eaadc86ec2f2c6af9bb7bbc9fab54f31642');\nhashMap.set('crossplane','76261ff27b38f9850ee1a3a7e95168abefd96b4736f2cf04a7343e16827b42d8');\nhashMap.set('crow','ffce0c24358c3097e3935bffc38ef3eff143dbbc589c1b75a6d3635a62fdeea4');\nhashMap.set('deps-edn','306376e0f00f47ea416dba972e6347f44c78228e298e4ed766635018e26f698a');\nhashMap.set('devbox','c00b62bd0fab0bb85874cbe2019dfa428f79dfc697d70a7445b80d641a3b7c0e');\nhashMap.set('devcontainer','e9982b5ff8aeac8fefb40dc363d3ab35f58af8c08b91eb45d22937a8c60447bb');\nhashMap.set('docker-compose','0c867e3aa14ae7dfc673eef348b2086ae2e36cbebfd1827e031a8030f9295276');\nhashMap.set('dockerfile','afbfa832a5d63c972c02445de3cd14fc9cf2e6bab797b0b7c930b16f5f267462');\nhashMap.set('droneci','f2a98fcece07b462baaceb28cd6904e080cb1ab0727fcd7403bea5ffd2e05239');\nhashMap.set('fleet','642e8e7ab739fba65bce7222b6f3e80fe44806c4190c8e93c5bcab23d44e9fd4');\nhashMap.set('flux','3b87b351f98c11ca0e6cb275deb708dc9bf601a7e578f7a3a7e83fe6e15eb540');\nhashMap.set('fvm','aa154dd5ffe3caced30713a9a55967360b7a0f35edd2fc06bd6f3e73c5c87570');\nhashMap.set('git-submodules','b5d78ab86025516b8cc52ede93b390c45a1a46e7ca338e1d2b7f1d57481ebf43');\nhashMap.set('github-actions','bbc568ece7c04ce5c7c94476ccb15689d8e6a1d555099d88a6a072ed4eb7150a');\nhashMap.set('gitlabci','1f2e3e3a3013488e68d2aa0e39d80ee3bfbc9a01d817874f4c8195f8aff1fac9');\nhashMap.set('gitlabci-include','5bc01de9b40ecc8888a37690152f4a2f9cacc509b9cb5902aac024ca7a7c8e65');\nhashMap.set('glasskube','fd415356a866ad174a5b70522d662e4289a2c5d5e34c55d57542b0d8968f1645');\nhashMap.set('gleam','a4621cc86a42890a41c31e957726e02514257f4e91896d92f238ac07ab81cebb');\nhashMap.set('gomod','7c9240c54e09aa30b83d5b02e08e0b93054f9685ce02103a342f7b8aacd5406b');\nhashMap.set('gradle','729af0df3f220bdf461a0e272685dbf1f14275409f8ebb4b12a5c3d6ab2d12d3');\nhashMap.set('gradle-wrapper','d691572ff7a998162d20527dcc70b3fbf569442da0aa8156fdbce04376c537b1');\nhashMap.set('haskell-cabal','a2bf118238529952d0f2f352112dfbc86fb5533ef819625161a130f39c8ca713');\nhashMap.set('helm-requirements','8f643d415ab0cfbef05bce4dce9812eef47bddb7b8b67a191e6a4230489e652f');\nhashMap.set('helm-values','fbd4a0b4bdda8a71dc38ac8916287f73e2b7de5ef122096a5b5d525c1a3306cd');\nhashMap.set('helmfile','d5a965244170f3dede0c74cbfc8447547c740e5ccc41423cb8fd6ed6b154a552');\nhashMap.set('helmsman','734fa89740fd5140ca3e39204872aba3451c05cd17f0b5e2b635934ed7b1710b');\nhashMap.set('helmv3','2c053d7d4b265420350b1cdd8d9ca3d2ad8dd2598c3ff647af8651d777ff92ab');\nhashMap.set('hermit','4fff70ffcae503c3009227601a7a429a55b0d3f8748d49f4fbd69845fea38dc1');\nhashMap.set('homebrew','47393bd17f23eab1d465925b8f13bbda75226e5e5f7c55ffa52a11cbed03d742');\nhashMap.set('html','226a9084e10ebf754906386159db08667394f5432105249bdb30d9c60af9fb56');\nhashMap.set('jenkins','309db014e3590e1cd6d53ede2755395c82e5cd4b880425daf52a6ab60e0d6a42');\nhashMap.set('jsonnet-bundler','73ef9cdc2bb4b44e31699872ebadf1e3d51ef4ab42ae41152e459f296ab6e260');\nhashMap.set('kotlin-script','7d3376b11fc1dfcc87bd6a130b8c7d5158915fdf8ea8f64e83fdb1f7dd62e22c');\nhashMap.set('kubernetes','62cfa6c77593b48290f3c26a2f390c4bdfe8ab3cfb79e358b10d8aece689a999');\nhashMap.set('kustomize','347ab9066fbe7bb8365443280052c5240142488d205a182d4f8fb3bf096d954b');\nhashMap.set('leiningen','0598d2f53cfc92076d47186245a7b591d2b0df157609a7f55a37b54ab2d32a77');\nhashMap.set('maven','5592ee2784417aa586aca86efa13e142c4fdf544bd0deea691c596788a9c48c7');\nhashMap.set('maven-wrapper','63b7a448d3a3eebc8794b4dedce93a234f44f4b4fa5cb4a721078c12b4fee72c');\nhashMap.set('meteor','a9785d85b3520ed9e763c800730f36b95747795699758ecbe1395133c5b0040e');\nhashMap.set('mint','7072e37f18bb57500018406eb8711b2615b1916f073867f30653cdd4a99dab81');\nhashMap.set('mise','d84dcf05c3a23985e20aeca65a51552c808c954196fb4eae1de319c11f539ad9');\nhashMap.set('mix','27421372b5f8df486b0096be2d6f4403dbd64bd71c2f5ca6f6dd7ad0b30b3a3a');\nhashMap.set('nix','169443a1fe51757a040ac60f2aeae57fbd2dd8ec0f82cedb7aa880e327995c95');\nhashMap.set('nodenv','d159174d53e39af2013443cf86df88e14aac79a5a8d602180af229dcb2ddeda9');\nhashMap.set('npm','4dacb294fefc913f68e57b95c11699f760d3ae6d2ead8bcb55b908455c0b1152');\nhashMap.set('nuget','f366c8d11da898ab9012bbec7511354890032f8afd87db944561cffe479c367c');\nhashMap.set('nvm','2d7a15f668d33a31302af960c3bc137b86d0284b1ea16c528d334e46a468b0d4');\nhashMap.set('ocb','bff1864d0937341790cfe08833c39642f785844762669f5753ff057bada923ab');\nhashMap.set('osgi','dae012cd486843eb53da4b032105e54d18f4e7537bd59c5321313950dd108a95');\nhashMap.set('pep621','3f7c61b16393a59cc2e1819998a5e5128af2c55cda37145703a085360b1dde22');\nhashMap.set('pep723','bf07d466ea1bc9513c8d2cb475fcca3bc9b61f2184bd9af0a7a28d45b6f57ecd');\nhashMap.set('pip-compile','c433dd0445137e632dbf3144f337b925a9dd7f27f29ba0945a696adfb74e4066');\nhashMap.set('pip_requirements','16598617b0bd1beef3031d2529c634be601ecf572678f205589bf4d1ce7132f6');\nhashMap.set('pip_setup','31b330d9666d61474326a761a3ce1479f9a189ef6838ecfee78843ff4c80af73');\nhashMap.set('pipenv','e689b0c7680c26169b45ca17c90ced26281aea4c9b7ce01aff42c6169c567a92');\nhashMap.set('pixi','ad1d3689a4f4815be8b579ec7455d4c20f1a7602accd45f451ee554f4bd9d1fd');\nhashMap.set('poetry','8e346ddbee9d8b2e19447cebb0d691eb03b05a852c50d7e9b2d9789857330e1a');\nhashMap.set('pre-commit','64efc3146f0981751a584a29bdcfe6701cc17849c7bc2bc87b238315d843524a');\nhashMap.set('pub','a2e38469167f49a34503e25816c7b9dd113b65bd10a3ad3fa325ac4ce571a453');\nhashMap.set('puppet','34f7e3916780e8ed352b65864bad91bf66547e29f91ee8fca7fd6e8fcd2621fd');\nhashMap.set('pyenv','4e520570d9a1407864aa7c5461d4008372d889254067e405cee2212d0ef8990b');\nhashMap.set('quadlet','972bb8017f8c7811a74b91b56cfcd9d6f1aef1c026c9a8b956cecc63d95b0bb2');\nhashMap.set('renovate-config-presets','27f100d67e2a1ad20cfd4aa3f1db1f1c34f62910929695f381160b3835a7fa65');\nhashMap.set('ruby-version','4aac2178a20ccdf8136363030e5156017f3d44368b4192b3280997df596dcacc');\nhashMap.set('runtime-version','dbf80ce2a5f07dd34bc9a008159b4f08052cc6fd0d92cbd2aeb0026c8008fa72');\nhashMap.set('sbt','dc1ec4aeeb5e012c7a595478873ad67e2dee6e2af951b12b9e9057cb64f2258d');\nhashMap.set('scalafmt','8a54fef703269ed31ce28887e62b0b838a13359e86fa77c7f4dceb89fda0f352');\nhashMap.set('setup-cfg','9a778d8a58f643fff1d23d750dfebed21e45bce99bfdcdc3de39795a407d983f');\nhashMap.set('sveltos','a69f9e206526af08685e20a72344b22d856f2effd882e67333a153a989a0a047');\nhashMap.set('swift','966398303fb2b86c14cede8e4a7bfc7810d3100c39a60ac9e01e56b181df3970');\nhashMap.set('tekton','eb8fb6a25ca7fd0d304f67d5ab2e93ddd8b34854553130003ce3340ca7b3bba1');\nhashMap.set('terraform','61b56a155559e0c1db92f8ed7726b475bf2071804053eba694fcc70fd139e007');\nhashMap.set('terraform-version','b08480f326c45daf3daeccc2d2f593a723c30a50437a66ac2290d671b427a355');\nhashMap.set('terragrunt','b32d2317bf2cf032243c417463f3760e4decf820d2e5332e6415e16dcf05e9ab');\nhashMap.set('terragrunt-version','45f221b13a193a42687f318e10cf1558079e28c970e91ce25c370f35f88f2f58');\nhashMap.set('tflint-plugin','719408f35a233216562aa62fb8126145a3450b69f917c8fcdf2f3b2c05a9898b');\nhashMap.set('travis','30174e78a6297e44db1c030ea2e111084e14b1eac220f522522c77d684a76285');\nhashMap.set('typst','d0e2b7cbf2ac47d55bd41fd4503251a4f606861dc60d812eff7532371ae2a8cb');\nhashMap.set('unity3d','9a61f8db397bc962f03a1d82045805ffa89863894e26824ecbeffcbf66b3ba3d');\nhashMap.set('velaci','9ad5d5d2584b9c189c4edcd25ad9103926bd4ba850a419a3b5e4aba9682817c3');\nhashMap.set('vendir','dec4ea0068ab77bc60c04b9c62184a50e629709da463fe7218c2cdf9da37f2e8');\nhashMap.set('woodpecker','eaaa0a3bcfd0dc60c0990f2a1d7acf19c4f86ce4641ab3cf0a31f2bf46fc61b8');\nhashMap.set('jsonata','b8a0369f94be06f2109b7d233d8165a3e03d93498c43353720eb03b1eaa43e7b');\nhashMap.set('regex','3208bf2bf488d346e58c79c784eaddfc089f8a6b6b3df2263ab2fec8e3ec83c1');"]}
|
|
1
|
+
{"version":3,"file":"fingerprint.generated.js","sourceRoot":"","sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD,eAAO,CAAC,GAAG,CAAC,SAAS,EAAC,kEAAkE,CAAC,CAAC;AAC1F,eAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,kEAAkE,CAAC,CAAC;AACjG,eAAO,CAAC,GAAG,CAAC,QAAQ,EAAC,kEAAkE,CAAC,CAAC;AACzF,eAAO,CAAC,GAAG,CAAC,MAAM,EAAC,kEAAkE,CAAC,CAAC;AACvF,eAAO,CAAC,GAAG,CAAC,iBAAiB,EAAC,kEAAkE,CAAC,CAAC;AAClG,eAAO,CAAC,GAAG,CAAC,QAAQ,EAAC,kEAAkE,CAAC,CAAC;AACzF,eAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,kEAAkE,CAAC,CAAC;AACjG,eAAO,CAAC,GAAG,CAAC,OAAO,EAAC,kEAAkE,CAAC,CAAC;AACxF,eAAO,CAAC,GAAG,CAAC,cAAc,EAAC,kEAAkE,CAAC,CAAC;AAC/F,eAAO,CAAC,GAAG,CAAC,UAAU,EAAC,kEAAkE,CAAC,CAAC;AAC3F,eAAO,CAAC,GAAG,CAAC,OAAO,EAAC,kEAAkE,CAAC,CAAC;AACxF,eAAO,CAAC,GAAG,CAAC,qBAAqB,EAAC,kEAAkE,CAAC,CAAC;AACtG,eAAO,CAAC,GAAG,CAAC,SAAS,EAAC,kEAAkE,CAAC,CAAC;AAC1F,eAAO,CAAC,GAAG,CAAC,WAAW,EAAC,kEAAkE,CAAC,CAAC;AAC5F,eAAO,C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const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','4c234d79f768392545924fa9b139f8d177f15b6aa46776cf063860a1d36e48c7');\nhashMap.set('ansible-galaxy','a211e40f5c8613986ac16bc8d5389ea23d145cd643091d1b951a7f65926e99ff');\nhashMap.set('argocd','8619ed756b6f7249ea836e14e8f8660ee5f971992e3862d43f19d42f10762560');\nhashMap.set('asdf','e7f29eb8157e6ca5928890a0cc2fc88d57ddcf7b426dad1c4f15386858d3cd6a');\nhashMap.set('azure-pipelines','0b741b2629f6d94589524ce9b3886765e5c5648c9b6d707bb0b5fede276f9c09');\nhashMap.set('batect','523e8d7a309b4814a02819371313b2dac3764eab64cabfaf1d58b6e89de4ce43');\nhashMap.set('batect-wrapper','90941650f810adb3d7abe476da7221ff3434aa9d09ffc3d310e35108f360f364');\nhashMap.set('bazel','19e8ee20f9882e3023b2126d4b8335693cae9fb2b908f59803bbdfd432055d28');\nhashMap.set('bazel-module','4e3d00184b146e5c0ad69433697076f722afe933701ab08676af13e47d289eac');\nhashMap.set('bazelisk','6fbef61d534724ff259ea6e4fc1cd0a3d5a46d740c375128fa59b225daddd39f');\nhashMap.set('bicep','fbbd74998411012cfba829526701109d1fc184ade0cb11a28e4ca2956174b0f1');\nhashMap.set('bitbucket-pipelines','98c0d715a7eb4e41b8231091b83385f325966373f37dc7d6bc10b1febb6f605e');\nhashMap.set('bitrise','d18d2dcd356e19c4cd94912511a88636198c23b64e54f31da273be11044970cf');\nhashMap.set('buildkite','ac713ce38da057ff3ceb08d092291356dfc74f5b33b75f010bb9db1a211439c0');\nhashMap.set('buildpacks','cc8bbe937416a012df36a5c7ab01ae3cdedbed03615549bbe9f0f27fa40a150b');\nhashMap.set('bun','512695cbae4bf6bd17bad3c176b6e715d2cf0d7cbe5bef49da7f44f350161f6b');\nhashMap.set('bun-version','49194d7fcb6b7bdd7e7a1264f71532bb2be8142d48478bf74716f7a9d4b306b9');\nhashMap.set('bundler','7df6f082c34b90b660b70197906fdc3ad299e6650999bb3f8a0fddb7edeb398e');\nhashMap.set('cake','a04160b352550cb470acb62f9a532361842c12f2ffbcd473bffca3de024522d9');\nhashMap.set('cargo','5612a7b7bb5ccd007fed48ff7f345092ffe987d9f1086505d8ac03a436420251');\nhashMap.set('cdnurl','70281459e771df007787fc25dba16e4d5109865f97209dcf4f572ddd287d538a');\nhashMap.set('circleci','c7c7a1b71385f0ea7cf1e9fc24c37a1d5dabf13d6952e1e3b2179861b55f4e44');\nhashMap.set('cloudbuild','e4f926bfb907220e97dce98335837c52b4e0fe66d813593a7e572736acfc53f7');\nhashMap.set('cocoapods','1ff72f39f8c04e4a0253eb598906adebcaa5bc37b68f40e23317482f29936948');\nhashMap.set('composer','35f91e3dcc754668a42b18f5c2c9bd5a337d83eef1b80845fed8fd453074d020');\nhashMap.set('conan','4df92ebfa53ec6b7103030316ff70822d18f73cca8c71f2dca1d71c0d00b9353');\nhashMap.set('copier','34a3f985c82673bb7a2828ef644e271e5031da873e8cd44bf992a1826b3e40db');\nhashMap.set('cpanfile','9b354db9666eee2485b27e44a6e61eaadc86ec2f2c6af9bb7bbc9fab54f31642');\nhashMap.set('crossplane','76261ff27b38f9850ee1a3a7e95168abefd96b4736f2cf04a7343e16827b42d8');\nhashMap.set('crow','ffce0c24358c3097e3935bffc38ef3eff143dbbc589c1b75a6d3635a62fdeea4');\nhashMap.set('deps-edn','306376e0f00f47ea416dba972e6347f44c78228e298e4ed766635018e26f698a');\nhashMap.set('devbox','c00b62bd0fab0bb85874cbe2019dfa428f79dfc697d70a7445b80d641a3b7c0e');\nhashMap.set('devcontainer','e9982b5ff8aeac8fefb40dc363d3ab35f58af8c08b91eb45d22937a8c60447bb');\nhashMap.set('docker-compose','0c867e3aa14ae7dfc673eef348b2086ae2e36cbebfd1827e031a8030f9295276');\nhashMap.set('dockerfile','afbfa832a5d63c972c02445de3cd14fc9cf2e6bab797b0b7c930b16f5f267462');\nhashMap.set('droneci','f2a98fcece07b462baaceb28cd6904e080cb1ab0727fcd7403bea5ffd2e05239');\nhashMap.set('fleet','642e8e7ab739fba65bce7222b6f3e80fe44806c4190c8e93c5bcab23d44e9fd4');\nhashMap.set('flux','3b87b351f98c11ca0e6cb275deb708dc9bf601a7e578f7a3a7e83fe6e15eb540');\nhashMap.set('fvm','aa154dd5ffe3caced30713a9a55967360b7a0f35edd2fc06bd6f3e73c5c87570');\nhashMap.set('git-submodules','b5d78ab86025516b8cc52ede93b390c45a1a46e7ca338e1d2b7f1d57481ebf43');\nhashMap.set('github-actions','c27d8bb80e1e7f864a1c2e2964e40f171d72d0c4f83673de8d8cfe750b7c5c82');\nhashMap.set('gitlabci','1f2e3e3a3013488e68d2aa0e39d80ee3bfbc9a01d817874f4c8195f8aff1fac9');\nhashMap.set('gitlabci-include','5bc01de9b40ecc8888a37690152f4a2f9cacc509b9cb5902aac024ca7a7c8e65');\nhashMap.set('glasskube','fd415356a866ad174a5b70522d662e4289a2c5d5e34c55d57542b0d8968f1645');\nhashMap.set('gleam','a4621cc86a42890a41c31e957726e02514257f4e91896d92f238ac07ab81cebb');\nhashMap.set('gomod','7c9240c54e09aa30b83d5b02e08e0b93054f9685ce02103a342f7b8aacd5406b');\nhashMap.set('gradle','729af0df3f220bdf461a0e272685dbf1f14275409f8ebb4b12a5c3d6ab2d12d3');\nhashMap.set('gradle-wrapper','d691572ff7a998162d20527dcc70b3fbf569442da0aa8156fdbce04376c537b1');\nhashMap.set('haskell-cabal','a2bf118238529952d0f2f352112dfbc86fb5533ef819625161a130f39c8ca713');\nhashMap.set('helm-requirements','8f643d415ab0cfbef05bce4dce9812eef47bddb7b8b67a191e6a4230489e652f');\nhashMap.set('helm-values','fbd4a0b4bdda8a71dc38ac8916287f73e2b7de5ef122096a5b5d525c1a3306cd');\nhashMap.set('helmfile','d5a965244170f3dede0c74cbfc8447547c740e5ccc41423cb8fd6ed6b154a552');\nhashMap.set('helmsman','734fa89740fd5140ca3e39204872aba3451c05cd17f0b5e2b635934ed7b1710b');\nhashMap.set('helmv3','2c053d7d4b265420350b1cdd8d9ca3d2ad8dd2598c3ff647af8651d777ff92ab');\nhashMap.set('hermit','4fff70ffcae503c3009227601a7a429a55b0d3f8748d49f4fbd69845fea38dc1');\nhashMap.set('homebrew','47393bd17f23eab1d465925b8f13bbda75226e5e5f7c55ffa52a11cbed03d742');\nhashMap.set('html','226a9084e10ebf754906386159db08667394f5432105249bdb30d9c60af9fb56');\nhashMap.set('jenkins','309db014e3590e1cd6d53ede2755395c82e5cd4b880425daf52a6ab60e0d6a42');\nhashMap.set('jsonnet-bundler','73ef9cdc2bb4b44e31699872ebadf1e3d51ef4ab42ae41152e459f296ab6e260');\nhashMap.set('kotlin-script','7d3376b11fc1dfcc87bd6a130b8c7d5158915fdf8ea8f64e83fdb1f7dd62e22c');\nhashMap.set('kubernetes','62cfa6c77593b48290f3c26a2f390c4bdfe8ab3cfb79e358b10d8aece689a999');\nhashMap.set('kustomize','347ab9066fbe7bb8365443280052c5240142488d205a182d4f8fb3bf096d954b');\nhashMap.set('leiningen','0598d2f53cfc92076d47186245a7b591d2b0df157609a7f55a37b54ab2d32a77');\nhashMap.set('maven','5592ee2784417aa586aca86efa13e142c4fdf544bd0deea691c596788a9c48c7');\nhashMap.set('maven-wrapper','63b7a448d3a3eebc8794b4dedce93a234f44f4b4fa5cb4a721078c12b4fee72c');\nhashMap.set('meteor','a9785d85b3520ed9e763c800730f36b95747795699758ecbe1395133c5b0040e');\nhashMap.set('mint','7072e37f18bb57500018406eb8711b2615b1916f073867f30653cdd4a99dab81');\nhashMap.set('mise','d84dcf05c3a23985e20aeca65a51552c808c954196fb4eae1de319c11f539ad9');\nhashMap.set('mix','27421372b5f8df486b0096be2d6f4403dbd64bd71c2f5ca6f6dd7ad0b30b3a3a');\nhashMap.set('nix','169443a1fe51757a040ac60f2aeae57fbd2dd8ec0f82cedb7aa880e327995c95');\nhashMap.set('nodenv','d159174d53e39af2013443cf86df88e14aac79a5a8d602180af229dcb2ddeda9');\nhashMap.set('npm','4dacb294fefc913f68e57b95c11699f760d3ae6d2ead8bcb55b908455c0b1152');\nhashMap.set('nuget','f366c8d11da898ab9012bbec7511354890032f8afd87db944561cffe479c367c');\nhashMap.set('nvm','2d7a15f668d33a31302af960c3bc137b86d0284b1ea16c528d334e46a468b0d4');\nhashMap.set('ocb','bff1864d0937341790cfe08833c39642f785844762669f5753ff057bada923ab');\nhashMap.set('osgi','dae012cd486843eb53da4b032105e54d18f4e7537bd59c5321313950dd108a95');\nhashMap.set('pep621','3f7c61b16393a59cc2e1819998a5e5128af2c55cda37145703a085360b1dde22');\nhashMap.set('pep723','bf07d466ea1bc9513c8d2cb475fcca3bc9b61f2184bd9af0a7a28d45b6f57ecd');\nhashMap.set('pip-compile','c433dd0445137e632dbf3144f337b925a9dd7f27f29ba0945a696adfb74e4066');\nhashMap.set('pip_requirements','16598617b0bd1beef3031d2529c634be601ecf572678f205589bf4d1ce7132f6');\nhashMap.set('pip_setup','31b330d9666d61474326a761a3ce1479f9a189ef6838ecfee78843ff4c80af73');\nhashMap.set('pipenv','e689b0c7680c26169b45ca17c90ced26281aea4c9b7ce01aff42c6169c567a92');\nhashMap.set('pixi','ad1d3689a4f4815be8b579ec7455d4c20f1a7602accd45f451ee554f4bd9d1fd');\nhashMap.set('poetry','8e346ddbee9d8b2e19447cebb0d691eb03b05a852c50d7e9b2d9789857330e1a');\nhashMap.set('pre-commit','64efc3146f0981751a584a29bdcfe6701cc17849c7bc2bc87b238315d843524a');\nhashMap.set('pub','a2e38469167f49a34503e25816c7b9dd113b65bd10a3ad3fa325ac4ce571a453');\nhashMap.set('puppet','34f7e3916780e8ed352b65864bad91bf66547e29f91ee8fca7fd6e8fcd2621fd');\nhashMap.set('pyenv','4e520570d9a1407864aa7c5461d4008372d889254067e405cee2212d0ef8990b');\nhashMap.set('quadlet','972bb8017f8c7811a74b91b56cfcd9d6f1aef1c026c9a8b956cecc63d95b0bb2');\nhashMap.set('renovate-config-presets','27f100d67e2a1ad20cfd4aa3f1db1f1c34f62910929695f381160b3835a7fa65');\nhashMap.set('ruby-version','4aac2178a20ccdf8136363030e5156017f3d44368b4192b3280997df596dcacc');\nhashMap.set('runtime-version','dbf80ce2a5f07dd34bc9a008159b4f08052cc6fd0d92cbd2aeb0026c8008fa72');\nhashMap.set('sbt','dc1ec4aeeb5e012c7a595478873ad67e2dee6e2af951b12b9e9057cb64f2258d');\nhashMap.set('scalafmt','8a54fef703269ed31ce28887e62b0b838a13359e86fa77c7f4dceb89fda0f352');\nhashMap.set('setup-cfg','9a778d8a58f643fff1d23d750dfebed21e45bce99bfdcdc3de39795a407d983f');\nhashMap.set('sveltos','a69f9e206526af08685e20a72344b22d856f2effd882e67333a153a989a0a047');\nhashMap.set('swift','966398303fb2b86c14cede8e4a7bfc7810d3100c39a60ac9e01e56b181df3970');\nhashMap.set('tekton','eb8fb6a25ca7fd0d304f67d5ab2e93ddd8b34854553130003ce3340ca7b3bba1');\nhashMap.set('terraform','61b56a155559e0c1db92f8ed7726b475bf2071804053eba694fcc70fd139e007');\nhashMap.set('terraform-version','b08480f326c45daf3daeccc2d2f593a723c30a50437a66ac2290d671b427a355');\nhashMap.set('terragrunt','b32d2317bf2cf032243c417463f3760e4decf820d2e5332e6415e16dcf05e9ab');\nhashMap.set('terragrunt-version','45f221b13a193a42687f318e10cf1558079e28c970e91ce25c370f35f88f2f58');\nhashMap.set('tflint-plugin','719408f35a233216562aa62fb8126145a3450b69f917c8fcdf2f3b2c05a9898b');\nhashMap.set('travis','30174e78a6297e44db1c030ea2e111084e14b1eac220f522522c77d684a76285');\nhashMap.set('typst','d0e2b7cbf2ac47d55bd41fd4503251a4f606861dc60d812eff7532371ae2a8cb');\nhashMap.set('unity3d','9a61f8db397bc962f03a1d82045805ffa89863894e26824ecbeffcbf66b3ba3d');\nhashMap.set('velaci','9ad5d5d2584b9c189c4edcd25ad9103926bd4ba850a419a3b5e4aba9682817c3');\nhashMap.set('vendir','dec4ea0068ab77bc60c04b9c62184a50e629709da463fe7218c2cdf9da37f2e8');\nhashMap.set('woodpecker','eaaa0a3bcfd0dc60c0990f2a1d7acf19c4f86ce4641ab3cf0a31f2bf46fc61b8');\nhashMap.set('jsonata','b8a0369f94be06f2109b7d233d8165a3e03d93498c43353720eb03b1eaa43e7b');\nhashMap.set('regex','3208bf2bf488d346e58c79c784eaddfc089f8a6b6b3df2263ab2fec8e3ec83c1');"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractPackageFile = extractPackageFile;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
|
5
6
|
const global_1 = require("../../../config/global");
|
|
6
7
|
const logger_1 = require("../../../logger");
|
|
7
8
|
const common_1 = require("../../../util/common");
|
|
@@ -16,12 +17,8 @@ const nodeVersioning = tslib_1.__importStar(require("../../versioning/node"));
|
|
|
16
17
|
const npmVersioning = tslib_1.__importStar(require("../../versioning/npm"));
|
|
17
18
|
const extract_1 = require("../dockerfile/extract");
|
|
18
19
|
const community_1 = require("./community");
|
|
20
|
+
const parse_1 = require("./parse");
|
|
19
21
|
const schema_1 = require("./schema");
|
|
20
|
-
const dockerActionRe = (0, regex_1.regEx)(/^\s+uses\s*: ['"]?docker:\/\/([^'"\s]+)/);
|
|
21
|
-
const actionRe = (0, regex_1.regEx)(/^\s+-?\s+?uses\s*: (?<replaceString>['"]?(?<depName>(?<registryUrl>https:\/\/[.\w-]+\/)?(?<packageName>[\w-]+\/[.\w-]+))(?<path>\/.*)?@(?<currentValue>[^\s'"]+)['"]?(?:(?<commentWhiteSpaces>\s+)#\s*(((?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+)?)@?(?<tag>([\w-]*[-/])?v?\d+(?:\.\d+(?:\.\d+)?)?)|(?:ratchet:exclude)))?)/);
|
|
22
|
-
// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/
|
|
23
|
-
const shaRe = (0, regex_1.regEx)(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);
|
|
24
|
-
const shaShortRe = (0, regex_1.regEx)(/^[a-f0-9]{6,7}$/);
|
|
25
22
|
// detects if we run against a Github Enterprise Server and adds the URL to the beginning of the registryURLs for looking up Actions
|
|
26
23
|
// This reflects the behavior of how GitHub looks up Actions
|
|
27
24
|
// First on the Enterprise Server, then on GitHub.com
|
|
@@ -38,6 +35,61 @@ function detectCustomGitHubRegistryUrlsForActions() {
|
|
|
38
35
|
}
|
|
39
36
|
return {};
|
|
40
37
|
}
|
|
38
|
+
function extractDockerAction(actionRef, config) {
|
|
39
|
+
const dep = (0, extract_1.getDep)(actionRef.originalRef, true, config.registryAliases);
|
|
40
|
+
dep.depType = 'docker';
|
|
41
|
+
dep.replaceString = actionRef.originalRef;
|
|
42
|
+
return dep;
|
|
43
|
+
}
|
|
44
|
+
function extractRepositoryAction(actionRef, parsed, customRegistryUrlsPackageDependency) {
|
|
45
|
+
const { replaceString: valueString, quote, commentData, commentPrecedingWhitespace, } = parsed;
|
|
46
|
+
const { owner, repo, path: subPath, ref, hostname, isExplicitHostname, } = actionRef;
|
|
47
|
+
const registryUrl = isExplicitHostname ? `https://${hostname}/` : '';
|
|
48
|
+
const packageName = `${owner}/${repo}`;
|
|
49
|
+
const depName = `${registryUrl}${packageName}`;
|
|
50
|
+
const pathSuffix = subPath ? `/${subPath}` : '';
|
|
51
|
+
const commentWs = commentPrecedingWhitespace || ' ';
|
|
52
|
+
const dep = {
|
|
53
|
+
depName,
|
|
54
|
+
commitMessageTopic: '{{{depName}}} action',
|
|
55
|
+
datasource: github_tags_1.GithubTagsDatasource.id,
|
|
56
|
+
versioning: dockerVersioning.id,
|
|
57
|
+
depType: 'action',
|
|
58
|
+
replaceString: valueString,
|
|
59
|
+
autoReplaceStringTemplate: `${quote}{{depName}}${pathSuffix}@{{#if newDigest}}{{newDigest}}${quote}{{#if newValue}}${commentWs}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quote}{{/unless}}`,
|
|
60
|
+
...(isExplicitHostname
|
|
61
|
+
? detectDatasource(registryUrl)
|
|
62
|
+
: customRegistryUrlsPackageDependency),
|
|
63
|
+
};
|
|
64
|
+
if (packageName !== depName) {
|
|
65
|
+
dep.packageName = packageName;
|
|
66
|
+
}
|
|
67
|
+
if (commentData.pinnedVersion &&
|
|
68
|
+
!is_1.default.undefined(commentData.index) &&
|
|
69
|
+
!is_1.default.undefined(commentData.matchedString)) {
|
|
70
|
+
const cleanComment = parsed.commentString.slice(1);
|
|
71
|
+
const matchEndIndex = commentData.index + commentData.matchedString.length;
|
|
72
|
+
const commentSuffix = cleanComment.slice(0, matchEndIndex);
|
|
73
|
+
dep.replaceString =
|
|
74
|
+
valueString + commentPrecedingWhitespace + '#' + commentSuffix;
|
|
75
|
+
}
|
|
76
|
+
else if (commentData.ratchetExclude) {
|
|
77
|
+
dep.replaceString =
|
|
78
|
+
valueString + commentPrecedingWhitespace + parsed.commentString;
|
|
79
|
+
}
|
|
80
|
+
if ((0, parse_1.isSha)(ref)) {
|
|
81
|
+
dep.currentValue = commentData.pinnedVersion;
|
|
82
|
+
dep.currentDigest = ref;
|
|
83
|
+
}
|
|
84
|
+
else if ((0, parse_1.isShortSha)(ref)) {
|
|
85
|
+
dep.currentValue = commentData.pinnedVersion;
|
|
86
|
+
dep.currentDigestShort = ref;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
dep.currentValue = ref;
|
|
90
|
+
}
|
|
91
|
+
return dep;
|
|
92
|
+
}
|
|
41
93
|
function extractWithRegex(content, config) {
|
|
42
94
|
const customRegistryUrlsPackageDependency = detectCustomGitHubRegistryUrlsForActions();
|
|
43
95
|
logger_1.logger.trace('github-actions.extractWithRegex()');
|
|
@@ -46,49 +98,17 @@ function extractWithRegex(content, config) {
|
|
|
46
98
|
if (line.trim().startsWith('#')) {
|
|
47
99
|
continue;
|
|
48
100
|
}
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const [, currentFrom] = dockerMatch;
|
|
52
|
-
const dep = (0, extract_1.getDep)(currentFrom, true, config.registryAliases);
|
|
53
|
-
dep.depType = 'docker';
|
|
54
|
-
deps.push(dep);
|
|
101
|
+
const parsed = (0, parse_1.parseUsesLine)(line);
|
|
102
|
+
if (!parsed?.actionRef) {
|
|
55
103
|
continue;
|
|
56
104
|
}
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (replaceString.includes('"')) {
|
|
65
|
-
quotes = '"';
|
|
66
|
-
}
|
|
67
|
-
const dep = {
|
|
68
|
-
depName,
|
|
69
|
-
...(packageName !== depName && { packageName }),
|
|
70
|
-
commitMessageTopic: '{{{depName}}} action',
|
|
71
|
-
datasource: github_tags_1.GithubTagsDatasource.id,
|
|
72
|
-
versioning: dockerVersioning.id,
|
|
73
|
-
depType: 'action',
|
|
74
|
-
replaceString,
|
|
75
|
-
autoReplaceStringTemplate: `${quotes}{{depName}}${path}@{{#if newDigest}}{{newDigest}}${quotes}{{#if newValue}}${commentWhiteSpaces}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quotes}{{/unless}}`,
|
|
76
|
-
...(registryUrl
|
|
77
|
-
? detectDatasource(registryUrl)
|
|
78
|
-
: customRegistryUrlsPackageDependency),
|
|
79
|
-
};
|
|
80
|
-
if (shaRe.test(currentValue)) {
|
|
81
|
-
dep.currentValue = tag;
|
|
82
|
-
dep.currentDigest = currentValue;
|
|
83
|
-
}
|
|
84
|
-
else if (shaShortRe.test(currentValue)) {
|
|
85
|
-
dep.currentValue = tag;
|
|
86
|
-
dep.currentDigestShort = currentValue;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
dep.currentValue = currentValue;
|
|
90
|
-
}
|
|
91
|
-
deps.push(dep);
|
|
105
|
+
const { actionRef } = parsed;
|
|
106
|
+
if (actionRef.kind === 'docker') {
|
|
107
|
+
deps.push(extractDockerAction(actionRef, config));
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (actionRef.kind === 'repository') {
|
|
111
|
+
deps.push(extractRepositoryAction(actionRef, parsed, customRegistryUrlsPackageDependency));
|
|
92
112
|
}
|
|
93
113
|
}
|
|
94
114
|
return deps;
|
|
@@ -145,68 +165,79 @@ const versionedActions = {
|
|
|
145
165
|
// - dotnet
|
|
146
166
|
// - java
|
|
147
167
|
};
|
|
148
|
-
function
|
|
168
|
+
function extractVersionedAction(step) {
|
|
169
|
+
for (const [action, versioning] of Object.entries(versionedActions)) {
|
|
170
|
+
const actionName = `actions/setup-${action}`;
|
|
171
|
+
if (step.uses !== actionName && !step.uses?.startsWith(`${actionName}@`)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const fieldName = `${action}-version`;
|
|
175
|
+
const currentValue = step.with?.[fieldName];
|
|
176
|
+
if (!currentValue) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
datasource: github_releases_1.GithubReleasesDatasource.id,
|
|
181
|
+
depName: action,
|
|
182
|
+
packageName: `actions/${action}-versions`,
|
|
183
|
+
versioning,
|
|
184
|
+
extractVersion: '^(?<version>\\d+\\.\\d+\\.\\d+)(-\\d+)?$',
|
|
185
|
+
currentValue,
|
|
186
|
+
depType: 'uses-with',
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
function extractSteps(steps) {
|
|
192
|
+
const deps = [];
|
|
149
193
|
for (const step of steps) {
|
|
150
194
|
const res = community_1.CommunityActions.safeParse(step);
|
|
151
195
|
if (res.success) {
|
|
152
196
|
deps.push(res.data);
|
|
153
197
|
continue;
|
|
154
198
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const fieldName = `${action}-version`;
|
|
159
|
-
const currentValue = step.with?.[fieldName];
|
|
160
|
-
if (currentValue) {
|
|
161
|
-
deps.push({
|
|
162
|
-
datasource: github_releases_1.GithubReleasesDatasource.id,
|
|
163
|
-
depName: action,
|
|
164
|
-
packageName: `actions/${action}-versions`,
|
|
165
|
-
versioning,
|
|
166
|
-
extractVersion: '^(?<version>\\d+\\.\\d+\\.\\d+)(-\\d+)?$', // Actions release tags are like 1.24.1-13667719799
|
|
167
|
-
currentValue,
|
|
168
|
-
depType: 'uses-with',
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
199
|
+
const versionedDep = extractVersionedAction(step);
|
|
200
|
+
if (versionedDep) {
|
|
201
|
+
deps.push(versionedDep);
|
|
172
202
|
}
|
|
173
203
|
}
|
|
204
|
+
return deps;
|
|
174
205
|
}
|
|
175
206
|
function extractWithYAMLParser(content, packageFile, config) {
|
|
176
207
|
logger_1.logger.trace('github-actions.extractWithYAMLParser()');
|
|
177
|
-
const deps = [];
|
|
178
208
|
const obj = (0, logger_1.withMeta)({ packageFile }, () => schema_1.Workflow.parse(content));
|
|
179
209
|
if (!obj) {
|
|
180
|
-
return
|
|
210
|
+
return [];
|
|
181
211
|
}
|
|
182
|
-
// composite action
|
|
183
212
|
if ('runs' in obj && obj.runs.steps) {
|
|
184
|
-
extractSteps(obj.runs.steps
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
213
|
+
return extractSteps(obj.runs.steps);
|
|
214
|
+
}
|
|
215
|
+
if (!('jobs' in obj)) {
|
|
216
|
+
return [];
|
|
217
|
+
}
|
|
218
|
+
const deps = [];
|
|
219
|
+
for (const job of Object.values(obj.jobs)) {
|
|
220
|
+
if (job.container) {
|
|
221
|
+
const dep = (0, extract_1.getDep)(job.container, true, config.registryAliases);
|
|
222
|
+
if (dep) {
|
|
223
|
+
dep.depType = 'container';
|
|
224
|
+
deps.push(dep);
|
|
194
225
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
226
|
+
}
|
|
227
|
+
for (const service of job.services) {
|
|
228
|
+
const dep = (0, extract_1.getDep)(service, true, config.registryAliases);
|
|
229
|
+
if (dep) {
|
|
230
|
+
dep.depType = 'service';
|
|
231
|
+
deps.push(dep);
|
|
201
232
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
233
|
+
}
|
|
234
|
+
for (const runner of job['runs-on']) {
|
|
235
|
+
const dep = extractRunner(runner);
|
|
236
|
+
if (dep) {
|
|
237
|
+
deps.push(dep);
|
|
207
238
|
}
|
|
208
|
-
extractSteps(job.steps, deps);
|
|
209
239
|
}
|
|
240
|
+
deps.push(...extractSteps(job.steps));
|
|
210
241
|
}
|
|
211
242
|
return deps;
|
|
212
243
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/modules/manager/github-actions/extract.ts"],"names":[],"mappings":";;AA6QA,gDAcC;;AA3RD,mDAAsD;AACtD,4CAAmD;AACnD,iDAAsD;AACtD,+CAA0D;AAC1D,gEAAsE;AACtE,4DAAkE;AAClE,sEAA4E;AAC5E,oEAA0E;AAC1E,8DAAoE;AACpE,kFAA4D;AAC5D,8EAAwD;AACxD,4EAAsD;AACtD,mDAA+C;AAM/C,2CAA+C;AAE/C,qCAAoC;AAEpC,MAAM,cAAc,GAAG,IAAA,aAAK,EAAC,yCAAyC,CAAC,CAAC;AACxE,MAAM,QAAQ,GAAG,IAAA,aAAK,EACpB,0VAA0V,CAC3V,CAAC;AAEF,wEAAwE;AACxE,MAAM,KAAK,GAAG,IAAA,aAAK,EAAC,iCAAiC,CAAC,CAAC;AACvD,MAAM,UAAU,GAAG,IAAA,aAAK,EAAC,iBAAiB,CAAC,CAAC;AAE5C,oIAAoI;AACpI,4DAA4D;AAC5D,qDAAqD;AACrD,S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AE,CAAC;oBACR,GAAG,CAAC,OAAO,GAAG,WAAW,CAAC;oBAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC;YAED,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBACnC,MAAM,GAAG,GAAG,IAAA,gBAAM,EAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC1D,IAAI,GAAG,EAAE,CAAC;oBACR,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;oBACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC;YAED,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACpC,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;gBAClC,IAAI,GAAG,EAAE,CAAC;oBACR,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC;YAED,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,kBAAkB,CAChC,OAAe,EACf,WAAmB,EACnB,SAAwB,EAAE;IAE1B,eAAM,CAAC,KAAK,CAAC,qCAAqC,WAAW,GAAG,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG;QACX,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC;QACpC,GAAG,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC;KACvD,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC","sourcesContent":["import { GlobalConfig } from '../../../config/global';\nimport { logger, withMeta } from '../../../logger';\nimport { detectPlatform } from '../../../util/common';\nimport { newlineRegex, regEx } from '../../../util/regex';\nimport { ForgejoTagsDatasource } from '../../datasource/forgejo-tags';\nimport { GiteaTagsDatasource } from '../../datasource/gitea-tags';\nimport { GithubReleasesDatasource } from '../../datasource/github-releases';\nimport { GithubRunnersDatasource } from '../../datasource/github-runners';\nimport { GithubTagsDatasource } from '../../datasource/github-tags';\nimport * as dockerVersioning from '../../versioning/docker';\nimport * as nodeVersioning from '../../versioning/node';\nimport * as npmVersioning from '../../versioning/npm';\nimport { getDep } from '../dockerfile/extract';\nimport type {\n ExtractConfig,\n PackageDependency,\n PackageFileContent,\n} from '../types';\nimport { CommunityActions } from './community';\nimport type { Steps } from './schema';\nimport { Workflow } from './schema';\n\nconst dockerActionRe = regEx(/^\\s+uses\\s*: ['\"]?docker:\\/\\/([^'\"\\s]+)/);\nconst actionRe = regEx(\n /^\\s+-?\\s+?uses\\s*: (?<replaceString>['\"]?(?<depName>(?<registryUrl>https:\\/\\/[.\\w-]+\\/)?(?<packageName>[\\w-]+\\/[.\\w-]+))(?<path>\\/.*)?@(?<currentValue>[^\\s'\"]+)['\"]?(?:(?<commentWhiteSpaces>\\s+)#\\s*(((?:renovate\\s*:\\s*)?(?:pin\\s+|tag\\s*=\\s*)?|(?:ratchet:[\\w-]+\\/[.\\w-]+)?)@?(?<tag>([\\w-]*[-/])?v?\\d+(?:\\.\\d+(?:\\.\\d+)?)?)|(?:ratchet:exclude)))?)/,\n);\n\n// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/\nconst shaRe = regEx(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);\nconst shaShortRe = regEx(/^[a-f0-9]{6,7}$/);\n\n// detects if we run against a Github Enterprise Server and adds the URL to the beginning of the registryURLs for looking up Actions\n// This reflects the behavior of how GitHub looks up Actions\n// First on the Enterprise Server, then on GitHub.com\nfunction detectCustomGitHubRegistryUrlsForActions(): PackageDependency {\n const endpoint = GlobalConfig.get('endpoint');\n const registryUrls = ['https://github.com'];\n if (endpoint && GlobalConfig.get('platform') === 'github') {\n const parsedEndpoint = new URL(endpoint);\n\n if (\n parsedEndpoint.host !== 'github.com' &&\n parsedEndpoint.host !== 'api.github.com'\n ) {\n registryUrls.unshift(\n `${parsedEndpoint.protocol}//${parsedEndpoint.host}`,\n );\n return { registryUrls };\n }\n }\n return {};\n}\n\nfunction extractWithRegex(\n content: string,\n config: ExtractConfig,\n): PackageDependency[] {\n const customRegistryUrlsPackageDependency =\n detectCustomGitHubRegistryUrlsForActions();\n logger.trace('github-actions.extractWithRegex()');\n const deps: PackageDependency[] = [];\n for (const line of content.split(newlineRegex)) {\n if (line.trim().startsWith('#')) {\n continue;\n }\n\n const dockerMatch = dockerActionRe.exec(line);\n if (dockerMatch) {\n const [, currentFrom] = dockerMatch;\n const dep = getDep(currentFrom, true, config.registryAliases);\n dep.depType = 'docker';\n deps.push(dep);\n continue;\n }\n\n const tagMatch = actionRe.exec(line);\n if (tagMatch?.groups) {\n const {\n depName,\n packageName,\n currentValue,\n path = '',\n tag,\n replaceString,\n registryUrl = '',\n commentWhiteSpaces = ' ',\n } = tagMatch.groups;\n let quotes = '';\n if (replaceString.includes(\"'\")) {\n quotes = \"'\";\n }\n if (replaceString.includes('\"')) {\n quotes = '\"';\n }\n const dep: PackageDependency = {\n depName,\n ...(packageName !== depName && { packageName }),\n commitMessageTopic: '{{{depName}}} action',\n datasource: GithubTagsDatasource.id,\n versioning: dockerVersioning.id,\n depType: 'action',\n replaceString,\n autoReplaceStringTemplate: `${quotes}{{depName}}${path}@{{#if newDigest}}{{newDigest}}${quotes}{{#if newValue}}${commentWhiteSpaces}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quotes}{{/unless}}`,\n ...(registryUrl\n ? detectDatasource(registryUrl)\n : customRegistryUrlsPackageDependency),\n };\n if (shaRe.test(currentValue)) {\n dep.currentValue = tag;\n dep.currentDigest = currentValue;\n } else if (shaShortRe.test(currentValue)) {\n dep.currentValue = tag;\n dep.currentDigestShort = currentValue;\n } else {\n dep.currentValue = currentValue;\n }\n deps.push(dep);\n }\n }\n return deps;\n}\n\nfunction detectDatasource(registryUrl: string): PackageDependency {\n const platform = detectPlatform(registryUrl);\n\n switch (platform) {\n case 'forgejo':\n return {\n registryUrls: [registryUrl],\n datasource: ForgejoTagsDatasource.id,\n };\n case 'gitea':\n return {\n registryUrls: [registryUrl],\n datasource: GiteaTagsDatasource.id,\n };\n case 'github':\n return { registryUrls: [registryUrl] };\n }\n\n return {\n skipReason: 'unsupported-url',\n };\n}\n\nconst runnerVersionRegex = regEx(\n /^\\s*(?<depName>[a-zA-Z]+)-(?<currentValue>[^\\s]+)/,\n);\n\nfunction extractRunner(runner: string): PackageDependency | null {\n const runnerVersionGroups = runnerVersionRegex.exec(runner)?.groups;\n if (!runnerVersionGroups) {\n return null;\n }\n\n const { depName, currentValue } = runnerVersionGroups;\n\n if (!GithubRunnersDatasource.isValidRunner(depName, currentValue)) {\n return null;\n }\n\n const dependency: PackageDependency = {\n depName,\n currentValue,\n replaceString: `${depName}-${currentValue}`,\n depType: 'github-runner',\n datasource: GithubRunnersDatasource.id,\n autoReplaceStringTemplate: '{{depName}}-{{newValue}}',\n };\n\n if (!dockerVersioning.api.isValid(currentValue)) {\n dependency.skipReason = 'invalid-version';\n }\n\n return dependency;\n}\n\n// For official https://github.com/actions\nconst versionedActions: Record<string, string> = {\n go: npmVersioning.id,\n node: nodeVersioning.id,\n python: npmVersioning.id,\n\n // Not covered yet because they use different datasources/packageNames:\n // - dotnet\n // - java\n};\n\nfunction extractSteps(\n steps: Steps[],\n deps: PackageDependency<Record<string, any>>[],\n): void {\n for (const step of steps) {\n const res = CommunityActions.safeParse(step);\n if (res.success) {\n deps.push(res.data);\n continue;\n }\n\n for (const [action, versioning] of Object.entries(versionedActions)) {\n const actionName = `actions/setup-${action}`;\n if (step.uses === actionName || step.uses?.startsWith(`${actionName}@`)) {\n const fieldName = `${action}-version`;\n const currentValue = step.with?.[fieldName];\n if (currentValue) {\n deps.push({\n datasource: GithubReleasesDatasource.id,\n depName: action,\n packageName: `actions/${action}-versions`,\n versioning,\n extractVersion: '^(?<version>\\\\d+\\\\.\\\\d+\\\\.\\\\d+)(-\\\\d+)?$', // Actions release tags are like 1.24.1-13667719799\n currentValue,\n depType: 'uses-with',\n });\n }\n }\n }\n }\n}\n\nfunction extractWithYAMLParser(\n content: string,\n packageFile: string,\n config: ExtractConfig,\n): PackageDependency[] {\n logger.trace('github-actions.extractWithYAMLParser()');\n const deps: PackageDependency[] = [];\n\n const obj = withMeta({ packageFile }, () => Workflow.parse(content));\n\n if (!obj) {\n return deps;\n }\n\n // composite action\n if ('runs' in obj && obj.runs.steps) {\n extractSteps(obj.runs.steps, deps);\n } else if ('jobs' in obj) {\n for (const job of Object.values(obj.jobs)) {\n if (job.container) {\n const dep = getDep(job.container, true, config.registryAliases);\n if (dep) {\n dep.depType = 'container';\n deps.push(dep);\n }\n }\n\n for (const service of job.services) {\n const dep = getDep(service, true, config.registryAliases);\n if (dep) {\n dep.depType = 'service';\n deps.push(dep);\n }\n }\n\n for (const runner of job['runs-on']) {\n const dep = extractRunner(runner);\n if (dep) {\n deps.push(dep);\n }\n }\n\n extractSteps(job.steps, deps);\n }\n }\n\n return deps;\n}\n\nexport function extractPackageFile(\n content: string,\n packageFile: string,\n config: ExtractConfig = {}, // TODO: enforce ExtractConfig\n): PackageFileContent | null {\n logger.trace(`github-actions.extractPackageFile(${packageFile})`);\n const deps = [\n ...extractWithRegex(content, config),\n ...extractWithYAMLParser(content, packageFile, config),\n ];\n if (!deps.length) {\n return null;\n }\n return { deps };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/modules/manager/github-actions/extract.ts"],"names":[],"mappings":";;AA2UA,gDAiBC;;AA5VD,kEAAkC;AAClC,mDAAsD;AACtD,4CAAmD;AACnD,iDAAsD;AACtD,+CAA0D;AAC1D,gEAAsE;AACtE,4DA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gB,kBAAkB,CAChC,OAAe,EACf,WAAmB,EACnB,SAAwB,EAAE;IAE1B,eAAM,CAAC,KAAK,CAAC,qCAAqC,WAAW,GAAG,CAAC,CAAC;IAElE,MAAM,IAAI,GAAG;QACX,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC;QACpC,GAAG,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC;KACvD,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { GlobalConfig } from '../../../config/global';\nimport { logger, withMeta } from '../../../logger';\nimport { detectPlatform } from '../../../util/common';\nimport { newlineRegex, regEx } from '../../../util/regex';\nimport { ForgejoTagsDatasource } from '../../datasource/forgejo-tags';\nimport { GiteaTagsDatasource } from '../../datasource/gitea-tags';\nimport { GithubReleasesDatasource } from '../../datasource/github-releases';\nimport { GithubRunnersDatasource } from '../../datasource/github-runners';\nimport { GithubTagsDatasource } from '../../datasource/github-tags';\nimport * as dockerVersioning from '../../versioning/docker';\nimport * as nodeVersioning from '../../versioning/node';\nimport * as npmVersioning from '../../versioning/npm';\nimport { getDep } from '../dockerfile/extract';\nimport type {\n ExtractConfig,\n PackageDependency,\n PackageFileContent,\n} from '../types';\nimport { CommunityActions } from './community';\nimport type { DockerReference, RepositoryReference } from './parse';\nimport { isSha, isShortSha, parseUsesLine } from './parse';\nimport type { Steps } from './schema';\nimport { Workflow } from './schema';\n\n// detects if we run against a Github Enterprise Server and adds the URL to the beginning of the registryURLs for looking up Actions\n// This reflects the behavior of how GitHub looks up Actions\n// First on the Enterprise Server, then on GitHub.com\nfunction detectCustomGitHubRegistryUrlsForActions(): PackageDependency {\n const endpoint = GlobalConfig.get('endpoint');\n const registryUrls = ['https://github.com'];\n if (endpoint && GlobalConfig.get('platform') === 'github') {\n const parsedEndpoint = new URL(endpoint);\n\n if (\n parsedEndpoint.host !== 'github.com' &&\n parsedEndpoint.host !== 'api.github.com'\n ) {\n registryUrls.unshift(\n `${parsedEndpoint.protocol}//${parsedEndpoint.host}`,\n );\n return { registryUrls };\n }\n }\n return {};\n}\n\nfunction extractDockerAction(\n actionRef: DockerReference,\n config: ExtractConfig,\n): PackageDependency {\n const dep = getDep(actionRef.originalRef, true, config.registryAliases);\n dep.depType = 'docker';\n dep.replaceString = actionRef.originalRef;\n return dep;\n}\n\nfunction extractRepositoryAction(\n actionRef: RepositoryReference,\n parsed: ReturnType<typeof parseUsesLine> & object,\n customRegistryUrlsPackageDependency: PackageDependency,\n): PackageDependency {\n const {\n replaceString: valueString,\n quote,\n commentData,\n commentPrecedingWhitespace,\n } = parsed;\n const {\n owner,\n repo,\n path: subPath,\n ref,\n hostname,\n isExplicitHostname,\n } = actionRef;\n\n const registryUrl = isExplicitHostname ? `https://${hostname}/` : '';\n const packageName = `${owner}/${repo}`;\n const depName = `${registryUrl}${packageName}`;\n const pathSuffix = subPath ? `/${subPath}` : '';\n const commentWs = commentPrecedingWhitespace || ' ';\n\n const dep: PackageDependency = {\n depName,\n commitMessageTopic: '{{{depName}}} action',\n datasource: GithubTagsDatasource.id,\n versioning: dockerVersioning.id,\n depType: 'action',\n replaceString: valueString,\n autoReplaceStringTemplate: `${quote}{{depName}}${pathSuffix}@{{#if newDigest}}{{newDigest}}${quote}{{#if newValue}}${commentWs}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quote}{{/unless}}`,\n ...(isExplicitHostname\n ? detectDatasource(registryUrl)\n : customRegistryUrlsPackageDependency),\n };\n\n if (packageName !== depName) {\n dep.packageName = packageName;\n }\n\n if (\n commentData.pinnedVersion &&\n !is.undefined(commentData.index) &&\n !is.undefined(commentData.matchedString)\n ) {\n const cleanComment = parsed.commentString.slice(1);\n const matchEndIndex = commentData.index + commentData.matchedString.length;\n const commentSuffix = cleanComment.slice(0, matchEndIndex);\n dep.replaceString =\n valueString + commentPrecedingWhitespace + '#' + commentSuffix;\n } else if (commentData.ratchetExclude) {\n dep.replaceString =\n valueString + commentPrecedingWhitespace + parsed.commentString;\n }\n\n if (isSha(ref)) {\n dep.currentValue = commentData.pinnedVersion;\n dep.currentDigest = ref;\n } else if (isShortSha(ref)) {\n dep.currentValue = commentData.pinnedVersion;\n dep.currentDigestShort = ref;\n } else {\n dep.currentValue = ref;\n }\n\n return dep;\n}\n\nfunction extractWithRegex(\n content: string,\n config: ExtractConfig,\n): PackageDependency[] {\n const customRegistryUrlsPackageDependency =\n detectCustomGitHubRegistryUrlsForActions();\n logger.trace('github-actions.extractWithRegex()');\n const deps: PackageDependency[] = [];\n\n for (const line of content.split(newlineRegex)) {\n if (line.trim().startsWith('#')) {\n continue;\n }\n\n const parsed = parseUsesLine(line);\n if (!parsed?.actionRef) {\n continue;\n }\n\n const { actionRef } = parsed;\n\n if (actionRef.kind === 'docker') {\n deps.push(extractDockerAction(actionRef, config));\n continue;\n }\n\n if (actionRef.kind === 'repository') {\n deps.push(\n extractRepositoryAction(\n actionRef,\n parsed,\n customRegistryUrlsPackageDependency,\n ),\n );\n }\n }\n\n return deps;\n}\n\nfunction detectDatasource(registryUrl: string): PackageDependency {\n const platform = detectPlatform(registryUrl);\n\n switch (platform) {\n case 'forgejo':\n return {\n registryUrls: [registryUrl],\n datasource: ForgejoTagsDatasource.id,\n };\n case 'gitea':\n return {\n registryUrls: [registryUrl],\n datasource: GiteaTagsDatasource.id,\n };\n case 'github':\n return { registryUrls: [registryUrl] };\n }\n\n return {\n skipReason: 'unsupported-url',\n };\n}\n\nconst runnerVersionRegex = regEx(\n /^\\s*(?<depName>[a-zA-Z]+)-(?<currentValue>[^\\s]+)/,\n);\n\nfunction extractRunner(runner: string): PackageDependency | null {\n const runnerVersionGroups = runnerVersionRegex.exec(runner)?.groups;\n if (!runnerVersionGroups) {\n return null;\n }\n\n const { depName, currentValue } = runnerVersionGroups;\n\n if (!GithubRunnersDatasource.isValidRunner(depName, currentValue)) {\n return null;\n }\n\n const dependency: PackageDependency = {\n depName,\n currentValue,\n replaceString: `${depName}-${currentValue}`,\n depType: 'github-runner',\n datasource: GithubRunnersDatasource.id,\n autoReplaceStringTemplate: '{{depName}}-{{newValue}}',\n };\n\n if (!dockerVersioning.api.isValid(currentValue)) {\n dependency.skipReason = 'invalid-version';\n }\n\n return dependency;\n}\n\n// For official https://github.com/actions\nconst versionedActions: Record<string, string> = {\n go: npmVersioning.id,\n node: nodeVersioning.id,\n python: npmVersioning.id,\n\n // Not covered yet because they use different datasources/packageNames:\n // - dotnet\n // - java\n};\n\nfunction extractVersionedAction(step: Steps): PackageDependency | null {\n for (const [action, versioning] of Object.entries(versionedActions)) {\n const actionName = `actions/setup-${action}`;\n if (step.uses !== actionName && !step.uses?.startsWith(`${actionName}@`)) {\n continue;\n }\n\n const fieldName = `${action}-version`;\n const currentValue = step.with?.[fieldName];\n if (!currentValue) {\n return null;\n }\n\n return {\n datasource: GithubReleasesDatasource.id,\n depName: action,\n packageName: `actions/${action}-versions`,\n versioning,\n extractVersion: '^(?<version>\\\\d+\\\\.\\\\d+\\\\.\\\\d+)(-\\\\d+)?$',\n currentValue,\n depType: 'uses-with',\n };\n }\n return null;\n}\n\nfunction extractSteps(steps: Steps[]): PackageDependency[] {\n const deps: PackageDependency[] = [];\n\n for (const step of steps) {\n const res = CommunityActions.safeParse(step);\n if (res.success) {\n deps.push(res.data);\n continue;\n }\n\n const versionedDep = extractVersionedAction(step);\n if (versionedDep) {\n deps.push(versionedDep);\n }\n }\n\n return deps;\n}\n\nfunction extractWithYAMLParser(\n content: string,\n packageFile: string,\n config: ExtractConfig,\n): PackageDependency[] {\n logger.trace('github-actions.extractWithYAMLParser()');\n\n const obj = withMeta({ packageFile }, () => Workflow.parse(content));\n if (!obj) {\n return [];\n }\n\n if ('runs' in obj && obj.runs.steps) {\n return extractSteps(obj.runs.steps);\n }\n\n if (!('jobs' in obj)) {\n return [];\n }\n\n const deps: PackageDependency[] = [];\n\n for (const job of Object.values(obj.jobs)) {\n if (job.container) {\n const dep = getDep(job.container, true, config.registryAliases);\n if (dep) {\n dep.depType = 'container';\n deps.push(dep);\n }\n }\n\n for (const service of job.services) {\n const dep = getDep(service, true, config.registryAliases);\n if (dep) {\n dep.depType = 'service';\n deps.push(dep);\n }\n }\n\n for (const runner of job['runs-on']) {\n const dep = extractRunner(runner);\n if (dep) {\n deps.push(dep);\n }\n }\n\n deps.push(...extractSteps(job.steps));\n }\n\n return deps;\n}\n\nexport function extractPackageFile(\n content: string,\n packageFile: string,\n config: ExtractConfig = {}, // TODO: enforce ExtractConfig\n): PackageFileContent | null {\n logger.trace(`github-actions.extractPackageFile(${packageFile})`);\n\n const deps = [\n ...extractWithRegex(content, config),\n ...extractWithYAMLParser(content, packageFile, config),\n ];\n\n if (!deps.length) {\n return null;\n }\n\n return { deps };\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
interface QuotedValue {
|
|
2
|
+
value: string;
|
|
3
|
+
quote: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function parseQuote(input: string): QuotedValue;
|
|
6
|
+
/**
|
|
7
|
+
* Docker container:
|
|
8
|
+
* - `docker://image:tag`
|
|
9
|
+
* - `docker://image@digest`
|
|
10
|
+
* - `docker://image:tag@digest`
|
|
11
|
+
*/
|
|
12
|
+
export interface DockerReference {
|
|
13
|
+
kind: 'docker';
|
|
14
|
+
image: string;
|
|
15
|
+
tag?: string;
|
|
16
|
+
digest?: string;
|
|
17
|
+
originalRef: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Local file or directory:
|
|
21
|
+
* - `./path/to/action`
|
|
22
|
+
* - `./.github/workflows/main.yml`
|
|
23
|
+
*/
|
|
24
|
+
export interface LocalReference {
|
|
25
|
+
kind: 'local';
|
|
26
|
+
path: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Repository:
|
|
30
|
+
* - `owner/repo[/path]@ref`
|
|
31
|
+
* - `https://host/owner/repo[/path]@ref`
|
|
32
|
+
*/
|
|
33
|
+
export interface RepositoryReference {
|
|
34
|
+
kind: 'repository';
|
|
35
|
+
hostname: string;
|
|
36
|
+
isExplicitHostname: boolean;
|
|
37
|
+
owner: string;
|
|
38
|
+
repo: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
ref: string;
|
|
41
|
+
}
|
|
42
|
+
export type ActionReference = DockerReference | LocalReference | RepositoryReference;
|
|
43
|
+
export interface ParsedUsesLine {
|
|
44
|
+
/** The whitespace before "uses:" */
|
|
45
|
+
indentation: string;
|
|
46
|
+
/** The `uses:` (and optional `-`) part */
|
|
47
|
+
usesPrefix: string;
|
|
48
|
+
/** The raw value part, potentially quoted (e.g. `actions/checkout@v2`) */
|
|
49
|
+
replaceString: string;
|
|
50
|
+
/** Whitespace between value and `#` */
|
|
51
|
+
commentPrecedingWhitespace: string;
|
|
52
|
+
/** The full comment including `#` */
|
|
53
|
+
commentString: string;
|
|
54
|
+
actionRef: ActionReference | null;
|
|
55
|
+
commentData: CommentData;
|
|
56
|
+
/** The quote char used (' or " or empty) */
|
|
57
|
+
quote: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function isSha(str: string): boolean;
|
|
60
|
+
export declare function isShortSha(str: string): boolean;
|
|
61
|
+
export declare function parseActionReference(uses: string): ActionReference | null;
|
|
62
|
+
export interface CommentData {
|
|
63
|
+
pinnedVersion?: string;
|
|
64
|
+
ratchetExclude?: boolean;
|
|
65
|
+
matchedString?: string;
|
|
66
|
+
index?: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function parseComment(commentBody: string): CommentData;
|
|
69
|
+
export declare function parseUsesLine(line: string): ParsedUsesLine | null;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseQuote = parseQuote;
|
|
4
|
+
exports.isSha = isSha;
|
|
5
|
+
exports.isShortSha = isShortSha;
|
|
6
|
+
exports.parseActionReference = parseActionReference;
|
|
7
|
+
exports.parseComment = parseComment;
|
|
8
|
+
exports.parseUsesLine = parseUsesLine;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
|
11
|
+
const regex_1 = require("../../../util/regex");
|
|
12
|
+
function splitFirstFrom(str, sep, start) {
|
|
13
|
+
const idx = str.indexOf(sep, start);
|
|
14
|
+
if (idx === -1) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return [str.slice(0, idx), str.slice(idx + sep.length)];
|
|
18
|
+
}
|
|
19
|
+
function splitFirst(str, sep) {
|
|
20
|
+
return splitFirstFrom(str, sep, 0);
|
|
21
|
+
}
|
|
22
|
+
function parseQuote(input) {
|
|
23
|
+
const trimmed = input.trim();
|
|
24
|
+
const first = trimmed[0];
|
|
25
|
+
const last = trimmed[trimmed.length - 1];
|
|
26
|
+
if (trimmed.length >= 2 &&
|
|
27
|
+
first === last &&
|
|
28
|
+
(first === '"' || first === "'")) {
|
|
29
|
+
return { value: trimmed.slice(1, -1), quote: first };
|
|
30
|
+
}
|
|
31
|
+
return { value: trimmed, quote: '' };
|
|
32
|
+
}
|
|
33
|
+
const shaRe = (0, regex_1.regEx)(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);
|
|
34
|
+
const shaShortRe = (0, regex_1.regEx)(/^[a-f0-9]{6,7}$/);
|
|
35
|
+
function isSha(str) {
|
|
36
|
+
return shaRe.test(str);
|
|
37
|
+
}
|
|
38
|
+
function isShortSha(str) {
|
|
39
|
+
return shaShortRe.test(str);
|
|
40
|
+
}
|
|
41
|
+
const DOCKER_PREFIX = 'docker://';
|
|
42
|
+
function parseDockerReference(input) {
|
|
43
|
+
const originalRef = input.slice(DOCKER_PREFIX.length);
|
|
44
|
+
if (!originalRef) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const digestParts = splitFirst(originalRef, '@');
|
|
48
|
+
if (digestParts) {
|
|
49
|
+
const [image, digest] = digestParts;
|
|
50
|
+
return { kind: 'docker', image, digest, originalRef };
|
|
51
|
+
}
|
|
52
|
+
// Find tag: look for first colon after last slash (to avoid matching port in registry)
|
|
53
|
+
const lastSlashIndex = originalRef.lastIndexOf('/');
|
|
54
|
+
const searchStart = lastSlashIndex === -1 ? 0 : lastSlashIndex + 1;
|
|
55
|
+
const tagParts = splitFirstFrom(originalRef, ':', searchStart);
|
|
56
|
+
if (tagParts) {
|
|
57
|
+
const [image, tag] = tagParts;
|
|
58
|
+
return { kind: 'docker', image, tag, originalRef };
|
|
59
|
+
}
|
|
60
|
+
return { kind: 'docker', image: originalRef, originalRef };
|
|
61
|
+
}
|
|
62
|
+
const repositoryActionRegex = (0, regex_1.regEx)(/^(?:https:\/\/(?<hostname>[^/]+)\/)?(?<owner>[^/]+)\/(?<repo>[^/]+)(?:\/(?<path>.+?))?@(?<ref>.+)$/);
|
|
63
|
+
function parseRepositoryReference(input) {
|
|
64
|
+
const match = repositoryActionRegex.exec(input);
|
|
65
|
+
if (!match?.groups) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const { owner, repo, path, ref } = match.groups;
|
|
69
|
+
let { hostname } = match.groups;
|
|
70
|
+
let isExplicitHostname = true;
|
|
71
|
+
if (is_1.default.undefined(hostname)) {
|
|
72
|
+
hostname = 'github.com';
|
|
73
|
+
isExplicitHostname = false;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
kind: 'repository',
|
|
77
|
+
hostname,
|
|
78
|
+
isExplicitHostname,
|
|
79
|
+
owner,
|
|
80
|
+
repo,
|
|
81
|
+
path,
|
|
82
|
+
ref,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function parseActionReference(uses) {
|
|
86
|
+
if (!uses) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (uses.startsWith(DOCKER_PREFIX)) {
|
|
90
|
+
return parseDockerReference(uses);
|
|
91
|
+
}
|
|
92
|
+
if (uses.startsWith('./') || uses.startsWith('../')) {
|
|
93
|
+
return { kind: 'local', path: uses };
|
|
94
|
+
}
|
|
95
|
+
return parseRepositoryReference(uses);
|
|
96
|
+
}
|
|
97
|
+
// Matches version strings with optional prefixes, e.g.:
|
|
98
|
+
// - "@v1.2.3", "v1.2.3", "1.2.3"
|
|
99
|
+
// - "renovate: pin @v1.2.3", "tag=v1.2.3"
|
|
100
|
+
// - "ratchet:owner/repo@v1.2.3"
|
|
101
|
+
// - "stable/v1.2.3", "stable-v1.2.3"
|
|
102
|
+
const pinnedVersionRe = (0, regex_1.regEx)(/^\s*(?:(?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+))?@?(?<version>([\w-]*[-/])?v?\d+(?:\.\d+(?:\.\d+)?)?)/);
|
|
103
|
+
function parseComment(commentBody) {
|
|
104
|
+
const trimmed = commentBody.trim();
|
|
105
|
+
if (trimmed === 'ratchet:exclude') {
|
|
106
|
+
return { ratchetExclude: true };
|
|
107
|
+
}
|
|
108
|
+
// We use commentBody (with leading spaces) to get the correct index relative to the comment start
|
|
109
|
+
const match = pinnedVersionRe.exec(commentBody);
|
|
110
|
+
if (match?.groups?.version) {
|
|
111
|
+
return {
|
|
112
|
+
pinnedVersion: match.groups.version,
|
|
113
|
+
matchedString: match[0],
|
|
114
|
+
index: match.index,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
const usesLineRegex = (0, regex_1.regEx)(/^(?<prefix>\s+(?:-\s+)?uses\s*:\s*)(?<remainder>.+)$/);
|
|
120
|
+
function parseUsesLine(line) {
|
|
121
|
+
const match = usesLineRegex.exec(line);
|
|
122
|
+
if (!match?.groups) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const { prefix, remainder } = match.groups;
|
|
126
|
+
if (remainder.startsWith('#')) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const indentation = prefix.slice(0, prefix.indexOf('uses'));
|
|
130
|
+
// We look for ' #' to determine where the comment starts.
|
|
131
|
+
// This is a safe heuristic for valid "uses" values which cannot contain spaces.
|
|
132
|
+
const commentIndex = remainder.indexOf(' #');
|
|
133
|
+
// No comment case
|
|
134
|
+
if (commentIndex === -1) {
|
|
135
|
+
const { value, quote } = parseQuote(remainder);
|
|
136
|
+
return {
|
|
137
|
+
indentation,
|
|
138
|
+
usesPrefix: prefix,
|
|
139
|
+
replaceString: remainder.trim(),
|
|
140
|
+
commentPrecedingWhitespace: '',
|
|
141
|
+
commentString: '',
|
|
142
|
+
actionRef: parseActionReference(value),
|
|
143
|
+
commentData: {},
|
|
144
|
+
quote,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// Has comment: split value and comment
|
|
148
|
+
const rawValuePart = remainder.slice(0, commentIndex);
|
|
149
|
+
const commentPart = remainder.slice(commentIndex + 1); // starts at #
|
|
150
|
+
// Calculate whitespace between value and #
|
|
151
|
+
const partBeforeHash = remainder.slice(0, commentIndex + 1);
|
|
152
|
+
const commentPrecedingWhitespace = partBeforeHash.slice(partBeforeHash.trimEnd().length);
|
|
153
|
+
const { value, quote } = parseQuote(rawValuePart);
|
|
154
|
+
// commentPart always starts with '#' since we found ' #' and sliced after the space
|
|
155
|
+
const cleanCommentBody = commentPart.slice(1);
|
|
156
|
+
return {
|
|
157
|
+
indentation,
|
|
158
|
+
usesPrefix: prefix,
|
|
159
|
+
replaceString: rawValuePart.trim(),
|
|
160
|
+
commentPrecedingWhitespace,
|
|
161
|
+
commentString: commentPart,
|
|
162
|
+
actionRef: parseActionReference(value),
|
|
163
|
+
commentData: parseComment(cleanCommentBody),
|
|
164
|
+
quote,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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tC,WAAW,EAAE,YAAY,CAAC,gBAAgB,CAAC;QAC3C,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { regEx } from '../../../util/regex';\n\nfunction splitFirstFrom(\n str: string,\n sep: string,\n start: number,\n): [string, string] | null {\n const idx = str.indexOf(sep, start);\n if (idx === -1) {\n return null;\n }\n return [str.slice(0, idx), str.slice(idx + sep.length)];\n}\n\nfunction splitFirst(str: string, sep: string): [string, string] | null {\n return splitFirstFrom(str, sep, 0);\n}\n\ninterface QuotedValue {\n value: string;\n quote: string;\n}\n\nexport function parseQuote(input: string): QuotedValue {\n const trimmed = input.trim();\n const first = trimmed[0];\n const last = trimmed[trimmed.length - 1];\n\n if (\n trimmed.length >= 2 &&\n first === last &&\n (first === '\"' || first === \"'\")\n ) {\n return { value: trimmed.slice(1, -1), quote: first };\n }\n\n return { value: trimmed, quote: '' };\n}\n\n/**\n * Docker container:\n * - `docker://image:tag`\n * - `docker://image@digest`\n * - `docker://image:tag@digest`\n */\nexport interface DockerReference {\n kind: 'docker';\n image: string;\n tag?: string;\n digest?: string;\n originalRef: string;\n}\n\n/**\n * Local file or directory:\n * - `./path/to/action`\n * - `./.github/workflows/main.yml`\n */\nexport interface LocalReference {\n kind: 'local';\n path: string;\n}\n\n/**\n * Repository:\n * - `owner/repo[/path]@ref`\n * - `https://host/owner/repo[/path]@ref`\n */\nexport interface RepositoryReference {\n kind: 'repository';\n\n hostname: string;\n isExplicitHostname: boolean;\n\n owner: string;\n repo: string;\n path?: string;\n\n ref: string;\n}\n\nexport type ActionReference =\n | DockerReference\n | LocalReference\n | RepositoryReference;\n\nexport interface ParsedUsesLine {\n /** The whitespace before \"uses:\" */\n indentation: string;\n\n /** The `uses:` (and optional `-`) part */\n usesPrefix: string;\n\n /** The raw value part, potentially quoted (e.g. `actions/checkout@v2`) */\n replaceString: string;\n\n /** Whitespace between value and `#` */\n commentPrecedingWhitespace: string;\n\n /** The full comment including `#` */\n commentString: string;\n\n actionRef: ActionReference | null;\n commentData: CommentData;\n\n /** The quote char used (' or \" or empty) */\n quote: string;\n}\n\nconst shaRe = regEx(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);\nconst shaShortRe = regEx(/^[a-f0-9]{6,7}$/);\n\nexport function isSha(str: string): boolean {\n return shaRe.test(str);\n}\n\nexport function isShortSha(str: string): boolean {\n return shaShortRe.test(str);\n}\n\nconst DOCKER_PREFIX = 'docker://';\n\nfunction parseDockerReference(input: string): DockerReference | null {\n const originalRef = input.slice(DOCKER_PREFIX.length);\n if (!originalRef) {\n return null;\n }\n\n const digestParts = splitFirst(originalRef, '@');\n if (digestParts) {\n const [image, digest] = digestParts;\n return { kind: 'docker', image, digest, originalRef };\n }\n\n // Find tag: look for first colon after last slash (to avoid matching port in registry)\n const lastSlashIndex = originalRef.lastIndexOf('/');\n const searchStart = lastSlashIndex === -1 ? 0 : lastSlashIndex + 1;\n const tagParts = splitFirstFrom(originalRef, ':', searchStart);\n\n if (tagParts) {\n const [image, tag] = tagParts;\n return { kind: 'docker', image, tag, originalRef };\n }\n\n return { kind: 'docker', image: originalRef, originalRef };\n}\n\nconst repositoryActionRegex = regEx(\n /^(?:https:\\/\\/(?<hostname>[^/]+)\\/)?(?<owner>[^/]+)\\/(?<repo>[^/]+)(?:\\/(?<path>.+?))?@(?<ref>.+)$/,\n);\n\nfunction parseRepositoryReference(input: string): RepositoryReference | null {\n const match = repositoryActionRegex.exec(input);\n if (!match?.groups) {\n return null;\n }\n\n const { owner, repo, path, ref } = match.groups;\n\n let { hostname } = match.groups;\n let isExplicitHostname = true;\n if (is.undefined(hostname)) {\n hostname = 'github.com';\n isExplicitHostname = false;\n }\n\n return {\n kind: 'repository',\n hostname,\n isExplicitHostname,\n owner,\n repo,\n path,\n ref,\n };\n}\n\nexport function parseActionReference(uses: string): ActionReference | null {\n if (!uses) {\n return null;\n }\n\n if (uses.startsWith(DOCKER_PREFIX)) {\n return parseDockerReference(uses);\n }\n\n if (uses.startsWith('./') || uses.startsWith('../')) {\n return { kind: 'local', path: uses };\n }\n\n return parseRepositoryReference(uses);\n}\n\nexport interface CommentData {\n pinnedVersion?: string;\n ratchetExclude?: boolean;\n matchedString?: string;\n index?: number;\n}\n\n// Matches version strings with optional prefixes, e.g.:\n// - \"@v1.2.3\", \"v1.2.3\", \"1.2.3\"\n// - \"renovate: pin @v1.2.3\", \"tag=v1.2.3\"\n// - \"ratchet:owner/repo@v1.2.3\"\n// - \"stable/v1.2.3\", \"stable-v1.2.3\"\nconst pinnedVersionRe = regEx(\n /^\\s*(?:(?:renovate\\s*:\\s*)?(?:pin\\s+|tag\\s*=\\s*)?|(?:ratchet:[\\w-]+\\/[.\\w-]+))?@?(?<version>([\\w-]*[-/])?v?\\d+(?:\\.\\d+(?:\\.\\d+)?)?)/,\n);\n\nexport function parseComment(commentBody: string): CommentData {\n const trimmed = commentBody.trim();\n if (trimmed === 'ratchet:exclude') {\n return { ratchetExclude: true };\n }\n\n // We use commentBody (with leading spaces) to get the correct index relative to the comment start\n const match = pinnedVersionRe.exec(commentBody);\n if (match?.groups?.version) {\n return {\n pinnedVersion: match.groups.version,\n matchedString: match[0],\n index: match.index,\n };\n }\n\n return {};\n}\n\nconst usesLineRegex = regEx(\n /^(?<prefix>\\s+(?:-\\s+)?uses\\s*:\\s*)(?<remainder>.+)$/,\n);\n\nexport function parseUsesLine(line: string): ParsedUsesLine | null {\n const match = usesLineRegex.exec(line);\n if (!match?.groups) {\n return null;\n }\n\n const { prefix, remainder } = match.groups;\n\n if (remainder.startsWith('#')) {\n return null;\n }\n\n const indentation = prefix.slice(0, prefix.indexOf('uses'));\n\n // We look for ' #' to determine where the comment starts.\n // This is a safe heuristic for valid \"uses\" values which cannot contain spaces.\n const commentIndex = remainder.indexOf(' #');\n\n // No comment case\n if (commentIndex === -1) {\n const { value, quote } = parseQuote(remainder);\n return {\n indentation,\n usesPrefix: prefix,\n replaceString: remainder.trim(),\n commentPrecedingWhitespace: '',\n commentString: '',\n actionRef: parseActionReference(value),\n commentData: {},\n quote,\n };\n }\n\n // Has comment: split value and comment\n const rawValuePart = remainder.slice(0, commentIndex);\n const commentPart = remainder.slice(commentIndex + 1); // starts at #\n\n // Calculate whitespace between value and #\n const partBeforeHash = remainder.slice(0, commentIndex + 1);\n const commentPrecedingWhitespace = partBeforeHash.slice(\n partBeforeHash.trimEnd().length,\n );\n\n const { value, quote } = parseQuote(rawValuePart);\n // commentPart always starts with '#' since we found ' #' and sliced after the space\n const cleanCommentBody = commentPart.slice(1);\n\n return {\n indentation,\n usesPrefix: prefix,\n replaceString: rawValuePart.trim(),\n commentPrecedingWhitespace,\n commentString: commentPart,\n actionRef: parseActionReference(value),\n commentData: parseComment(cleanCommentBody),\n quote,\n };\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ExecResult, RawExecOptions } from './types';
|
|
2
|
-
export declare function exec(
|
|
2
|
+
export declare function exec(theCmd: string, opts: RawExecOptions): Promise<ExecResult>;
|
|
3
3
|
export declare const rawExec: (cmd: string, opts: RawExecOptions) => Promise<ExecResult>;
|
package/dist/util/exec/common.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.rawExec = void 0;
|
|
|
4
4
|
exports.exec = exec;
|
|
5
5
|
const is_1 = require("@sindresorhus/is");
|
|
6
6
|
const execa_1 = require("execa");
|
|
7
|
+
const shlex_1 = require("shlex");
|
|
7
8
|
const instrumentation_1 = require("../../instrumentation");
|
|
8
9
|
const env_1 = require("../env");
|
|
9
10
|
const sanitize_1 = require("../sanitize");
|
|
@@ -65,15 +66,27 @@ function registerDataListeners(readable, dataListeners) {
|
|
|
65
66
|
readable.on('data', listener);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
function exec(
|
|
69
|
+
function exec(theCmd, opts) {
|
|
69
70
|
return new Promise((resolve, reject) => {
|
|
71
|
+
let cmd = theCmd;
|
|
72
|
+
let args = [];
|
|
70
73
|
const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024; // Set default max buffer size to 10MB
|
|
71
|
-
|
|
74
|
+
// don't use shell by default, as it leads to potential security issues
|
|
75
|
+
const shell = opts.shell ?? false;
|
|
76
|
+
// if we're not in shell mode, we need to provide the command and arguments
|
|
77
|
+
if (shell === false) {
|
|
78
|
+
const parts = (0, shlex_1.split)(cmd);
|
|
79
|
+
if (parts) {
|
|
80
|
+
cmd = parts[0];
|
|
81
|
+
args = parts.slice(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const cp = (0, execa_1.execa)(cmd, args, {
|
|
72
85
|
...opts,
|
|
73
86
|
// force detached on non WIN platforms
|
|
74
87
|
// https://github.com/nodejs/node/issues/21825#issuecomment-611328888
|
|
75
88
|
detached: process.platform !== 'win32',
|
|
76
|
-
shell
|
|
89
|
+
shell,
|
|
77
90
|
});
|
|
78
91
|
// handle streams
|
|
79
92
|
const [stdout, stderr] = initStreamListeners(cp, {
|
|
@@ -92,14 +105,14 @@ function exec(cmd, opts) {
|
|
|
92
105
|
}
|
|
93
106
|
if (signal) {
|
|
94
107
|
kill(cp, signal);
|
|
95
|
-
reject(new exec_error_1.ExecError(`Command failed: ${
|
|
108
|
+
reject(new exec_error_1.ExecError(`Command failed: ${cp.spawnargs.join(' ')}\nInterrupted by ${signal}`, {
|
|
96
109
|
...rejectInfo(),
|
|
97
110
|
signal,
|
|
98
111
|
}));
|
|
99
112
|
return;
|
|
100
113
|
}
|
|
101
114
|
if (code !== 0) {
|
|
102
|
-
reject(new exec_error_1.ExecError(`Command failed: ${
|
|
115
|
+
reject(new exec_error_1.ExecError(`Command failed: ${cp.spawnargs.join(' ')}\n${stringify(stderr)}`, {
|
|
103
116
|
...rejectInfo(),
|
|
104
117
|
exitCode: code,
|
|
105
118
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../lib/util/exec/common.ts"],"names":[],"mappings":";;;AAiFA,oBA8DC;AA7ID,yCAAqD;AACrD,iCAA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AS,CAAC,MAAM,CAAC;aAC1B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,SAAS,UAAU;YACjB,OAAO;gBACL,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC3B,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC;gBACzB,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC;aAC1B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI,CAAC,EAAgB,EAAE,MAAsB;IACpD,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,GAAG,IAAI,IAAA,YAAM,GAAE,CAAC,2BAA2B,EAAE,CAAC;YACnD;;;;;eAKG;YACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,+CAA+C;YAC/C,4DAA4D;YAC5D,8GAA8G;YAC9G,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;QAChF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEM,MAAM,OAAO,GAGO,CAAC,GAAW,EAAE,IAAoB,EAAE,EAAE,CAC/D,IAAA,4BAAU,EAAC,YAAY,IAAA,mBAAQ,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAJpD,QAAA,OAAO,WAI6C","sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport type { Readable } from 'node:stream';\nimport { isNullOrUndefined } from '@sindresorhus/is';\nimport { execa } from 'execa';\nimport { instrument } from '../../instrumentation';\nimport { getEnv } from '../env';\nimport { sanitize } from '../sanitize';\nimport type { ExecErrorData } from './exec-error';\nimport { ExecError } from './exec-error';\nimport type { DataListener, ExecResult, RawExecOptions } from './types';\n\n// https://man7.org/linux/man-pages/man7/signal.7.html#NAME\n// Non TERM/CORE signals\n// The following is step 3. in https://github.com/renovatebot/renovate/issues/16197#issuecomment-1171423890\nconst NONTERM = [\n 'SIGCHLD',\n 'SIGCLD',\n 'SIGCONT',\n 'SIGSTOP',\n 'SIGTSTP',\n 'SIGTTIN',\n 'SIGTTOU',\n 'SIGURG',\n 'SIGWINCH',\n];\n\nconst encoding = 'utf8';\n\nfunction stringify(list: Buffer[]): string {\n return Buffer.concat(list).toString(encoding);\n}\n\nfunction initStreamListeners(\n cp: ChildProcess,\n opts: RawExecOptions & { maxBuffer: number },\n): [Buffer[], Buffer[]] {\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n let stdoutLen = 0;\n let stderrLen = 0;\n\n registerDataListeners(cp.stdout, opts.outputListeners?.stdout);\n registerDataListeners(cp.stderr, opts.outputListeners?.stderr);\n\n cp.stdout?.on('data', (chunk: Buffer) => {\n // process.stdout.write(data.toString());\n const len = Buffer.byteLength(chunk, encoding);\n stdoutLen += len;\n if (stdoutLen > opts.maxBuffer) {\n cp.emit('error', new Error('stdout maxBuffer exceeded'));\n } else {\n stdout.push(chunk);\n }\n });\n\n cp.stderr?.on('data', (chunk: Buffer) => {\n // process.stderr.write(data.toString());\n const len = Buffer.byteLength(chunk, encoding);\n stderrLen += len;\n if (stderrLen > opts.maxBuffer) {\n cp.emit('error', new Error('stderr maxBuffer exceeded'));\n } else {\n stderr.push(chunk);\n }\n });\n return [stdout, stderr];\n}\n\nfunction registerDataListeners(\n readable: Readable | null,\n dataListeners: DataListener[] | undefined,\n): void {\n if (isNullOrUndefined(readable) || isNullOrUndefined(dataListeners)) {\n return;\n }\n\n for (const listener of dataListeners) {\n readable.on('data', listener);\n }\n}\n\nexport function exec(cmd: string, opts: RawExecOptions): Promise<ExecResult> {\n return new Promise((resolve, reject) => {\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024; // Set default max buffer size to 10MB\n const cp = execa(cmd, {\n ...opts,\n // force detached on non WIN platforms\n // https://github.com/nodejs/node/issues/21825#issuecomment-611328888\n detached: process.platform !== 'win32',\n shell: typeof opts.shell === 'string' ? opts.shell : true, // force shell\n });\n\n // handle streams\n const [stdout, stderr] = initStreamListeners(cp, {\n ...opts,\n maxBuffer,\n });\n\n // handle process events\n void cp.on('error', (error) => {\n kill(cp, 'SIGTERM');\n // rethrowing, use originally emitted error message\n reject(new ExecError(error.message, rejectInfo(), error));\n });\n\n void cp.on('exit', (code: number, signal: NodeJS.Signals) => {\n if (NONTERM.includes(signal)) {\n return;\n }\n if (signal) {\n kill(cp, signal);\n reject(\n new ExecError(`Command failed: ${cmd}\\nInterrupted by ${signal}`, {\n ...rejectInfo(),\n signal,\n }),\n );\n return;\n }\n if (code !== 0) {\n reject(\n new ExecError(`Command failed: ${cmd}\\n${stringify(stderr)}`, {\n ...rejectInfo(),\n exitCode: code,\n }),\n );\n return;\n }\n resolve({\n stderr: stringify(stderr),\n stdout: stringify(stdout),\n });\n });\n\n function rejectInfo(): ExecErrorData {\n return {\n cmd: cp.spawnargs.join(' '),\n options: opts,\n stdout: stringify(stdout),\n stderr: stringify(stderr),\n };\n }\n });\n}\n\nfunction kill(cp: ChildProcess, signal: NodeJS.Signals): boolean {\n try {\n if (cp.pid && getEnv().RENOVATE_X_EXEC_GPID_HANDLE) {\n /**\n * If `pid` is negative, but not `-1`, signal shall be sent to all processes\n * (excluding an unspecified set of system processes),\n * whose process group ID (pgid) is equal to the absolute value of pid,\n * and for which the process has permission to send a signal.\n */\n return process.kill(-cp.pid, signal);\n } else {\n // destroying stdio is needed for unref to work\n // https://nodejs.org/api/child_process.html#subprocessunref\n // https://github.com/nodejs/node/blob/4d5ff25a813fd18939c9f76b17e36291e3ea15c3/lib/child_process.js#L412-L426\n cp.stderr?.destroy();\n cp.stdout?.destroy();\n cp.unref();\n return cp.kill(signal);\n }\n } catch {\n // cp is a single node tree, therefore -pid is invalid as there is no such pgid,\n return false;\n }\n}\n\nexport const rawExec: (\n cmd: string,\n opts: RawExecOptions,\n) => Promise<ExecResult> = (cmd: string, opts: RawExecOptions) =>\n instrument(`rawExec: ${sanitize(cmd)}`, () => exec(cmd, opts));\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../lib/util/exec/common.ts"],"names":[],"mappings":";;;AAkFA,oBAqFC;AArKD,yCAAqD;AACrD,iCAA8B;AAC9B,iCAA8B;AAC9B,2DAAmD;AACnD,gCAAgC;AAChC,0CAAuC;AAEvC,6CAAyC;AAGzC,2DAA2D;AAC3D,wBAAwB;AACxB,2GAA2G;AAC3G,MAAM,OAAO,GAAG;IACd,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;CACX,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB,SAAS,SAAS,CAAC,IAAc;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAC1B,EAAgB,EAChB,IAA4C;IAE5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC/D,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAE/D,EAAE,CA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,EAAE,CAAC,GAAG,IAAI,IAAA,YAAM,GAAE,CAAC,2BAA2B,EAAE,CAAC;YACnD;;;;;eAKG;YACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,+CAA+C;YAC/C,4DAA4D;YAC5D,8GAA8G;YAC9G,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;QAChF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEM,MAAM,OAAO,GAGO,CAAC,GAAW,EAAE,IAAoB,EAAE,EAAE,CAC/D,IAAA,4BAAU,EAAC,YAAY,IAAA,mBAAQ,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAJpD,QAAA,OAAO,WAI6C","sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport type { Readable } from 'node:stream';\nimport { isNullOrUndefined } from '@sindresorhus/is';\nimport { execa } from 'execa';\nimport { split } from 'shlex';\nimport { instrument } from '../../instrumentation';\nimport { getEnv } from '../env';\nimport { sanitize } from '../sanitize';\nimport type { ExecErrorData } from './exec-error';\nimport { ExecError } from './exec-error';\nimport type { DataListener, ExecResult, RawExecOptions } from './types';\n\n// https://man7.org/linux/man-pages/man7/signal.7.html#NAME\n// Non TERM/CORE signals\n// The following is step 3. in https://github.com/renovatebot/renovate/issues/16197#issuecomment-1171423890\nconst NONTERM = [\n 'SIGCHLD',\n 'SIGCLD',\n 'SIGCONT',\n 'SIGSTOP',\n 'SIGTSTP',\n 'SIGTTIN',\n 'SIGTTOU',\n 'SIGURG',\n 'SIGWINCH',\n];\n\nconst encoding = 'utf8';\n\nfunction stringify(list: Buffer[]): string {\n return Buffer.concat(list).toString(encoding);\n}\n\nfunction initStreamListeners(\n cp: ChildProcess,\n opts: RawExecOptions & { maxBuffer: number },\n): [Buffer[], Buffer[]] {\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n let stdoutLen = 0;\n let stderrLen = 0;\n\n registerDataListeners(cp.stdout, opts.outputListeners?.stdout);\n registerDataListeners(cp.stderr, opts.outputListeners?.stderr);\n\n cp.stdout?.on('data', (chunk: Buffer) => {\n // process.stdout.write(data.toString());\n const len = Buffer.byteLength(chunk, encoding);\n stdoutLen += len;\n if (stdoutLen > opts.maxBuffer) {\n cp.emit('error', new Error('stdout maxBuffer exceeded'));\n } else {\n stdout.push(chunk);\n }\n });\n\n cp.stderr?.on('data', (chunk: Buffer) => {\n // process.stderr.write(data.toString());\n const len = Buffer.byteLength(chunk, encoding);\n stderrLen += len;\n if (stderrLen > opts.maxBuffer) {\n cp.emit('error', new Error('stderr maxBuffer exceeded'));\n } else {\n stderr.push(chunk);\n }\n });\n return [stdout, stderr];\n}\n\nfunction registerDataListeners(\n readable: Readable | null,\n dataListeners: DataListener[] | undefined,\n): void {\n if (isNullOrUndefined(readable) || isNullOrUndefined(dataListeners)) {\n return;\n }\n\n for (const listener of dataListeners) {\n readable.on('data', listener);\n }\n}\n\nexport function exec(\n theCmd: string,\n opts: RawExecOptions,\n): Promise<ExecResult> {\n return new Promise((resolve, reject) => {\n let cmd = theCmd;\n let args: string[] = [];\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024; // Set default max buffer size to 10MB\n\n // don't use shell by default, as it leads to potential security issues\n const shell = opts.shell ?? false;\n // if we're not in shell mode, we need to provide the command and arguments\n if (shell === false) {\n const parts = split(cmd);\n if (parts) {\n cmd = parts[0];\n args = parts.slice(1);\n }\n }\n\n const cp = execa(cmd, args, {\n ...opts,\n // force detached on non WIN platforms\n // https://github.com/nodejs/node/issues/21825#issuecomment-611328888\n detached: process.platform !== 'win32',\n shell,\n });\n\n // handle streams\n const [stdout, stderr] = initStreamListeners(cp, {\n ...opts,\n maxBuffer,\n });\n\n // handle process events\n void cp.on('error', (error) => {\n kill(cp, 'SIGTERM');\n // rethrowing, use originally emitted error message\n reject(new ExecError(error.message, rejectInfo(), error));\n });\n\n void cp.on('exit', (code: number, signal: NodeJS.Signals) => {\n if (NONTERM.includes(signal)) {\n return;\n }\n if (signal) {\n kill(cp, signal);\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\nInterrupted by ${signal}`,\n {\n ...rejectInfo(),\n signal,\n },\n ),\n );\n return;\n }\n if (code !== 0) {\n reject(\n new ExecError(\n `Command failed: ${cp.spawnargs.join(' ')}\\n${stringify(stderr)}`,\n {\n ...rejectInfo(),\n exitCode: code,\n },\n ),\n );\n return;\n }\n resolve({\n stderr: stringify(stderr),\n stdout: stringify(stdout),\n });\n });\n\n function rejectInfo(): ExecErrorData {\n return {\n cmd: cp.spawnargs.join(' '),\n options: opts,\n stdout: stringify(stdout),\n stderr: stringify(stderr),\n };\n }\n });\n}\n\nfunction kill(cp: ChildProcess, signal: NodeJS.Signals): boolean {\n try {\n if (cp.pid && getEnv().RENOVATE_X_EXEC_GPID_HANDLE) {\n /**\n * If `pid` is negative, but not `-1`, signal shall be sent to all processes\n * (excluding an unspecified set of system processes),\n * whose process group ID (pgid) is equal to the absolute value of pid,\n * and for which the process has permission to send a signal.\n */\n return process.kill(-cp.pid, signal);\n } else {\n // destroying stdio is needed for unref to work\n // https://nodejs.org/api/child_process.html#subprocessunref\n // https://github.com/nodejs/node/blob/4d5ff25a813fd18939c9f76b17e36291e3ea15c3/lib/child_process.js#L412-L426\n cp.stderr?.destroy();\n cp.stdout?.destroy();\n cp.unref();\n return cp.kill(signal);\n }\n } catch {\n // cp is a single node tree, therefore -pid is invalid as there is no such pgid,\n return false;\n }\n}\n\nexport const rawExec: (\n cmd: string,\n opts: RawExecOptions,\n) => Promise<ExecResult> = (cmd: string, opts: RawExecOptions) =>\n instrument(`rawExec: ${sanitize(cmd)}`, () => exec(cmd, opts));\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/util/exec/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Options as ExecaOptions } from 'execa';\n\nexport interface ToolConstraint {\n toolName: string;\n constraint?: string | null;\n}\n\nexport interface ToolConfig {\n datasource: string;\n extractVersion?: string;\n packageName: string;\n hash?: boolean;\n versioning: string;\n}\n\nexport type Opt<T> = T | null | undefined;\n\nexport type VolumesPair = [string, string];\nexport type VolumeOption = Opt<string | VolumesPair>;\n\nexport interface DockerOptions {\n volumes?: Opt<VolumeOption[]>;\n envVars?: Opt<Opt<string>[]>;\n cwd?: Opt<string>;\n}\n\nexport type DataListener = (chunk: any) => void;\nexport interface OutputListeners {\n stdout?: DataListener[];\n stderr?: DataListener[];\n}\n\nexport interface RawExecOptions extends ExecaOptions {\n maxBuffer?: number | undefined;\n cwd?: string;\n outputListeners?: OutputListeners;\n}\n\nexport interface ExecResult {\n stdout: string;\n stderr: string;\n}\n\nexport type ExtraEnv<T = unknown> = Record<string, T>;\n\nexport interface ExecOptions {\n cwd?: string;\n cwdFile?: string;\n env?: Opt<ExtraEnv>;\n extraEnv?: Opt<ExtraEnv>;\n docker?: Opt<DockerOptions>;\n toolConstraints?: Opt<ToolConstraint[]>;\n preCommands?: Opt<string[]>;\n ignoreStdout?: boolean;\n // Following are pass-through to child process\n maxBuffer?: number | undefined;\n timeout?: number | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/util/exec/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Options as ExecaOptions } from 'execa';\n\nexport interface ToolConstraint {\n toolName: string;\n constraint?: string | null;\n}\n\nexport interface ToolConfig {\n datasource: string;\n extractVersion?: string;\n packageName: string;\n hash?: boolean;\n versioning: string;\n}\n\nexport type Opt<T> = T | null | undefined;\n\nexport type VolumesPair = [string, string];\nexport type VolumeOption = Opt<string | VolumesPair>;\n\nexport interface DockerOptions {\n volumes?: Opt<VolumeOption[]>;\n envVars?: Opt<Opt<string>[]>;\n cwd?: Opt<string>;\n}\n\nexport type DataListener = (chunk: any) => void;\nexport interface OutputListeners {\n stdout?: DataListener[];\n stderr?: DataListener[];\n}\n\nexport interface RawExecOptions extends ExecaOptions {\n maxBuffer?: number | undefined;\n cwd?: string;\n outputListeners?: OutputListeners;\n}\n\nexport interface ExecResult {\n stdout: string;\n stderr: string;\n}\n\nexport type ExtraEnv<T = unknown> = Record<string, T>;\n\nexport interface ExecOptions {\n cwd?: string;\n cwdFile?: string;\n env?: Opt<ExtraEnv>;\n extraEnv?: Opt<ExtraEnv>;\n docker?: Opt<DockerOptions>;\n toolConstraints?: Opt<ToolConstraint[]>;\n preCommands?: Opt<string[]>;\n ignoreStdout?: boolean;\n // Following are pass-through to child process\n maxBuffer?: number | undefined;\n timeout?: number | undefined;\n shell?: boolean | string | undefined;\n}\n"]}
|
|
@@ -82,6 +82,9 @@ async function postUpgradeCommandsExecutor(filteredUpgradeCommands, config) {
|
|
|
82
82
|
try {
|
|
83
83
|
logger_1.logger.trace({ cmd: compiledCmd }, 'Executing post-upgrade task');
|
|
84
84
|
const execOpts = {
|
|
85
|
+
// WARNING to self-hosted administrators: always run post-upgrade commands with `shell` mode on, which has the risk of arbitrary environment variable access or additional command execution
|
|
86
|
+
// It is very likely this will be susceptible to these risks, even if you allowlist (via `allowedCommands`), as there may be special characters included in the given commands that can be leveraged here
|
|
87
|
+
shell: true,
|
|
85
88
|
cwd: (0, is_1.isNonEmptyString)(workingDir)
|
|
86
89
|
? workingDir
|
|
87
90
|
: global_1.GlobalConfig.get('localDir'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-post-upgrade-commands.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/update/branch/exec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C,gBAAgB,EAAE,aAAa;QAChC,gBAAgB,CAAC,aAAa,KAAK,QAAQ,CAC9C,CAAC;IAEF,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,GACxC,MAAM,2BAA2B,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACnE,OAAO,2BAA2B,CAAC,qBAAqB,EAAE;QACxD,GAAG,MAAM;QACT,gBAAgB;QAChB,cAAc;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import crypto from 'crypto';\n// TODO #22198\nimport { isArray, isNonEmptyArray, isNonEmptyString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport { addMeta, logger } from '../../../../logger';\nimport type { ArtifactError } from '../../../../modules/manager/types';\nimport { coerceArray } from '../../../../util/array';\nimport { exec } from '../../../../util/exec';\nimport type { ExecOptions } from '../../../../util/exec/types';\nimport {\n ensureLocalDir,\n localPathIsFile,\n outputCacheFile,\n privateCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getRepoStatus } from '../../../../util/git';\nimport { getGitEnvironmentVariables } from '../../../../util/git/auth';\nimport type { FileChange } from '../../../../util/git/types';\nimport { minimatch } from '../../../../util/minimatch';\nimport { regEx } from '../../../../util/regex';\nimport { sanitize } from '../../../../util/sanitize';\nimport { compile } from '../../../../util/template';\nimport type { BranchConfig, BranchUpgradeConfig } from '../../../types';\n\nexport interface PostUpgradeCommandsExecutionResult {\n updatedArtifacts: FileChange[];\n artifactErrors: ArtifactError[];\n}\n\nexport async function postUpgradeCommandsExecutor(\n filteredUpgradeCommands: BranchUpgradeConfig[],\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult> {\n let updatedArtifacts = [...(config.updatedArtifacts ?? [])];\n const artifactErrors = [...(config.artifactErrors ?? [])];\n const allowedCommands = GlobalConfig.get('allowedCommands');\n\n for (const upgrade of filteredUpgradeCommands) {\n addMeta({ dep: upgrade.depName });\n logger.trace(\n {\n tasks: upgrade.postUpgradeTasks,\n allowedCommands,\n },\n `Checking for post-upgrade tasks`,\n );\n const commands = upgrade.postUpgradeTasks?.commands;\n const dataFileTemplate = upgrade.postUpgradeTasks?.dataFileTemplate;\n const fileFilters = upgrade.postUpgradeTasks?.fileFilters ?? ['**/*'];\n if (isNonEmptyArray(commands)) {\n // Persist updated files in file system so any executed commands can see them\n const previouslyModifiedFiles =\n config.updatedPackageFiles!.concat(updatedArtifacts);\n for (const file of previouslyModifiedFiles) {\n const canWriteFile = await localPathIsFile(file.path);\n if (file.type === 'addition' && !file.isSymlink && canWriteFile) {\n let contents: Buffer | null;\n if (typeof file.contents === 'string') {\n contents = Buffer.from(file.contents);\n } else {\n contents = file.contents;\n }\n // TODO #22198\n await writeLocalFile(file.path, contents!);\n }\n }\n\n let dataFilePath: string | null = null;\n if (dataFileTemplate) {\n const dataFileContent = sanitize(\n compile(dataFileTemplate, mergeChildConfig(config, upgrade)),\n );\n logger.debug(\n { dataFileTemplate },\n 'Processed post-upgrade commands data file template.',\n );\n\n const dataFileName = `post-upgrade-data-file-${crypto.randomBytes(8).toString('hex')}.tmp`;\n dataFilePath = upath.join(privateCacheDir(), dataFileName);\n\n try {\n await outputCacheFile(dataFilePath, dataFileContent);\n\n logger.debug(\n { dataFilePath, dataFileContent },\n 'Created post-upgrade commands data file.',\n );\n } catch (error) {\n artifactErrors.push({\n stderr: sanitize(\n `Failed to create post-upgrade commands data file at ${dataFilePath}, reason: ${error.message}`,\n ),\n });\n\n dataFilePath = null;\n }\n }\n\n const workingDirTemplate = upgrade.postUpgradeTasks?.workingDirTemplate;\n let workingDir: string | null = null;\n\n if (workingDirTemplate) {\n workingDir = sanitize(\n compile(workingDirTemplate, mergeChildConfig(config, upgrade)),\n );\n await ensureLocalDir(workingDir);\n logger.trace(\n { workingDirTemplate },\n 'Processed post-upgrade commands working directory template.',\n );\n }\n\n for (const cmd of commands) {\n const compiledCmd = compile(cmd, mergeChildConfig(config, upgrade));\n if (compiledCmd !== cmd) {\n logger.debug(\n { rawCmd: cmd, compiledCmd },\n 'Post-upgrade command has been compiled',\n );\n }\n if (\n allowedCommands!.some((pattern) => regEx(pattern).test(compiledCmd))\n ) {\n try {\n logger.trace({ cmd: compiledCmd }, 'Executing post-upgrade task');\n\n const execOpts: ExecOptions = {\n cwd: isNonEmptyString(workingDir)\n ? workingDir\n : GlobalConfig.get('localDir'),\n extraEnv: getGitEnvironmentVariables(),\n };\n if (dataFilePath) {\n execOpts.env = {\n RENOVATE_POST_UPGRADE_COMMAND_DATA_FILE: dataFilePath,\n };\n }\n const execResult = await exec(compiledCmd, execOpts);\n\n logger.debug(\n { cmd: compiledCmd, ...execResult },\n 'Executed post-upgrade task',\n );\n } catch (error) {\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(error.message),\n });\n }\n } else {\n logger.warn(\n {\n cmd: compiledCmd,\n allowedCommands,\n },\n 'Post-upgrade task did not match any on allowedCommands list',\n );\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(\n `Post-upgrade command '${compiledCmd}' has not been added to the allowed list in allowedCommands`,\n ),\n });\n }\n }\n\n const status = await getRepoStatus();\n\n logger.trace({ status }, 'git status after post-upgrade tasks');\n\n logger.debug(\n {\n addedCount: status.not_added?.length,\n modifiedCount: status.modified?.length,\n deletedCount: status.deleted?.length,\n renamedCount: status.renamed?.length,\n },\n 'git status counts after post-upgrade tasks',\n );\n\n const addedOrModifiedFiles = [\n ...coerceArray(status.not_added),\n ...coerceArray(status.modified),\n ...coerceArray(status.renamed?.map((x) => x.to)),\n ];\n const changedFiles = [\n ...addedOrModifiedFiles,\n ...coerceArray(status.deleted),\n ...coerceArray(status.renamed?.map((x) => x.from)),\n ];\n\n // Check for files which were previously deleted but have been re-added without modification\n const previouslyDeletedFiles = updatedArtifacts.filter(\n (ua) => ua.type === 'deletion',\n );\n for (const previouslyDeletedFile of previouslyDeletedFiles) {\n /* v8 ignore if -- TODO: needs test */\n if (!changedFiles.includes(previouslyDeletedFile.path)) {\n logger.debug(\n { file: previouslyDeletedFile.path },\n 'Previously deleted file has been restored without modification',\n );\n updatedArtifacts = updatedArtifacts.filter(\n (ua) =>\n !(\n ua.type === 'deletion' && ua.path === previouslyDeletedFile.path\n ),\n );\n }\n }\n\n logger.trace({ addedOrModifiedFiles }, 'Added or modified files');\n logger.debug(\n `Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`,\n );\n\n const fileExcludes: string[] = [];\n if (config.npmrc) {\n fileExcludes.push('.npmrc');\n }\n\n for (const relativePath of addedOrModifiedFiles) {\n if (\n fileExcludes.some((pattern) =>\n minimatch(pattern, { dot: true }).match(relativePath),\n )\n ) {\n continue;\n }\n\n let fileMatched = false;\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n fileMatched = true;\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file saved',\n );\n const existingContent = await readLocalFile(relativePath);\n const existingUpdatedArtifacts = updatedArtifacts.find(\n (ua) => ua.path === relativePath,\n );\n if (existingUpdatedArtifacts?.type === 'addition') {\n existingUpdatedArtifacts.contents = existingContent;\n } else {\n updatedArtifacts.push({\n type: 'addition',\n path: relativePath,\n contents: existingContent,\n });\n }\n // If the file is deleted by a previous post-update command, remove the deletion from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'deletion' && ua.path === relativePath),\n );\n }\n }\n if (!fileMatched) {\n logger.debug(\n { file: relativePath },\n 'Post-upgrade file did not match any file filters',\n );\n }\n }\n\n for (const relativePath of coerceArray(status.deleted)) {\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n if (\n !updatedArtifacts.some(\n (ua) => ua.path === relativePath && ua.type === 'deletion',\n )\n ) {\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file removed',\n );\n updatedArtifacts.push({\n type: 'deletion',\n path: relativePath,\n });\n }\n // If the file is created or modified by a previous post-update command, remove the modification from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'addition' && ua.path === relativePath),\n );\n }\n }\n }\n }\n }\n return { updatedArtifacts, artifactErrors };\n}\n\nexport default async function executePostUpgradeCommands(\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult | null> {\n const hasChangedFiles =\n (isArray(config.updatedPackageFiles) &&\n config.updatedPackageFiles.length > 0) ||\n (isArray(config.updatedArtifacts) && config.updatedArtifacts.length > 0);\n\n if (!hasChangedFiles) {\n /* Only run post-upgrade tasks if there are changes to package files... */\n logger.debug('No changes to package files, skipping post-upgrade tasks');\n return null;\n }\n\n const branchUpgradeCommands: BranchUpgradeConfig[] = [\n {\n manager: config.manager,\n depName: config.upgrades.map(({ depName }) => depName).join(' '),\n branchName: config.branchName,\n postUpgradeTasks:\n config.postUpgradeTasks!.executionMode === 'branch'\n ? config.postUpgradeTasks\n : undefined,\n },\n ];\n\n const updateUpgradeCommands: BranchUpgradeConfig[] = config.upgrades.filter(\n ({ postUpgradeTasks }) =>\n !postUpgradeTasks?.executionMode ||\n postUpgradeTasks.executionMode === 'update',\n );\n\n const { updatedArtifacts, artifactErrors } =\n await postUpgradeCommandsExecutor(updateUpgradeCommands, config);\n return postUpgradeCommandsExecutor(branchUpgradeCommands, {\n ...config,\n updatedArtifacts,\n artifactErrors,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"execute-post-upgrade-commands.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/update/branch/execute-post-upgrade-commands.ts"],"names":[],"mappings":";;AAiCA,kEA2QC;AAED,6CAuCC;;AArVD,4DAA4B;AAC5B,cAAc;AACd,yCAA8E;AAC9E,0DAA0B;AAC1B,+CAAsD;AACtD,sDAAyD;AACzD,+CAAqD;AAErD,kDAAqD;AACrD,gDAA6C;AAE7C,4CAO6B;AAC7B,8CAAqD;AACrD,oDAAuE;AAEvE,0DAAuD;AACvD,kDAA+C;AAC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AE;QACxD,GAAG,MAAM;QACT,gBAAgB;QAChB,cAAc;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import crypto from 'crypto';\n// TODO #22198\nimport { isArray, isNonEmptyArray, isNonEmptyString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport { addMeta, logger } from '../../../../logger';\nimport type { ArtifactError } from '../../../../modules/manager/types';\nimport { coerceArray } from '../../../../util/array';\nimport { exec } from '../../../../util/exec';\nimport type { ExecOptions } from '../../../../util/exec/types';\nimport {\n ensureLocalDir,\n localPathIsFile,\n outputCacheFile,\n privateCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getRepoStatus } from '../../../../util/git';\nimport { getGitEnvironmentVariables } from '../../../../util/git/auth';\nimport type { FileChange } from '../../../../util/git/types';\nimport { minimatch } from '../../../../util/minimatch';\nimport { regEx } from '../../../../util/regex';\nimport { sanitize } from '../../../../util/sanitize';\nimport { compile } from '../../../../util/template';\nimport type { BranchConfig, BranchUpgradeConfig } from '../../../types';\n\nexport interface PostUpgradeCommandsExecutionResult {\n updatedArtifacts: FileChange[];\n artifactErrors: ArtifactError[];\n}\n\nexport async function postUpgradeCommandsExecutor(\n filteredUpgradeCommands: BranchUpgradeConfig[],\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult> {\n let updatedArtifacts = [...(config.updatedArtifacts ?? [])];\n const artifactErrors = [...(config.artifactErrors ?? [])];\n const allowedCommands = GlobalConfig.get('allowedCommands');\n\n for (const upgrade of filteredUpgradeCommands) {\n addMeta({ dep: upgrade.depName });\n logger.trace(\n {\n tasks: upgrade.postUpgradeTasks,\n allowedCommands,\n },\n `Checking for post-upgrade tasks`,\n );\n const commands = upgrade.postUpgradeTasks?.commands;\n const dataFileTemplate = upgrade.postUpgradeTasks?.dataFileTemplate;\n const fileFilters = upgrade.postUpgradeTasks?.fileFilters ?? ['**/*'];\n if (isNonEmptyArray(commands)) {\n // Persist updated files in file system so any executed commands can see them\n const previouslyModifiedFiles =\n config.updatedPackageFiles!.concat(updatedArtifacts);\n for (const file of previouslyModifiedFiles) {\n const canWriteFile = await localPathIsFile(file.path);\n if (file.type === 'addition' && !file.isSymlink && canWriteFile) {\n let contents: Buffer | null;\n if (typeof file.contents === 'string') {\n contents = Buffer.from(file.contents);\n } else {\n contents = file.contents;\n }\n // TODO #22198\n await writeLocalFile(file.path, contents!);\n }\n }\n\n let dataFilePath: string | null = null;\n if (dataFileTemplate) {\n const dataFileContent = sanitize(\n compile(dataFileTemplate, mergeChildConfig(config, upgrade)),\n );\n logger.debug(\n { dataFileTemplate },\n 'Processed post-upgrade commands data file template.',\n );\n\n const dataFileName = `post-upgrade-data-file-${crypto.randomBytes(8).toString('hex')}.tmp`;\n dataFilePath = upath.join(privateCacheDir(), dataFileName);\n\n try {\n await outputCacheFile(dataFilePath, dataFileContent);\n\n logger.debug(\n { dataFilePath, dataFileContent },\n 'Created post-upgrade commands data file.',\n );\n } catch (error) {\n artifactErrors.push({\n stderr: sanitize(\n `Failed to create post-upgrade commands data file at ${dataFilePath}, reason: ${error.message}`,\n ),\n });\n\n dataFilePath = null;\n }\n }\n\n const workingDirTemplate = upgrade.postUpgradeTasks?.workingDirTemplate;\n let workingDir: string | null = null;\n\n if (workingDirTemplate) {\n workingDir = sanitize(\n compile(workingDirTemplate, mergeChildConfig(config, upgrade)),\n );\n await ensureLocalDir(workingDir);\n logger.trace(\n { workingDirTemplate },\n 'Processed post-upgrade commands working directory template.',\n );\n }\n\n for (const cmd of commands) {\n const compiledCmd = compile(cmd, mergeChildConfig(config, upgrade));\n if (compiledCmd !== cmd) {\n logger.debug(\n { rawCmd: cmd, compiledCmd },\n 'Post-upgrade command has been compiled',\n );\n }\n if (\n allowedCommands!.some((pattern) => regEx(pattern).test(compiledCmd))\n ) {\n try {\n logger.trace({ cmd: compiledCmd }, 'Executing post-upgrade task');\n\n const execOpts: ExecOptions = {\n // WARNING to self-hosted administrators: always run post-upgrade commands with `shell` mode on, which has the risk of arbitrary environment variable access or additional command execution\n // It is very likely this will be susceptible to these risks, even if you allowlist (via `allowedCommands`), as there may be special characters included in the given commands that can be leveraged here\n shell: true,\n\n cwd: isNonEmptyString(workingDir)\n ? workingDir\n : GlobalConfig.get('localDir'),\n extraEnv: getGitEnvironmentVariables(),\n };\n if (dataFilePath) {\n execOpts.env = {\n RENOVATE_POST_UPGRADE_COMMAND_DATA_FILE: dataFilePath,\n };\n }\n const execResult = await exec(compiledCmd, execOpts);\n\n logger.debug(\n { cmd: compiledCmd, ...execResult },\n 'Executed post-upgrade task',\n );\n } catch (error) {\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(error.message),\n });\n }\n } else {\n logger.warn(\n {\n cmd: compiledCmd,\n allowedCommands,\n },\n 'Post-upgrade task did not match any on allowedCommands list',\n );\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(\n `Post-upgrade command '${compiledCmd}' has not been added to the allowed list in allowedCommands`,\n ),\n });\n }\n }\n\n const status = await getRepoStatus();\n\n logger.trace({ status }, 'git status after post-upgrade tasks');\n\n logger.debug(\n {\n addedCount: status.not_added?.length,\n modifiedCount: status.modified?.length,\n deletedCount: status.deleted?.length,\n renamedCount: status.renamed?.length,\n },\n 'git status counts after post-upgrade tasks',\n );\n\n const addedOrModifiedFiles = [\n ...coerceArray(status.not_added),\n ...coerceArray(status.modified),\n ...coerceArray(status.renamed?.map((x) => x.to)),\n ];\n const changedFiles = [\n ...addedOrModifiedFiles,\n ...coerceArray(status.deleted),\n ...coerceArray(status.renamed?.map((x) => x.from)),\n ];\n\n // Check for files which were previously deleted but have been re-added without modification\n const previouslyDeletedFiles = updatedArtifacts.filter(\n (ua) => ua.type === 'deletion',\n );\n for (const previouslyDeletedFile of previouslyDeletedFiles) {\n /* v8 ignore if -- TODO: needs test */\n if (!changedFiles.includes(previouslyDeletedFile.path)) {\n logger.debug(\n { file: previouslyDeletedFile.path },\n 'Previously deleted file has been restored without modification',\n );\n updatedArtifacts = updatedArtifacts.filter(\n (ua) =>\n !(\n ua.type === 'deletion' && ua.path === previouslyDeletedFile.path\n ),\n );\n }\n }\n\n logger.trace({ addedOrModifiedFiles }, 'Added or modified files');\n logger.debug(\n `Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`,\n );\n\n const fileExcludes: string[] = [];\n if (config.npmrc) {\n fileExcludes.push('.npmrc');\n }\n\n for (const relativePath of addedOrModifiedFiles) {\n if (\n fileExcludes.some((pattern) =>\n minimatch(pattern, { dot: true }).match(relativePath),\n )\n ) {\n continue;\n }\n\n let fileMatched = false;\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n fileMatched = true;\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file saved',\n );\n const existingContent = await readLocalFile(relativePath);\n const existingUpdatedArtifacts = updatedArtifacts.find(\n (ua) => ua.path === relativePath,\n );\n if (existingUpdatedArtifacts?.type === 'addition') {\n existingUpdatedArtifacts.contents = existingContent;\n } else {\n updatedArtifacts.push({\n type: 'addition',\n path: relativePath,\n contents: existingContent,\n });\n }\n // If the file is deleted by a previous post-update command, remove the deletion from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'deletion' && ua.path === relativePath),\n );\n }\n }\n if (!fileMatched) {\n logger.debug(\n { file: relativePath },\n 'Post-upgrade file did not match any file filters',\n );\n }\n }\n\n for (const relativePath of coerceArray(status.deleted)) {\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n if (\n !updatedArtifacts.some(\n (ua) => ua.path === relativePath && ua.type === 'deletion',\n )\n ) {\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file removed',\n );\n updatedArtifacts.push({\n type: 'deletion',\n path: relativePath,\n });\n }\n // If the file is created or modified by a previous post-update command, remove the modification from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'addition' && ua.path === relativePath),\n );\n }\n }\n }\n }\n }\n return { updatedArtifacts, artifactErrors };\n}\n\nexport default async function executePostUpgradeCommands(\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult | null> {\n const hasChangedFiles =\n (isArray(config.updatedPackageFiles) &&\n config.updatedPackageFiles.length > 0) ||\n (isArray(config.updatedArtifacts) && config.updatedArtifacts.length > 0);\n\n if (!hasChangedFiles) {\n /* Only run post-upgrade tasks if there are changes to package files... */\n logger.debug('No changes to package files, skipping post-upgrade tasks');\n return null;\n }\n\n const branchUpgradeCommands: BranchUpgradeConfig[] = [\n {\n manager: config.manager,\n depName: config.upgrades.map(({ depName }) => depName).join(' '),\n branchName: config.branchName,\n postUpgradeTasks:\n config.postUpgradeTasks!.executionMode === 'branch'\n ? config.postUpgradeTasks\n : undefined,\n },\n ];\n\n const updateUpgradeCommands: BranchUpgradeConfig[] = config.upgrades.filter(\n ({ postUpgradeTasks }) =>\n !postUpgradeTasks?.executionMode ||\n postUpgradeTasks.executionMode === 'update',\n );\n\n const { updatedArtifacts, artifactErrors } =\n await postUpgradeCommandsExecutor(updateUpgradeCommands, config);\n return postUpgradeCommandsExecutor(branchUpgradeCommands, {\n ...config,\n updatedArtifacts,\n artifactErrors,\n });\n}\n"]}
|
package/package.json
CHANGED
package/renovate-schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "JSON schema for Renovate 42.68.
|
|
2
|
+
"title": "JSON schema for Renovate 42.68.5 config files (https://renovatebot.com/)",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"x-renovate-version": "42.68.
|
|
4
|
+
"x-renovate-version": "42.68.5",
|
|
5
5
|
"allowComments": true,
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|