renovate 44.17.0 → 44.17.2
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/config/migrations/custom/ignore-npmrc-file-migration.js +2 -1
- package/dist/config/migrations/custom/ignore-npmrc-file-migration.js.map +1 -1
- package/dist/config/migrations/custom/stability-days-migration.js +1 -3
- package/dist/config/migrations/custom/stability-days-migration.js.map +1 -1
- package/dist/config/options/index.js +1 -1
- package/dist/config/options/index.js.map +1 -1
- package/dist/config/secrets.js +2 -1
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/validation.js +1 -3
- package/dist/config/validation.js.map +1 -1
- package/dist/config-validator.js +2 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/expose.js.map +1 -1
- package/dist/global-config-option-defaults.generated.js +1 -1
- package/dist/global-config-option-defaults.generated.js.map +1 -1
- package/dist/modules/datasource/artifactory/index.js +2 -1
- package/dist/modules/datasource/artifactory/index.js.map +1 -1
- package/dist/modules/datasource/aws-eks-addon/index.js +2 -1
- package/dist/modules/datasource/aws-eks-addon/index.js.map +1 -1
- package/dist/modules/datasource/aws-machine-image/index.js +3 -2
- package/dist/modules/datasource/aws-machine-image/index.js.map +1 -1
- package/dist/modules/datasource/bazel/index.js +2 -1
- package/dist/modules/datasource/bazel/index.js.map +1 -1
- package/dist/modules/datasource/bitbucket-server-tags/index.js +4 -2
- package/dist/modules/datasource/bitbucket-server-tags/index.js.map +1 -1
- package/dist/modules/datasource/bitbucket-tags/index.js +2 -1
- package/dist/modules/datasource/bitbucket-tags/index.js.map +1 -1
- package/dist/modules/datasource/bitrise/index.js +2 -1
- package/dist/modules/datasource/bitrise/index.js.map +1 -1
- package/dist/modules/datasource/common.js +4 -2
- package/dist/modules/datasource/common.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +12 -5
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/custom/formats/toml.js +2 -1
- package/dist/modules/datasource/custom/formats/toml.js.map +1 -1
- package/dist/modules/datasource/custom/formats/yaml.js +4 -2
- package/dist/modules/datasource/custom/formats/yaml.js.map +1 -1
- package/dist/modules/datasource/deb/checksum.js +2 -1
- package/dist/modules/datasource/deb/checksum.js.map +1 -1
- package/dist/modules/datasource/deb/packages.js +3 -1
- package/dist/modules/datasource/deb/packages.js.map +1 -1
- package/dist/modules/datasource/deno/index.js +2 -1
- package/dist/modules/datasource/deno/index.js.map +1 -1
- package/dist/modules/datasource/docker/common.js +3 -2
- package/dist/modules/datasource/docker/common.js.map +1 -1
- package/dist/modules/datasource/docker/dockerhub-cache.js +1 -1
- package/dist/modules/datasource/docker/dockerhub-cache.js.map +1 -1
- package/dist/modules/datasource/docker/index.js +11 -10
- package/dist/modules/datasource/docker/index.js.map +1 -1
- package/dist/modules/datasource/forgejo-tags/index.js +4 -2
- package/dist/modules/datasource/forgejo-tags/index.js.map +1 -1
- package/dist/modules/datasource/galaxy-collection/index.js +5 -3
- package/dist/modules/datasource/galaxy-collection/index.js.map +1 -1
- package/dist/modules/datasource/git-refs/base.js +2 -1
- package/dist/modules/datasource/git-refs/base.js.map +1 -1
- package/dist/modules/datasource/git-refs/index.js +1 -1
- package/dist/modules/datasource/git-refs/index.js.map +1 -1
- package/dist/modules/datasource/gitea-tags/index.js +4 -2
- package/dist/modules/datasource/gitea-tags/index.js.map +1 -1
- package/dist/modules/datasource/github-release-attachments/index.js +3 -2
- package/dist/modules/datasource/github-release-attachments/index.js.map +1 -1
- package/dist/modules/datasource/github-tags/index.js +1 -1
- package/dist/modules/datasource/github-tags/index.js.map +1 -1
- package/dist/modules/datasource/gitlab-tags/index.js +2 -1
- package/dist/modules/datasource/gitlab-tags/index.js.map +1 -1
- package/dist/modules/datasource/gitlab-tags/util.js +2 -1
- package/dist/modules/datasource/gitlab-tags/util.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +8 -5
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/jenkins-plugins/index.js +1 -1
- package/dist/modules/datasource/jenkins-plugins/index.js.map +1 -1
- package/dist/modules/datasource/jsr/index.js +2 -1
- package/dist/modules/datasource/jsr/index.js.map +1 -1
- package/dist/modules/datasource/maven/index.js +3 -2
- package/dist/modules/datasource/maven/index.js.map +1 -1
- package/dist/modules/datasource/maven/util.js +1 -1
- package/dist/modules/datasource/maven/util.js.map +1 -1
- package/dist/modules/datasource/nuget/v2.js +3 -2
- package/dist/modules/datasource/nuget/v2.js.map +1 -1
- package/dist/modules/datasource/nuget/v3.js +9 -5
- package/dist/modules/datasource/nuget/v3.js.map +1 -1
- package/dist/modules/datasource/packagist/index.js +7 -4
- package/dist/modules/datasource/packagist/index.js.map +1 -1
- package/dist/modules/datasource/rpm/providers/common.js +3 -1
- package/dist/modules/datasource/rpm/providers/common.js.map +1 -1
- package/dist/modules/datasource/rpm/repomd.js +2 -1
- package/dist/modules/datasource/rpm/repomd.js.map +1 -1
- package/dist/modules/datasource/ruby-version/index.js +2 -1
- package/dist/modules/datasource/ruby-version/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/metadata-cache.js +1 -1
- package/dist/modules/datasource/rubygems/metadata-cache.js.map +1 -1
- package/dist/modules/datasource/sbt-package/index.js +8 -5
- package/dist/modules/datasource/sbt-package/index.js.map +1 -1
- package/dist/modules/datasource/sbt-package/util.js +2 -1
- package/dist/modules/datasource/sbt-package/util.js.map +1 -1
- package/dist/modules/datasource/terraform-module/index.js +4 -2
- package/dist/modules/datasource/terraform-module/index.js.map +1 -1
- package/dist/modules/datasource/terraform-module/utils.js +2 -1
- package/dist/modules/datasource/terraform-module/utils.js.map +1 -1
- package/dist/modules/datasource/terraform-provider/index.js +2 -1
- package/dist/modules/datasource/terraform-provider/index.js.map +1 -1
- package/dist/modules/datasource/typst/schema.js +4 -2
- package/dist/modules/datasource/typst/schema.js.map +1 -1
- package/dist/modules/manager/ansible-galaxy/collections.js +2 -2
- package/dist/modules/manager/ansible-galaxy/collections.js.map +1 -1
- package/dist/modules/manager/ansible-galaxy/extract.js +5 -3
- package/dist/modules/manager/ansible-galaxy/extract.js.map +1 -1
- package/dist/modules/manager/bazel/artifacts.js +1 -1
- package/dist/modules/manager/bazel/artifacts.js.map +1 -1
- package/dist/modules/manager/bazel/parser.js +1 -1
- package/dist/modules/manager/bazel/parser.js.map +1 -1
- package/dist/modules/manager/bazel/rules/index.js +7 -2
- package/dist/modules/manager/bazel/rules/index.js.map +1 -1
- package/dist/modules/manager/bazel-module/extract.js +2 -1
- package/dist/modules/manager/bazel-module/extract.js.map +1 -1
- package/dist/modules/manager/bazel-module/parser/extension-tags.js +3 -2
- package/dist/modules/manager/bazel-module/parser/extension-tags.js.map +1 -1
- package/dist/modules/manager/bazel-module/rules.js +1 -3
- package/dist/modules/manager/bazel-module/rules.js.map +1 -1
- package/dist/modules/manager/bitbucket-pipelines/extract.js +5 -3
- package/dist/modules/manager/bitbucket-pipelines/extract.js.map +1 -1
- package/dist/modules/manager/buildkite/extract.js +1 -1
- package/dist/modules/manager/buildkite/extract.js.map +1 -1
- package/dist/modules/manager/bun/extract.js +2 -1
- package/dist/modules/manager/bun/extract.js.map +1 -1
- package/dist/modules/manager/bundler/artifacts.js +3 -2
- package/dist/modules/manager/bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/cargo/artifacts.js +3 -2
- package/dist/modules/manager/cargo/artifacts.js.map +1 -1
- package/dist/modules/manager/cocoapods/artifacts.js +2 -1
- package/dist/modules/manager/cocoapods/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/update-locked.js +1 -1
- package/dist/modules/manager/composer/update-locked.js.map +1 -1
- package/dist/modules/manager/conan/artifacts.js +4 -2
- package/dist/modules/manager/conan/artifacts.js.map +1 -1
- package/dist/modules/manager/custom/jsonata/index.js +1 -3
- package/dist/modules/manager/custom/jsonata/index.js.map +1 -1
- package/dist/modules/manager/custom/jsonata/utils.js +1 -3
- package/dist/modules/manager/custom/jsonata/utils.js.map +1 -1
- package/dist/modules/manager/custom/regex/index.js +1 -3
- package/dist/modules/manager/custom/regex/index.js.map +1 -1
- package/dist/modules/manager/custom/regex/strategies.js +7 -6
- package/dist/modules/manager/custom/regex/strategies.js.map +1 -1
- package/dist/modules/manager/custom/regex/utils.js +1 -3
- package/dist/modules/manager/custom/regex/utils.js.map +1 -1
- package/dist/modules/manager/docker-compose/extract.js +2 -2
- package/dist/modules/manager/docker-compose/extract.js.map +1 -1
- package/dist/modules/manager/droneci/extract.js +1 -1
- package/dist/modules/manager/droneci/extract.js.map +1 -1
- package/dist/modules/manager/flux/artifacts.js +5 -3
- package/dist/modules/manager/flux/artifacts.js.map +1 -1
- package/dist/modules/manager/flux/extract.js +2 -6
- package/dist/modules/manager/flux/extract.js.map +1 -1
- package/dist/modules/manager/git-submodules/extract.js +5 -4
- package/dist/modules/manager/git-submodules/extract.js.map +1 -1
- package/dist/modules/manager/github-actions/extract.js +2 -1
- package/dist/modules/manager/github-actions/extract.js.map +1 -1
- package/dist/modules/manager/gitlabci/extract.js +1 -1
- package/dist/modules/manager/gitlabci/extract.js.map +1 -1
- package/dist/modules/manager/gitlabci/schema.js +2 -1
- package/dist/modules/manager/gitlabci/schema.js.map +1 -1
- package/dist/modules/manager/gitlabci-include/extract.js +1 -1
- package/dist/modules/manager/gitlabci-include/extract.js.map +1 -1
- package/dist/modules/manager/gleam/artifacts.js +2 -1
- package/dist/modules/manager/gleam/artifacts.js.map +1 -1
- package/dist/modules/manager/gomod/artifacts.js +2 -1
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/artifacts.js +3 -1
- package/dist/modules/manager/gradle/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/extract/catalog.js +3 -1
- package/dist/modules/manager/gradle/extract/catalog.js.map +1 -1
- package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js +2 -1
- package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js.map +1 -1
- package/dist/modules/manager/gradle/extract.js +4 -2
- package/dist/modules/manager/gradle/extract.js.map +1 -1
- package/dist/modules/manager/gradle/parser/handlers.js +4 -2
- package/dist/modules/manager/gradle/parser/handlers.js.map +1 -1
- package/dist/modules/manager/gradle/parser/registry-urls.js +3 -2
- package/dist/modules/manager/gradle/parser/registry-urls.js.map +1 -1
- package/dist/modules/manager/gradle-wrapper/utils.js +2 -1
- package/dist/modules/manager/gradle-wrapper/utils.js.map +1 -1
- package/dist/modules/manager/helm-values/extract.js +1 -1
- package/dist/modules/manager/helm-values/extract.js.map +1 -1
- package/dist/modules/manager/helmfile/utils.js +3 -2
- package/dist/modules/manager/helmfile/utils.js.map +1 -1
- package/dist/modules/manager/helmsman/extract.js +1 -1
- package/dist/modules/manager/helmsman/extract.js.map +1 -1
- package/dist/modules/manager/helmv3/artifacts.js +3 -2
- package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
- package/dist/modules/manager/jenkins/extract.js +1 -1
- package/dist/modules/manager/jenkins/extract.js.map +1 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js +1 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/artifacts.js +3 -4
- package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/extract.js +1 -1
- package/dist/modules/manager/kustomize/extract.js.map +1 -1
- package/dist/modules/manager/leiningen/extract.js +2 -1
- package/dist/modules/manager/leiningen/extract.js.map +1 -1
- package/dist/modules/manager/maven/extract.js +6 -6
- package/dist/modules/manager/maven/extract.js.map +1 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js +4 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/meteor/extract.js +1 -1
- package/dist/modules/manager/meteor/extract.js.map +1 -1
- package/dist/modules/manager/mix/artifacts.js +2 -1
- package/dist/modules/manager/mix/artifacts.js.map +1 -1
- package/dist/modules/manager/nix/extract.js +0 -1
- package/dist/modules/manager/nix/extract.js.map +1 -1
- package/dist/modules/manager/npm/artifacts.js +2 -1
- package/dist/modules/manager/npm/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/extract/common/package-file.js +1 -1
- package/dist/modules/manager/npm/extract/common/package-file.js.map +1 -1
- package/dist/modules/manager/npm/extract/pnpm.js +2 -1
- package/dist/modules/manager/npm/extract/pnpm.js.map +1 -1
- package/dist/modules/manager/npm/extract/yarn.js +3 -2
- package/dist/modules/manager/npm/extract/yarn.js.map +1 -1
- package/dist/modules/manager/npm/post-update/index.js +9 -7
- package/dist/modules/manager/npm/post-update/index.js.map +1 -1
- package/dist/modules/manager/npm/post-update/npm.js +7 -4
- package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/pnpm.js +1 -1
- package/dist/modules/manager/npm/post-update/pnpm.js.map +1 -1
- package/dist/modules/manager/npm/update/dependency/index.js +2 -1
- package/dist/modules/manager/npm/update/dependency/index.js.map +1 -1
- package/dist/modules/manager/npm/update/index.js +5 -0
- package/dist/modules/manager/npm/update/index.js.map +1 -0
- package/dist/modules/manager/npm/update/locked-dependency/common/parent-version.js +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/common/parent-version.js.map +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/package-lock/index.js +21 -16
- package/dist/modules/manager/npm/update/locked-dependency/package-lock/index.js.map +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js +2 -2
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js.map +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/index.js +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/index.js.map +1 -1
- package/dist/modules/manager/npm/utils.js +3 -3
- package/dist/modules/manager/npm/utils.js.map +1 -1
- package/dist/modules/manager/nuget/artifacts.js +2 -1
- package/dist/modules/manager/nuget/artifacts.js.map +1 -1
- package/dist/modules/manager/nuget/update.js +2 -1
- package/dist/modules/manager/nuget/update.js.map +1 -1
- package/dist/modules/manager/pep621/processors/pdm.js +2 -1
- package/dist/modules/manager/pep621/processors/pdm.js.map +1 -1
- package/dist/modules/manager/pep621/schema.js +2 -1
- package/dist/modules/manager/pep621/schema.js.map +1 -1
- package/dist/modules/manager/pip-compile/artifacts.js +2 -1
- package/dist/modules/manager/pip-compile/artifacts.js.map +1 -1
- package/dist/modules/manager/pip_requirements/artifacts.js +5 -3
- package/dist/modules/manager/pip_requirements/artifacts.js.map +1 -1
- package/dist/modules/manager/pipenv/extract.js +2 -1
- package/dist/modules/manager/pipenv/extract.js.map +1 -1
- package/dist/modules/manager/poetry/artifacts.js +3 -2
- package/dist/modules/manager/poetry/artifacts.js.map +1 -1
- package/dist/modules/manager/poetry/extract.js +2 -1
- package/dist/modules/manager/poetry/extract.js.map +1 -1
- package/dist/modules/manager/pre-commit/extract.js +5 -3
- package/dist/modules/manager/pre-commit/extract.js.map +1 -1
- package/dist/modules/manager/puppet/puppetfile-parser.js +2 -1
- package/dist/modules/manager/puppet/puppetfile-parser.js.map +1 -1
- package/dist/modules/manager/quadlet/extract.js +2 -1
- package/dist/modules/manager/quadlet/extract.js.map +1 -1
- package/dist/modules/manager/sbt/extract.js +1 -1
- package/dist/modules/manager/sbt/extract.js.map +1 -1
- package/dist/modules/manager/swift/extract.js +4 -6
- package/dist/modules/manager/swift/extract.js.map +1 -1
- package/dist/modules/manager/terraform/lockfile/index.js +4 -3
- package/dist/modules/manager/terraform/lockfile/index.js.map +1 -1
- package/dist/modules/manager/terraform/util.js +2 -1
- package/dist/modules/manager/terraform/util.js.map +1 -1
- package/dist/modules/manager/terragrunt/extract.js +3 -9
- package/dist/modules/manager/terragrunt/extract.js.map +1 -1
- package/dist/modules/manager/tflint-plugin/extract.js +1 -1
- package/dist/modules/manager/tflint-plugin/extract.js.map +1 -1
- package/dist/modules/manager/vendir/artifacts.js +3 -2
- package/dist/modules/manager/vendir/artifacts.js.map +1 -1
- package/dist/modules/platform/azure/index.js +8 -7
- package/dist/modules/platform/azure/index.js.map +1 -1
- package/dist/modules/platform/bitbucket/comments.js +2 -2
- package/dist/modules/platform/bitbucket/comments.js.map +1 -1
- package/dist/modules/platform/bitbucket/index.js +9 -8
- package/dist/modules/platform/bitbucket/index.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/index.js +8 -9
- package/dist/modules/platform/bitbucket-server/index.js.map +1 -1
- package/dist/modules/platform/codecommit/codecommit-client.js +8 -5
- package/dist/modules/platform/codecommit/codecommit-client.js.map +1 -1
- package/dist/modules/platform/codecommit/index.js +5 -5
- package/dist/modules/platform/codecommit/index.js.map +1 -1
- package/dist/modules/platform/forgejo/forgejo-helper.js +5 -3
- package/dist/modules/platform/forgejo/forgejo-helper.js.map +1 -1
- package/dist/modules/platform/forgejo/index.js +15 -8
- package/dist/modules/platform/forgejo/index.js.map +1 -1
- package/dist/modules/platform/gerrit/client.js +2 -1
- package/dist/modules/platform/gerrit/client.js.map +1 -1
- package/dist/modules/platform/gerrit/index.js +4 -2
- package/dist/modules/platform/gerrit/index.js.map +1 -1
- package/dist/modules/platform/gerrit/utils.js +1 -1
- package/dist/modules/platform/gerrit/utils.js.map +1 -1
- package/dist/modules/platform/gitea/gitea-helper.js +5 -3
- package/dist/modules/platform/gitea/gitea-helper.js.map +1 -1
- package/dist/modules/platform/gitea/index.js +16 -9
- package/dist/modules/platform/gitea/index.js.map +1 -1
- package/dist/modules/platform/github/index.js +27 -24
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/modules/platform/github/massage-markdown-links.js +1 -1
- package/dist/modules/platform/github/massage-markdown-links.js.map +1 -1
- package/dist/modules/platform/github/pr.js +1 -1
- package/dist/modules/platform/github/pr.js.map +1 -1
- package/dist/modules/platform/github/schema.js +3 -2
- package/dist/modules/platform/github/schema.js.map +1 -1
- package/dist/modules/platform/gitlab/index.js +19 -14
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/modules/platform/local/scm.js +1 -1
- package/dist/modules/platform/local/scm.js.map +1 -1
- package/dist/modules/platform/util.js +2 -1
- package/dist/modules/platform/util.js.map +1 -1
- package/dist/modules/versioning/cargo/index.js +1 -1
- package/dist/modules/versioning/cargo/index.js.map +1 -1
- package/dist/modules/versioning/conan/index.js +4 -2
- package/dist/modules/versioning/conan/index.js.map +1 -1
- package/dist/modules/versioning/nixpkgs/index.js +2 -1
- package/dist/modules/versioning/nixpkgs/index.js.map +1 -1
- package/dist/modules/versioning/nuget/index.js +4 -2
- package/dist/modules/versioning/nuget/index.js.map +1 -1
- package/dist/modules/versioning/nuget/range.js +4 -2
- package/dist/modules/versioning/nuget/range.js.map +1 -1
- package/dist/modules/versioning/pep440/range.js +1 -1
- package/dist/modules/versioning/pep440/range.js.map +1 -1
- package/dist/modules/versioning/perl/index.js +1 -1
- package/dist/modules/versioning/perl/index.js.map +1 -1
- package/dist/modules/versioning/poetry/index.js +2 -2
- package/dist/modules/versioning/poetry/index.js.map +1 -1
- package/dist/modules/versioning/rez/index.js +5 -5
- package/dist/modules/versioning/rez/index.js.map +1 -1
- package/dist/modules/versioning/ruby/strategies/bump.js +3 -2
- package/dist/modules/versioning/ruby/strategies/bump.js.map +1 -1
- package/dist/modules/versioning/ruby/strategies/replace.js +3 -2
- package/dist/modules/versioning/ruby/strategies/replace.js.map +1 -1
- package/dist/modules/versioning/ruby/strategies/widen.js +3 -2
- package/dist/modules/versioning/ruby/strategies/widen.js.map +1 -1
- package/dist/util/cache/package/index.js +3 -1
- package/dist/util/cache/package/index.js.map +1 -1
- package/dist/util/cache/package/with-cache.js +7 -4
- package/dist/util/cache/package/with-cache.js.map +1 -1
- package/dist/util/cache/repository/impl/base.js +3 -2
- package/dist/util/cache/repository/impl/base.js.map +1 -1
- package/dist/util/cache/repository/impl/local.js +2 -1
- package/dist/util/cache/repository/impl/local.js.map +1 -1
- package/dist/util/cache/repository/impl/s3.js +4 -1
- package/dist/util/cache/repository/impl/s3.js.map +1 -1
- package/dist/util/date.js +1 -1
- package/dist/util/date.js.map +1 -1
- package/dist/util/emoji.js +6 -2
- package/dist/util/emoji.js.map +1 -1
- package/dist/util/exec/common.js +1 -1
- package/dist/util/exec/common.js.map +1 -1
- package/dist/util/exec/docker/index.js +2 -1
- package/dist/util/exec/docker/index.js.map +1 -1
- package/dist/util/exec/hermit.js +2 -1
- package/dist/util/exec/hermit.js.map +1 -1
- package/dist/util/exec/index.js +1 -1
- package/dist/util/exec/index.js.map +1 -1
- package/dist/util/fs/index.js +2 -1
- package/dist/util/fs/index.js.map +1 -1
- package/dist/util/git/index.js +32 -34
- package/dist/util/git/index.js.map +1 -1
- package/dist/util/git/url.js +2 -3
- package/dist/util/git/url.js.map +1 -1
- package/dist/util/github/graphql/cache-strategies/memory-cache-strategy.js +4 -2
- package/dist/util/github/graphql/cache-strategies/memory-cache-strategy.js.map +1 -1
- package/dist/util/github/graphql/datasource-fetcher.js +3 -1
- package/dist/util/github/graphql/datasource-fetcher.js.map +1 -1
- package/dist/util/http/cache/memory-http-cache-provider.js +2 -1
- package/dist/util/http/cache/memory-http-cache-provider.js.map +1 -1
- package/dist/util/http/github.js +3 -2
- package/dist/util/http/github.js.map +1 -1
- package/dist/util/http/http.js +2 -1
- package/dist/util/http/http.js.map +1 -1
- package/dist/util/http/index.js +1 -0
- package/dist/util/http/index.js.map +1 -1
- package/dist/util/http/www-authenticate.js +1 -3
- package/dist/util/http/www-authenticate.js.map +1 -1
- package/dist/util/mutex.js +1 -1
- package/dist/util/mutex.js.map +1 -1
- package/dist/util/schema-utils/index.js +1 -1
- package/dist/util/schema-utils/index.js.map +1 -1
- package/dist/util/toml.js +2 -1
- package/dist/util/toml.js.map +1 -1
- package/dist/util/yaml.js +4 -2
- package/dist/util/yaml.js.map +1 -1
- package/dist/workers/global/config/parse/util.js.map +1 -1
- package/dist/workers/global/index.js +2 -2
- package/dist/workers/global/index.js.map +1 -1
- package/dist/workers/repository/changelog/index.js +2 -1
- package/dist/workers/repository/changelog/index.js.map +1 -1
- package/dist/workers/repository/config-migration/branch/rebase.js +2 -1
- package/dist/workers/repository/config-migration/branch/rebase.js.map +1 -1
- package/dist/workers/repository/error-config.js +1 -1
- package/dist/workers/repository/error-config.js.map +1 -1
- package/dist/workers/repository/finalize/prune.js +1 -1
- package/dist/workers/repository/finalize/prune.js.map +1 -1
- package/dist/workers/repository/finalize/repository-statistics.js +1 -4
- package/dist/workers/repository/finalize/repository-statistics.js.map +1 -1
- package/dist/workers/repository/index.js +8 -5
- package/dist/workers/repository/index.js.map +1 -1
- package/dist/workers/repository/init/vulnerability.js +1 -1
- package/dist/workers/repository/init/vulnerability.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/config.js +2 -1
- package/dist/workers/repository/onboarding/branch/config.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/create.js +2 -1
- package/dist/workers/repository/onboarding/branch/create.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/index.js +2 -1
- package/dist/workers/repository/onboarding/branch/index.js.map +1 -1
- package/dist/workers/repository/onboarding/pr/index.js +3 -1
- package/dist/workers/repository/onboarding/pr/index.js.map +1 -1
- package/dist/workers/repository/process/lookup/filter-checks.js +2 -1
- package/dist/workers/repository/process/lookup/filter-checks.js.map +1 -1
- package/dist/workers/repository/process/lookup/filter.js +1 -1
- package/dist/workers/repository/process/lookup/filter.js.map +1 -1
- package/dist/workers/repository/process/lookup/generate.js +1 -1
- package/dist/workers/repository/process/lookup/generate.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +6 -3
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/process/lookup/rollback.js +1 -1
- package/dist/workers/repository/process/lookup/rollback.js.map +1 -1
- package/dist/workers/repository/process/vulnerabilities.js +2 -1
- package/dist/workers/repository/process/vulnerabilities.js.map +1 -1
- package/dist/workers/repository/process/write.js +8 -4
- package/dist/workers/repository/process/write.js.map +1 -1
- package/dist/workers/repository/reconfigure/validate.js +2 -1
- package/dist/workers/repository/reconfigure/validate.js.map +1 -1
- package/dist/workers/repository/update/branch/auto-replace.js +1 -1
- package/dist/workers/repository/update/branch/auto-replace.js.map +1 -1
- package/dist/workers/repository/update/branch/bump-versions.js +2 -1
- package/dist/workers/repository/update/branch/bump-versions.js.map +1 -1
- package/dist/workers/repository/update/branch/index.js +3 -1
- package/dist/workers/repository/update/branch/index.js.map +1 -1
- package/dist/workers/repository/update/pr/automerge.js +1 -1
- package/dist/workers/repository/update/pr/automerge.js.map +1 -1
- package/dist/workers/repository/update/pr/body/updates-table.js +1 -1
- package/dist/workers/repository/update/pr/body/updates-table.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/github/index.js +2 -1
- package/dist/workers/repository/update/pr/changelog/github/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/github/source.js +2 -1
- package/dist/workers/repository/update/pr/changelog/github/source.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/release-notes.js +5 -5
- package/dist/workers/repository/update/pr/changelog/release-notes.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/releases.js +1 -1
- package/dist/workers/repository/update/pr/changelog/releases.js.map +1 -1
- package/dist/workers/repository/update/pr/index.js +6 -3
- package/dist/workers/repository/update/pr/index.js.map +1 -1
- package/dist/workers/repository/update/pr/pr-reuse.js +1 -1
- package/dist/workers/repository/update/pr/pr-reuse.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hermit.js","names":[],"sources":["../../../lib/util/exec/hermit.ts"],"sourcesContent":["import upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { logger } from '../../logger/index.ts';\nimport { findUpLocal } from '../fs/index.ts';\nimport { newlineRegex } from '../regex.ts';\nimport { coerceString } from '../string.ts';\nimport { rawExec } from './common.ts';\nimport type { RawExecOptions } from './types.ts';\n\nexport function isHermit(): boolean {\n return GlobalConfig.get('binarySource') === 'hermit';\n}\n\nexport async function findHermitCwd(cwd: string): Promise<string> {\n const relativeCwd = upath.relative(GlobalConfig.get('localDir'), cwd);\n const hermitFile = await findUpLocal('bin/hermit', relativeCwd);\n\n if (hermitFile === null) {\n throw new Error(`hermit not found for ${cwd}`);\n }\n\n // TODO: types (#22198)\n return upath.join(GlobalConfig.get('localDir'), upath.dirname(hermitFile));\n}\n\nexport async function getHermitEnvs(\n rawOptions: RawExecOptions,\n): Promise<Record<string, string>> {\n const cwd = coerceString(rawOptions.cwd);\n const hermitCwd = await findHermitCwd(cwd);\n logger.debug({ cwd, hermitCwd }, 'fetching hermit environment variables');\n // with -r will output the raw unquoted environment variables to consume\n const hermitEnvResp = await rawExec('./hermit env -r', {\n ...rawOptions,\n cwd: hermitCwd,\n });\n\n const out: Record<string, string> = {};\n\n const lines = hermitEnvResp.stdout\n .split(newlineRegex)\n .map((line) => line.trim())\n .filter((line) => line.includes('='));\n for (const line of lines) {\n const equalIndex = line.indexOf('=');\n const name = line.substring(0, equalIndex);\n out[name] = line.substring(equalIndex + 1);\n }\n\n return out;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,WAAoB;CAClC,OAAO,aAAa,IAAI,cAAc,MAAM;AAC9C;AAEA,eAAsB,cAAc,KAA8B;
|
|
1
|
+
{"version":3,"file":"hermit.js","names":[],"sources":["../../../lib/util/exec/hermit.ts"],"sourcesContent":["import upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { logger } from '../../logger/index.ts';\nimport { findUpLocal } from '../fs/index.ts';\nimport { newlineRegex } from '../regex.ts';\nimport { coerceString } from '../string.ts';\nimport { rawExec } from './common.ts';\nimport type { RawExecOptions } from './types.ts';\n\nexport function isHermit(): boolean {\n return GlobalConfig.get('binarySource') === 'hermit';\n}\n\nexport async function findHermitCwd(cwd: string): Promise<string> {\n const relativeCwd = upath.relative(GlobalConfig.get('localDir'), cwd);\n const hermitFile = await findUpLocal('bin/hermit', relativeCwd);\n\n if (hermitFile === null) {\n throw new Error(`hermit not found for ${cwd}`);\n }\n\n // TODO: types (#22198)\n return upath.join(GlobalConfig.get('localDir'), upath.dirname(hermitFile));\n}\n\nexport async function getHermitEnvs(\n rawOptions: RawExecOptions,\n): Promise<Record<string, string>> {\n const cwd = coerceString(rawOptions.cwd);\n const hermitCwd = await findHermitCwd(cwd);\n logger.debug({ cwd, hermitCwd }, 'fetching hermit environment variables');\n // with -r will output the raw unquoted environment variables to consume\n const hermitEnvResp = await rawExec('./hermit env -r', {\n ...rawOptions,\n cwd: hermitCwd,\n });\n\n const out: Record<string, string> = {};\n\n const lines = hermitEnvResp.stdout\n .split(newlineRegex)\n .map((line) => line.trim())\n .filter((line) => line.includes('='));\n for (const line of lines) {\n const equalIndex = line.indexOf('=');\n const name = line.substring(0, equalIndex);\n out[name] = line.substring(equalIndex + 1);\n }\n\n return out;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,WAAoB;CAClC,OAAO,aAAa,IAAI,cAAc,MAAM;AAC9C;AAEA,eAAsB,cAAc,KAA8B;CAChE,MAAM,cAAc,MAAM,SAAS,aAAa,IAAI,UAAU,GAAG,GAAG;CACpE,MAAM,aAAa,MAAM,YAAY,cAAc,WAAW;CAE9D,IAAI,eAAe,MACjB,MAAM,IAAI,MAAM,wBAAwB,KAAK;CAI/C,OAAO,MAAM,KAAK,aAAa,IAAI,UAAU,GAAG,MAAM,QAAQ,UAAU,CAAC;AAC3E;AAEA,eAAsB,cACpB,YACiC;CACjC,MAAM,MAAM,aAAa,WAAW,GAAG;CACvC,MAAM,YAAY,MAAM,cAAc,GAAG;CACzC,OAAO,MAAM;EAAE;EAAK;CAAU,GAAG,uCAAuC;CAExE,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB;EACrD,GAAG;EACH,KAAK;CACP,CAAC;CAED,MAAM,MAA8B,CAAC;CAErC,MAAM,QAAQ,cAAc,OACzB,MAAM,YAAY,CAAC,CACnB,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,QAAQ,SAAS,KAAK,SAAS,GAAG,CAAC;CACtC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,KAAK,QAAQ,GAAG;EACnC,MAAM,OAAO,KAAK,UAAU,GAAG,UAAU;EACzC,IAAI,QAAQ,KAAK,UAAU,aAAa,CAAC;CAC3C;CAEA,OAAO;AACT"}
|
package/dist/util/exec/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../lib/util/exec/index.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport type { RepoToolSettingsOptions } from '../../config/types.ts';\nimport { TEMPORARY_ERROR } from '../../constants/error-messages.ts';\nimport { logger } from '../../logger/index.ts';\nimport { getCustomEnv, getUserEnv } from '../env.ts';\nimport { coerceObject } from '../object.ts';\nimport { rawExec } from './common.ts';\nimport { generateInstallCommands, isDynamicInstall } from './containerbase.ts';\nimport {\n generateDockerCommand,\n removeDockerContainer,\n} from './docker/index.ts';\nimport { getHermitEnvs, isHermit } from './hermit.ts';\nimport type {\n CommandWithOptions,\n DockerOptions,\n ExecOptions,\n ExecResult,\n ExtraEnv,\n Opt,\n RawExecOptions,\n} from './types.ts';\nimport { getChildEnv } from './utils.ts';\n\nfunction dockerEnvVars(extraEnv: ExtraEnv, childEnv: ExtraEnv): string[] {\n const extraEnvKeys = Object.keys(extraEnv);\n return extraEnvKeys.filter((key) => isNonEmptyString(childEnv[key]));\n}\n\nfunction getCwd({ cwd, cwdFile }: ExecOptions): string | undefined {\n // TODO: types (#22198)\n const defaultCwd = GlobalConfig.get('localDir');\n const paramCwd = cwdFile\n ? upath.join(defaultCwd, upath.dirname(cwdFile))\n : cwd;\n return paramCwd ?? defaultCwd;\n}\n\nfunction getRawExecOptions(opts: ExecOptions): RawExecOptions {\n const defaultExecutionTimeout = GlobalConfig.get('executionTimeout');\n const childEnv = getChildEnv(opts);\n const cwd = getCwd(opts);\n let timeout = opts.timeout;\n timeout ??= defaultExecutionTimeout * 60 * 1000;\n\n // Set default max buffer size to 10MB\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024;\n\n return {\n cwd,\n env: childEnv,\n maxBuffer,\n timeout,\n ...(opts.shell !== undefined && { shell: opts.shell }),\n stdin: 'pipe',\n stdout: opts.ignoreStdout ? 'ignore' : 'pipe',\n stderr: 'pipe',\n };\n}\n\nfunction isDocker(docker: Opt<DockerOptions>): docker is DockerOptions {\n return GlobalConfig.get('binarySource') === 'docker' && !!docker;\n}\n\ninterface RawExecArguments {\n rawCommands: (string | CommandWithOptions)[];\n rawOptions: RawExecOptions;\n}\n\nasync function prepareRawExec(\n cmd:\n | string\n | string[]\n | CommandWithOptions[]\n | (string | CommandWithOptions)[],\n opts: ExecOptions,\n sideCarImage: string,\n): Promise<RawExecArguments> {\n const { docker } = opts;\n const preCommands = opts.preCommands ?? [];\n const customEnvVariables = getCustomEnv();\n const userConfiguredEnv = getUserEnv();\n const { containerbaseDir, binarySource } = GlobalConfig.get();\n\n if (binarySource === 'docker' || binarySource === 'install') {\n logger.debug(`Setting CONTAINERBASE_CACHE_DIR to ${containerbaseDir!}`);\n opts.env ??= {};\n opts.env.CONTAINERBASE_CACHE_DIR = containerbaseDir;\n }\n\n let rawOptions = getRawExecOptions(opts);\n\n let rawCommands = typeof cmd === 'string' ? [cmd] : cmd;\n\n if (isDocker(docker)) {\n logger.debug({ image: sideCarImage }, 'Using docker to execute');\n const extraEnv = {\n ...opts.extraEnv,\n ...customEnvVariables,\n ...userConfiguredEnv,\n };\n const childEnv = getChildEnv(opts);\n const envVars = [\n ...dockerEnvVars(extraEnv, childEnv),\n 'CONTAINERBASE_CACHE_DIR',\n ];\n const cwd = getCwd(opts);\n const dockerOptions: DockerOptions = { ...docker, cwd, envVars };\n const dockerCommand = await generateDockerCommand(\n rawCommands,\n [\n ...(await generateInstallCommands(opts.toolConstraints)),\n ...preCommands,\n ],\n dockerOptions,\n sideCarImage,\n );\n rawCommands = [dockerCommand];\n } else if (isDynamicInstall(opts.toolConstraints)) {\n logger.debug('Using containerbase dynamic installs');\n rawCommands = [\n ...(await generateInstallCommands(opts.toolConstraints)),\n ...preCommands,\n ...rawCommands,\n ];\n } else if (isHermit()) {\n const hermitEnvVars = await getHermitEnvs(rawOptions);\n logger.debug(\n { hermitEnvVars },\n 'merging hermit environment variables into the execution options',\n );\n rawOptions = {\n ...rawOptions,\n env: {\n ...rawOptions.env,\n ...hermitEnvVars,\n },\n };\n }\n\n if (\n GlobalConfig.get('binarySource') === 'global' &&\n opts.toolConstraints?.length\n ) {\n logger.once.debug(\n { toolConstraints: opts.toolConstraints },\n 'Ignoring tool contraints because of `binarySource=global`',\n );\n }\n\n return { rawCommands, rawOptions };\n}\n\nexport async function exec(\n cmd:\n | string\n | string[]\n | CommandWithOptions[]\n | (string | CommandWithOptions)[],\n opts: ExecOptions = {},\n): Promise<ExecResult> {\n const { docker } = opts;\n const dockerChildPrefix = GlobalConfig.get('dockerChildPrefix');\n const sideCarImage = GlobalConfig.get('dockerSidecarImage');\n\n const { rawCommands, rawOptions } = await prepareRawExec(\n cmd,\n opts,\n sideCarImage,\n );\n const useDocker = isDocker(docker);\n\n let res: ExecResult = { stdout: '', stderr: '' };\n for (const rawCmd of rawCommands) {\n const startTime = Date.now();\n if (useDocker) {\n await removeDockerContainer(sideCarImage, dockerChildPrefix);\n }\n logger.debug(\n { command: rawCmd, env: Object.keys(coerceObject(rawOptions.env)) },\n 'Executing command',\n );\n logger.trace({ commandOptions: rawOptions }, 'Command options');\n try {\n res = await rawExec(rawCmd, rawOptions);\n } catch (err) {\n const durationMs = Math.round(Date.now() - startTime);\n logger.debug({ err, durationMs }, 'rawExec err');\n if (useDocker) {\n await removeDockerContainer(sideCarImage, dockerChildPrefix).catch(\n (removeErr: Error) => {\n const message: string = err.message;\n throw new Error(\n `Error: \"${removeErr.message}\" - Original Error: \"${message}\"`,\n );\n },\n );\n }\n if (err.signal === `SIGTERM`) {\n logger.debug(\n { err },\n 'exec interrupted by SIGTERM - run needs to be aborted',\n );\n throw new Error(TEMPORARY_ERROR);\n }\n throw err;\n }\n const durationMs = Math.round(Date.now() - startTime);\n logger.debug(\n {\n durationMs,\n stdout: res.stdout,\n stderr: res.stderr,\n },\n 'exec completed',\n );\n }\n\n return res;\n}\n\n/**\n * When we resolve `toolSettings` in `getToolSettingsOptions`, we provide a stronger type than our input types, because we set defaults on config options.\n *\n * We do not have a default that is set for `nodeMaxMemory`, so it must remain as optional.\n */\ntype ResolvedToolSettingsOptions = Required<\n Omit<RepoToolSettingsOptions, 'nodeMaxMemory'>\n> &\n Pick<RepoToolSettingsOptions, 'nodeMaxMemory'>;\n\nexport function getToolSettingsOptions(\n repoConfig?: RepoToolSettingsOptions,\n): ResolvedToolSettingsOptions {\n let defaults = GlobalConfig.get('toolSettings');\n defaults ??= {\n jvmMaxMemory: 512,\n jvmMemory: 512,\n };\n\n const jvmMaxMemory = defaults?.jvmMaxMemory ?? 512;\n const options: ResolvedToolSettingsOptions = {\n jvmMaxMemory,\n jvmMemory: defaults?.jvmMemory ?? jvmMaxMemory,\n nodeMaxMemory: defaults?.nodeMaxMemory,\n };\n\n if (repoConfig !== undefined) {\n if (repoConfig.jvmMaxMemory) {\n if (repoConfig.jvmMaxMemory > options.jvmMaxMemory) {\n logger.once.debug(\n `A higher jvmMaxMemory (${repoConfig.jvmMaxMemory}) than the global configuration (${options.jvmMaxMemory}) is not permitted for Java VM invocations. Using global configuration instead`,\n );\n }\n\n options.jvmMaxMemory = Math.min(\n options.jvmMaxMemory,\n repoConfig.jvmMaxMemory,\n );\n }\n\n if (repoConfig.jvmMemory) {\n options.jvmMemory = repoConfig.jvmMemory;\n }\n\n if (repoConfig.nodeMaxMemory) {\n if (\n options.nodeMaxMemory &&\n repoConfig.nodeMaxMemory > options.nodeMaxMemory\n ) {\n logger.once.debug(\n `A higher nodeMaxMemory (${repoConfig.nodeMaxMemory}) than the global configuration (${options.nodeMaxMemory}) is not permitted for Node invocations. Using global configuration instead`,\n );\n } else {\n options.nodeMaxMemory = repoConfig.nodeMaxMemory;\n }\n }\n }\n\n options.jvmMaxMemory = Math.floor(options.jvmMaxMemory);\n options.jvmMemory = Math.floor(options.jvmMemory);\n if (options.nodeMaxMemory) {\n options.nodeMaxMemory = Math.floor(options.nodeMaxMemory);\n }\n\n // make sure that the starting memory can't be more than the max memory\n options.jvmMemory = Math.min(options.jvmMemory, options.jvmMaxMemory);\n\n if (options.jvmMaxMemory < 512 || options.jvmMemory < 512) {\n options.jvmMaxMemory = Math.max(options.jvmMaxMemory, 512);\n\n logger.once.debug(\n 'Overriding low memory settings for Java VM invocations to a minimum of 512M',\n );\n options.jvmMemory = Math.max(options.jvmMemory, 512);\n }\n\n return options;\n}\n\nexport function gradleJvmArg(config: RepoToolSettingsOptions): string {\n return ` -Dorg.gradle.jvmargs=\"-Xms${config.jvmMemory}m -Xmx${config.jvmMaxMemory}m\"`;\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAS,cAAc,UAAoB,UAA8B;CAEvE,OADqB,OAAO,KAAK,QACf,CAAC,CAAC,QAAQ,QAAQ,iBAAiB,SAAS,IAAI,CAAC;AACrE;AAEA,SAAS,OAAO,EAAE,KAAK,WAA4C;CAEjE,MAAM,aAAa,aAAa,IAAI,UAAU;CAI9C,QAHiB,UACb,MAAM,KAAK,YAAY,MAAM,QAAQ,OAAO,CAAC,IAC7C,QACe;AACrB;AAEA,SAAS,kBAAkB,MAAmC;CAC5D,MAAM,0BAA0B,aAAa,IAAI,kBAAkB;CACnE,MAAM,WAAW,YAAY,IAAI;CACjC,MAAM,MAAM,OAAO,IAAI;CACvB,IAAI,UAAU,KAAK;CACnB,YAAY,0BAA0B,KAAK;CAK3C,OAAO;EACL;EACA,KAAK;EACL,WALgB,KAAK,aAAa,KAAK,OAAO;EAM9C;EACA,GAAI,KAAK,UAAU,KAAA,KAAa,EAAE,OAAO,KAAK,MAAM;EACpD,OAAO;EACP,QAAQ,KAAK,eA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B,OAAO,UAAU,QAAQ,OAAO,aAAa;AACpF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../lib/util/exec/index.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport type { RepoToolSettingsOptions } from '../../config/types.ts';\nimport { TEMPORARY_ERROR } from '../../constants/error-messages.ts';\nimport { logger } from '../../logger/index.ts';\nimport { getCustomEnv, getUserEnv } from '../env.ts';\nimport { coerceObject } from '../object.ts';\nimport { rawExec } from './common.ts';\nimport { generateInstallCommands, isDynamicInstall } from './containerbase.ts';\nimport {\n generateDockerCommand,\n removeDockerContainer,\n} from './docker/index.ts';\nimport { getHermitEnvs, isHermit } from './hermit.ts';\nimport type {\n CommandWithOptions,\n DockerOptions,\n ExecOptions,\n ExecResult,\n ExtraEnv,\n Opt,\n RawExecOptions,\n} from './types.ts';\nimport { getChildEnv } from './utils.ts';\n\nfunction dockerEnvVars(extraEnv: ExtraEnv, childEnv: ExtraEnv): string[] {\n const extraEnvKeys = Object.keys(extraEnv);\n return extraEnvKeys.filter((key) => isNonEmptyString(childEnv[key]));\n}\n\nfunction getCwd({ cwd, cwdFile }: ExecOptions): string | undefined {\n // TODO: types (#22198)\n const defaultCwd = GlobalConfig.get('localDir');\n const paramCwd = cwdFile\n ? upath.join(defaultCwd, upath.dirname(cwdFile))\n : cwd;\n return paramCwd ?? defaultCwd;\n}\n\nfunction getRawExecOptions(opts: ExecOptions): RawExecOptions {\n const defaultExecutionTimeout = GlobalConfig.get('executionTimeout');\n const childEnv = getChildEnv(opts);\n const cwd = getCwd(opts);\n let timeout = opts.timeout;\n timeout ??= defaultExecutionTimeout * 60 * 1000;\n\n // Set default max buffer size to 10MB\n const maxBuffer = opts.maxBuffer ?? 10 * 1024 * 1024;\n\n return {\n cwd,\n env: childEnv,\n maxBuffer,\n timeout,\n ...(opts.shell !== undefined && { shell: opts.shell }),\n stdin: 'pipe',\n stdout: opts.ignoreStdout ? 'ignore' : 'pipe',\n stderr: 'pipe',\n };\n}\n\nfunction isDocker(docker: Opt<DockerOptions>): docker is DockerOptions {\n return GlobalConfig.get('binarySource') === 'docker' && !!docker;\n}\n\ninterface RawExecArguments {\n rawCommands: (string | CommandWithOptions)[];\n rawOptions: RawExecOptions;\n}\n\nasync function prepareRawExec(\n cmd:\n | string\n | string[]\n | CommandWithOptions[]\n | (string | CommandWithOptions)[],\n opts: ExecOptions,\n sideCarImage: string,\n): Promise<RawExecArguments> {\n const { docker } = opts;\n const preCommands = opts.preCommands ?? [];\n const customEnvVariables = getCustomEnv();\n const userConfiguredEnv = getUserEnv();\n const { containerbaseDir, binarySource } = GlobalConfig.get();\n\n if (binarySource === 'docker' || binarySource === 'install') {\n logger.debug(`Setting CONTAINERBASE_CACHE_DIR to ${containerbaseDir!}`);\n opts.env ??= {};\n opts.env.CONTAINERBASE_CACHE_DIR = containerbaseDir;\n }\n\n let rawOptions = getRawExecOptions(opts);\n\n let rawCommands = typeof cmd === 'string' ? [cmd] : cmd;\n\n if (isDocker(docker)) {\n logger.debug({ image: sideCarImage }, 'Using docker to execute');\n const extraEnv = {\n ...opts.extraEnv,\n ...customEnvVariables,\n ...userConfiguredEnv,\n };\n const childEnv = getChildEnv(opts);\n const envVars = [\n ...dockerEnvVars(extraEnv, childEnv),\n 'CONTAINERBASE_CACHE_DIR',\n ];\n const cwd = getCwd(opts);\n const dockerOptions: DockerOptions = { ...docker, cwd, envVars };\n const dockerCommand = await generateDockerCommand(\n rawCommands,\n [\n ...(await generateInstallCommands(opts.toolConstraints)),\n ...preCommands,\n ],\n dockerOptions,\n sideCarImage,\n );\n rawCommands = [dockerCommand];\n } else if (isDynamicInstall(opts.toolConstraints)) {\n logger.debug('Using containerbase dynamic installs');\n rawCommands = [\n ...(await generateInstallCommands(opts.toolConstraints)),\n ...preCommands,\n ...rawCommands,\n ];\n } else if (isHermit()) {\n const hermitEnvVars = await getHermitEnvs(rawOptions);\n logger.debug(\n { hermitEnvVars },\n 'merging hermit environment variables into the execution options',\n );\n rawOptions = {\n ...rawOptions,\n env: {\n ...rawOptions.env,\n ...hermitEnvVars,\n },\n };\n }\n\n if (\n GlobalConfig.get('binarySource') === 'global' &&\n opts.toolConstraints?.length\n ) {\n logger.once.debug(\n { toolConstraints: opts.toolConstraints },\n 'Ignoring tool contraints because of `binarySource=global`',\n );\n }\n\n return { rawCommands, rawOptions };\n}\n\nexport async function exec(\n cmd:\n | string\n | string[]\n | CommandWithOptions[]\n | (string | CommandWithOptions)[],\n opts: ExecOptions = {},\n): Promise<ExecResult> {\n const { docker } = opts;\n const dockerChildPrefix = GlobalConfig.get('dockerChildPrefix');\n const sideCarImage = GlobalConfig.get('dockerSidecarImage');\n\n const { rawCommands, rawOptions } = await prepareRawExec(\n cmd,\n opts,\n sideCarImage,\n );\n const useDocker = isDocker(docker);\n\n let res: ExecResult = { stdout: '', stderr: '' };\n for (const rawCmd of rawCommands) {\n const startTime = Date.now();\n if (useDocker) {\n await removeDockerContainer(sideCarImage, dockerChildPrefix);\n }\n logger.debug(\n { command: rawCmd, env: Object.keys(coerceObject(rawOptions.env)) },\n 'Executing command',\n );\n logger.trace({ commandOptions: rawOptions }, 'Command options');\n try {\n res = await rawExec(rawCmd, rawOptions);\n } catch (err) {\n const durationMs = Math.round(Date.now() - startTime);\n logger.debug({ err, durationMs }, 'rawExec err');\n if (useDocker) {\n await removeDockerContainer(sideCarImage, dockerChildPrefix).catch(\n (removeErr: Error) => {\n const message: string = err.message;\n throw new Error(\n `Error: \"${removeErr.message}\" - Original Error: \"${message}\"`,\n );\n },\n );\n }\n if (err.signal === `SIGTERM`) {\n logger.debug(\n { err },\n 'exec interrupted by SIGTERM - run needs to be aborted',\n );\n throw new Error(TEMPORARY_ERROR);\n }\n throw err;\n }\n const durationMs = Math.round(Date.now() - startTime);\n logger.debug(\n {\n durationMs,\n stdout: res.stdout,\n stderr: res.stderr,\n },\n 'exec completed',\n );\n }\n\n return res;\n}\n\n/**\n * When we resolve `toolSettings` in `getToolSettingsOptions`, we provide a stronger type than our input types, because we set defaults on config options.\n *\n * We do not have a default that is set for `nodeMaxMemory`, so it must remain as optional.\n */\ntype ResolvedToolSettingsOptions = Required<\n Omit<RepoToolSettingsOptions, 'nodeMaxMemory'>\n> &\n Pick<RepoToolSettingsOptions, 'nodeMaxMemory'>;\n\nexport function getToolSettingsOptions(\n repoConfig?: RepoToolSettingsOptions,\n): ResolvedToolSettingsOptions {\n let defaults = GlobalConfig.get('toolSettings');\n defaults ??= {\n jvmMaxMemory: 512,\n jvmMemory: 512,\n };\n\n const jvmMaxMemory = defaults?.jvmMaxMemory ?? 512;\n const options: ResolvedToolSettingsOptions = {\n jvmMaxMemory,\n jvmMemory: defaults?.jvmMemory ?? jvmMaxMemory,\n nodeMaxMemory: defaults?.nodeMaxMemory,\n };\n\n if (repoConfig !== undefined) {\n if (repoConfig.jvmMaxMemory) {\n if (repoConfig.jvmMaxMemory > options.jvmMaxMemory) {\n logger.once.debug(\n `A higher jvmMaxMemory (${repoConfig.jvmMaxMemory}) than the global configuration (${options.jvmMaxMemory}) is not permitted for Java VM invocations. Using global configuration instead`,\n );\n }\n\n options.jvmMaxMemory = Math.min(\n options.jvmMaxMemory,\n repoConfig.jvmMaxMemory,\n );\n }\n\n if (repoConfig.jvmMemory) {\n options.jvmMemory = repoConfig.jvmMemory;\n }\n\n if (repoConfig.nodeMaxMemory) {\n if (\n options.nodeMaxMemory &&\n repoConfig.nodeMaxMemory > options.nodeMaxMemory\n ) {\n logger.once.debug(\n `A higher nodeMaxMemory (${repoConfig.nodeMaxMemory}) than the global configuration (${options.nodeMaxMemory}) is not permitted for Node invocations. Using global configuration instead`,\n );\n } else {\n options.nodeMaxMemory = repoConfig.nodeMaxMemory;\n }\n }\n }\n\n options.jvmMaxMemory = Math.floor(options.jvmMaxMemory);\n options.jvmMemory = Math.floor(options.jvmMemory);\n if (options.nodeMaxMemory) {\n options.nodeMaxMemory = Math.floor(options.nodeMaxMemory);\n }\n\n // make sure that the starting memory can't be more than the max memory\n options.jvmMemory = Math.min(options.jvmMemory, options.jvmMaxMemory);\n\n if (options.jvmMaxMemory < 512 || options.jvmMemory < 512) {\n options.jvmMaxMemory = Math.max(options.jvmMaxMemory, 512);\n\n logger.once.debug(\n 'Overriding low memory settings for Java VM invocations to a minimum of 512M',\n );\n options.jvmMemory = Math.max(options.jvmMemory, 512);\n }\n\n return options;\n}\n\nexport function gradleJvmArg(config: RepoToolSettingsOptions): string {\n return ` -Dorg.gradle.jvmargs=\"-Xms${config.jvmMemory}m -Xmx${config.jvmMaxMemory}m\"`;\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAS,cAAc,UAAoB,UAA8B;CAEvE,OADqB,OAAO,KAAK,QACf,CAAC,CAAC,QAAQ,QAAQ,iBAAiB,SAAS,IAAI,CAAC;AACrE;AAEA,SAAS,OAAO,EAAE,KAAK,WAA4C;CAEjE,MAAM,aAAa,aAAa,IAAI,UAAU;CAI9C,QAHiB,UACb,MAAM,KAAK,YAAY,MAAM,QAAQ,OAAO,CAAC,IAC7C,QACe;AACrB;AAEA,SAAS,kBAAkB,MAAmC;CAC5D,MAAM,0BAA0B,aAAa,IAAI,kBAAkB;CACnE,MAAM,WAAW,YAAY,IAAI;CACjC,MAAM,MAAM,OAAO,IAAI;CACvB,IAAI,UAAU,KAAK;CACnB,YAAY,0BAA0B,KAAK;CAK3C,OAAO;EACL;EACA,KAAK;EACL,WALgB,KAAK,aAAa;EAMlC;EACA,GAAI,KAAK,UAAU,KAAA,KAAa,EAAE,OAAO,KAAK,MAAM;EACpD,OAAO;EACP,QAAQ,KAAK,eAAe,WAAW;EACvC,QAAQ;CACV;AACF;AAEA,SAAS,SAAS,QAAqD;CACrE,OAAO,aAAa,IAAI,cAAc,MAAM,YAAY,CAAC,CAAC;AAC5D;AAOA,eAAe,eACb,KAKA,MACA,cAC2B;CAC3B,MAAM,EAAE,WAAW;CACnB,MAAM,cAAc,KAAK,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cAAc;EACd,WAAW;CACb;CAEA,MAAM,eAAe,UAAU,gBAAgB;CAC/C,MAAM,UAAuC;EAC3C;EACA,WAAW,UAAU,aAAa;EAClC,eAAe,UAAU;CAC3B;CAEA,IAAI,eAAe,KAAA,GAAW;EAC5B,IAAI,WAAW,cAAc;GAC3B,IAAI,WAAW,eAAe,QAAQ,cACpC,OAAO,KAAK,MACV,0BAA0B,WAAW,aAAa,mCAAmC,QAAQ,aAAa,+EAC5G;GAGF,QAAQ,eAAe,KAAK,IAC1B,QAAQ,cACR,WAAW,YACb;EACF;EAEA,IAAI,WAAW,WACb,QAAQ,YAAY,WAAW;EAGjC,IAAI,WAAW,eACb,IACE,QAAQ,iBACR,WAAW,gBAAgB,QAAQ,eAEnC,OAAO,KAAK,MACV,2BAA2B,WAAW,cAAc,mCAAmC,QAAQ,cAAc,4EAC/G;OAEA,QAAQ,gBAAgB,WAAW;CAGzC;CAEA,QAAQ,eAAe,KAAK,MAAM,QAAQ,YAAY;CACtD,QAAQ,YAAY,KAAK,MAAM,QAAQ,SAAS;CAChD,IAAI,QAAQ,eACV,QAAQ,gBAAgB,KAAK,MAAM,QAAQ,aAAa;CAI1D,QAAQ,YAAY,KAAK,IAAI,QAAQ,WAAW,QAAQ,YAAY;CAEpE,IAAI,QAAQ,eAAe,OAAO,QAAQ,YAAY,KAAK;EACzD,QAAQ,eAAe,KAAK,IAAI,QAAQ,cAAc,GAAG;EAEzD,OAAO,KAAK,MACV,6EACF;EACA,QAAQ,YAAY,KAAK,IAAI,QAAQ,WAAW,GAAG;CACrD;CAEA,OAAO;AACT;AAEA,SAAgB,aAAa,QAAyC;CACpE,OAAO,8BAA8B,OAAO,UAAU,QAAQ,OAAO,aAAa;AACpF"}
|
package/dist/util/fs/index.js
CHANGED
|
@@ -151,8 +151,9 @@ async function localPathIsSymbolicLink(pathName) {
|
|
|
151
151
|
async function findUpLocal(fileName, cwd) {
|
|
152
152
|
const localDir = GlobalConfig.get("localDir");
|
|
153
153
|
const absoluteCwd = upath.join(localDir, cwd);
|
|
154
|
+
const normalizedAbsoluteCwd = upath.normalizeSafe(absoluteCwd);
|
|
154
155
|
const res = await findUp(fileName, {
|
|
155
|
-
cwd:
|
|
156
|
+
cwd: normalizedAbsoluteCwd,
|
|
156
157
|
type: "file"
|
|
157
158
|
});
|
|
158
159
|
if (!isNonEmptyString(res) || !isNonEmptyString(localDir)) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../lib/util/fs/index.ts"],"sourcesContent":["import stream from 'node:stream';\nimport util from 'node:util';\nimport { isNonEmptyString } from '@sindresorhus/is';\nimport { findUp } from 'find-up';\nimport fs from 'fs-extra';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { logger } from '../../logger/index.ts';\nimport { logWarningIfUnicodeHiddenCharactersInPackageFile } from '../unicode.ts';\nimport { ensureCachePath, ensureLocalPath, isValidPath } from './util.ts';\n\nexport const pipeline = util.promisify(stream.pipeline);\n\nexport function getParentDir(fileName: string): string {\n return upath.parse(fileName).dir;\n}\n\nexport function getSiblingFileName(\n fileName: string,\n siblingName: string,\n): string {\n const subDirectory = getParentDir(fileName);\n return upath.join(subDirectory, siblingName);\n}\n\nexport async function readLocalFile(fileName: string): Promise<Buffer | null>;\nexport async function readLocalFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string | null>;\nexport async function readLocalFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer | null> {\n const localFileName = ensureLocalPath(fileName);\n try {\n const fileContent = encoding\n ? await fs.readFile(localFileName, encoding)\n : await fs.readFile(localFileName);\n\n logWarningIfUnicodeHiddenCharactersInPackageFile(fileName, fileContent);\n\n return fileContent;\n } catch (err) {\n logger.trace({ err }, 'Error reading local file');\n return null;\n }\n}\n\nexport async function readLocalSymlink(\n fileName: string,\n): Promise<string | null> {\n const localFileName = ensureLocalPath(fileName);\n try {\n const linkContent = await fs.readlink(localFileName);\n return linkContent;\n } catch (err) {\n logger.trace({ err }, 'Error reading local symlink');\n return null;\n }\n}\n\nexport async function writeLocalFile(\n fileName: string,\n fileContent: string | Buffer,\n): Promise<void> {\n const localFileName = ensureLocalPath(fileName);\n await fs.outputFile(localFileName, fileContent);\n}\n\nexport async function deleteLocalFile(fileName: string): Promise<void> {\n // This a failsafe and hopefully will never be triggered\n if (GlobalConfig.get('platform') === 'local') {\n throw new Error('Cannot delete file when platform=local');\n }\n const localDir = GlobalConfig.get('localDir');\n if (localDir) {\n const localFileName = ensureLocalPath(fileName);\n await fs.remove(localFileName);\n }\n}\n\nexport async function renameLocalFile(\n fromFile: string,\n toFile: string,\n): Promise<void> {\n const fromPath = ensureLocalPath(fromFile);\n const toPath = ensureLocalPath(toFile);\n await fs.move(fromPath, toPath);\n}\n\nexport async function renameCacheFile(\n fromFile: string,\n toFile: string,\n): Promise<void> {\n const fromPath = ensureCachePath(fromFile);\n const toPath = ensureCachePath(toFile);\n await fs.rename(fromPath, toPath);\n}\n\nexport async function ensureDir(dirName: string): Promise<void> {\n // v8 ignore else -- TODO: add test #40625\n if (isNonEmptyString(dirName)) {\n await fs.ensureDir(dirName);\n }\n}\n\nexport async function ensureLocalDir(dirName: string): Promise<string> {\n const fullPath = ensureLocalPath(dirName);\n await fs.ensureDir(fullPath);\n return fullPath;\n}\n\nexport async function ensureCacheDir(name: string): Promise<string> {\n const cacheDirName = ensureCachePath(`others/${name}`);\n await fs.ensureDir(cacheDirName);\n return cacheDirName;\n}\n\n/**\n * Return the path of the private cache directory. This directory is wiped\n * between repositories, so they can be used to store private registries' index\n * without risk of that information leaking to other repositories/users.\n */\nexport function privateCacheDir(): string {\n // TODO: types (#22198)\n const cacheDir = GlobalConfig.get('cacheDir');\n return upath.join(cacheDir, '__renovate-private-cache');\n}\n\nexport async function localPathExists(pathName: string): Promise<boolean> {\n // Works for both files as well as directories\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.stat(path);\n return !!s;\n } catch {\n return false;\n }\n}\n\n/**\n * Validate local path without throwing.\n * @param path Path to check\n * @returns `true` if given `path` is a valid local path, otherwise `false`.\n */\nexport function isValidLocalPath(path: string): boolean {\n return isValidPath(path, 'localDir');\n}\n\n/**\n * Tries to find `otherFileName` in the directory where\n * `existingFileNameWithPath` is, then in its parent directory, then in the\n * grandparent, until we reach the top-level directory. All paths\n * must be relative to `localDir`.\n */\nexport async function findLocalSiblingOrParent(\n existingFileNameWithPath: string,\n otherFileName: string,\n): Promise<string | null> {\n if (upath.isAbsolute(existingFileNameWithPath)) {\n return null;\n }\n if (upath.isAbsolute(otherFileName)) {\n return null;\n }\n\n let current = existingFileNameWithPath;\n while (current !== '') {\n current = getParentDir(current);\n const candidate = upath.join(current, otherFileName);\n if (await localPathExists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n}\n\n/**\n * Get files by name from directory\n */\nexport async function readLocalDirectory(path: string): Promise<string[]> {\n const localPath = ensureLocalPath(path);\n const fileList = await fs.readdir(localPath);\n return fileList;\n}\n\nexport function createCacheWriteStream(path: string): fs.WriteStream {\n const fullPath = ensureCachePath(path);\n return fs.createWriteStream(fullPath);\n}\n\nexport function createCacheReadStream(path: string): fs.ReadStream {\n const fullPath = ensureCachePath(path);\n return fs.createReadStream(fullPath);\n}\n\nexport async function localPathIsFile(pathName: string): Promise<boolean> {\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.stat(path);\n return s.isFile();\n } catch {\n return false;\n }\n}\n\nexport async function localPathIsSymbolicLink(\n pathName: string,\n): Promise<boolean> {\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.lstat(path);\n return s.isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n/**\n * Find a file or directory by walking up parent directories within localDir\n */\n\nexport async function findUpLocal(\n fileName: string | string[],\n cwd: string,\n): Promise<string | null> {\n // TODO: types (#22198)\n const localDir = GlobalConfig.get('localDir');\n const absoluteCwd = upath.join(localDir, cwd);\n const normalizedAbsoluteCwd = upath.normalizeSafe(absoluteCwd);\n const res = await findUp(fileName, {\n cwd: normalizedAbsoluteCwd,\n type: 'file',\n });\n // Return null if nothing found\n if (!isNonEmptyString(res) || !isNonEmptyString(localDir)) {\n return null;\n }\n const safePath = upath.normalizeSafe(res);\n // Return relative path if file is inside of local dir\n if (safePath.startsWith(localDir)) {\n let relativePath = safePath.replace(localDir, '');\n // v8 ignore else -- TODO: add test #40625\n if (relativePath.startsWith('/')) {\n relativePath = relativePath.substring(1);\n }\n return relativePath;\n }\n // Return null if found file is outside of localDir\n return null;\n}\n\nexport function chmodLocalFile(\n fileName: string,\n mode: string | number,\n): Promise<void> {\n const fullFileName = ensureLocalPath(fileName);\n return fs.chmod(fullFileName, mode);\n}\n\nexport async function statLocalFile(\n fileName: string,\n): Promise<fs.Stats | null> {\n const fullFileName = ensureLocalPath(fileName);\n try {\n return await fs.stat(fullFileName);\n } catch {\n return null;\n }\n}\n\nexport async function statCacheFile(\n pathName: string,\n): Promise<fs.Stats | null> {\n const path = ensureCachePath(pathName);\n try {\n return await fs.stat(path);\n } catch {\n return null;\n }\n}\n\nexport function listCacheDir(\n path: string,\n options: { recursive: boolean } = { recursive: false },\n): Promise<string[]> {\n const fullPath = ensureCachePath(path);\n return fs.readdir(fullPath, {\n encoding: 'utf-8',\n recursive: options.recursive,\n });\n}\n\nexport async function rmCache(path: string): Promise<void> {\n const fullPath = ensureCachePath(path);\n // force: a missing path is a no-op, callers use this for cleanup\n await fs.rm(fullPath, { recursive: true, force: true });\n}\n\nexport async function cachePathExists(pathName: string): Promise<boolean> {\n const path = ensureCachePath(pathName);\n try {\n const s = await fs.stat(path);\n return !!s;\n } catch {\n return false;\n }\n}\n\nexport async function cachePathIsFile(pathName: string): Promise<boolean> {\n const path = ensureCachePath(pathName);\n try {\n const s = await fs.stat(path);\n return s.isFile();\n } catch {\n return false;\n }\n}\n\nexport async function readCacheFile(fileName: string): Promise<Buffer>;\nexport async function readCacheFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string>;\nexport function readCacheFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer> {\n const fullPath = ensureCachePath(fileName);\n return encoding ? fs.readFile(fullPath, encoding) : fs.readFile(fullPath);\n}\n\nexport function outputCacheFile(\n file: string,\n data: string | NodeJS.ArrayBufferView,\n): Promise<void> {\n const filePath = ensureCachePath(file);\n return fs.outputFile(filePath, data);\n}\n\nexport async function readSystemFile(fileName: string): Promise<Buffer>;\nexport async function readSystemFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string>;\nexport function readSystemFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer> {\n return encoding ? fs.readFile(fileName, encoding) : fs.readFile(fileName);\n}\n\nexport async function writeSystemFile(\n fileName: string,\n data: string | Buffer,\n): Promise<void> {\n await fs.outputFile(fileName, data);\n}\n\nexport async function getLocalFiles(\n fileNames: string[],\n): Promise<Record<string, string | null>> {\n const fileContentMap: Record<string, string | null> = {};\n\n for (const fileName of fileNames) {\n fileContentMap[fileName] = await readLocalFile(fileName, 'utf8');\n }\n\n return fileContentMap;\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,WAAW,KAAK,UAAU,OAAO,QAAQ;AAEtD,SAAgB,aAAa,UAA0B;CACrD,OAAO,MAAM,MAAM,QAAQ,CAAC,CAAC;AAC/B;AAEA,SAAgB,mBACd,UACA,aACQ;CACR,MAAM,eAAe,aAAa,QAAQ;CAC1C,OAAO,MAAM,KAAK,cAAc,WAAW;AAC7C;AAOA,eAAsB,cACpB,UACA,UACiC;CACjC,MAAM,gBAAgB,gBAAgB,QAAQ;CAC9C,IAAI;EACF,MAAM,cAAc,WAChB,MAAM,GAAG,SAAS,eAAe,QAAQ,IACzC,MAAM,GAAG,SAAS,aAAa;EAEnC,iDAAiD,UAAU,WAAW;EAEtE,OAAO;CACT,SAAS,KAAK;EACZ,OAAO,MAAM,EAAE,IAAI,GAAG,0BAA0B;EAChD,OAAO;CACT;AACF;AAEA,eAAsB,iBACpB,UACwB;CACxB,MAAM,g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,UAAoC;CACxE,MAAM,OAAO,gBAAgB,QAAQ;CACrC,IAAI;EAEF,QAAO,MADS,GAAG,KAAK,IAAI,EAAA,CACnB,OAAO;CAClB,QAAQ;EACN,OAAO;CACT;AACF;AAOA,SAAgB,cACd,UACA,UAC0B;CAC1B,MAAM,WAAW,gBAAgB,QAAQ;CACzC,OAAO,WAAW,GAAG,SAAS,UAAU,QAAQ,IAAI,GAAG,SAAS,QAAQ;AAC1E;AAEA,SAAgB,gBACd,MACA,MACe;CACf,MAAM,WAAW,gBAAgB,IAAI;CACrC,OAAO,GAAG,WAAW,UAAU,IAAI;AACrC;AAOA,SAAgB,eACd,UACA,UAC0B;CAC1B,OAAO,WAAW,GAAG,SAAS,UAAU,QAAQ,IAAI,GAAG,SAAS,QAAQ;AAC1E;AAEA,eAAsB,gBACpB,UACA,MACe;CACf,MAAM,GAAG,WAAW,UAAU,IAAI;AACpC;AAEA,eAAsB,cACpB,WACwC;CACxC,MAAM,iBAAgD,CAAC;CAEvD,KAAK,MAAM,YAAY,WACrB,eAAe,YAAY,MAAM,cAAc,UAAU,MAAM;CAGjE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../lib/util/fs/index.ts"],"sourcesContent":["import stream from 'node:stream';\nimport util from 'node:util';\nimport { isNonEmptyString } from '@sindresorhus/is';\nimport { findUp } from 'find-up';\nimport fs from 'fs-extra';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { logger } from '../../logger/index.ts';\nimport { logWarningIfUnicodeHiddenCharactersInPackageFile } from '../unicode.ts';\nimport { ensureCachePath, ensureLocalPath, isValidPath } from './util.ts';\n\nexport const pipeline = util.promisify(stream.pipeline);\n\nexport function getParentDir(fileName: string): string {\n return upath.parse(fileName).dir;\n}\n\nexport function getSiblingFileName(\n fileName: string,\n siblingName: string,\n): string {\n const subDirectory = getParentDir(fileName);\n return upath.join(subDirectory, siblingName);\n}\n\nexport async function readLocalFile(fileName: string): Promise<Buffer | null>;\nexport async function readLocalFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string | null>;\nexport async function readLocalFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer | null> {\n const localFileName = ensureLocalPath(fileName);\n try {\n const fileContent = encoding\n ? await fs.readFile(localFileName, encoding)\n : await fs.readFile(localFileName);\n\n logWarningIfUnicodeHiddenCharactersInPackageFile(fileName, fileContent);\n\n return fileContent;\n } catch (err) {\n logger.trace({ err }, 'Error reading local file');\n return null;\n }\n}\n\nexport async function readLocalSymlink(\n fileName: string,\n): Promise<string | null> {\n const localFileName = ensureLocalPath(fileName);\n try {\n const linkContent = await fs.readlink(localFileName);\n return linkContent;\n } catch (err) {\n logger.trace({ err }, 'Error reading local symlink');\n return null;\n }\n}\n\nexport async function writeLocalFile(\n fileName: string,\n fileContent: string | Buffer,\n): Promise<void> {\n const localFileName = ensureLocalPath(fileName);\n await fs.outputFile(localFileName, fileContent);\n}\n\nexport async function deleteLocalFile(fileName: string): Promise<void> {\n // This a failsafe and hopefully will never be triggered\n if (GlobalConfig.get('platform') === 'local') {\n throw new Error('Cannot delete file when platform=local');\n }\n const localDir = GlobalConfig.get('localDir');\n if (localDir) {\n const localFileName = ensureLocalPath(fileName);\n await fs.remove(localFileName);\n }\n}\n\nexport async function renameLocalFile(\n fromFile: string,\n toFile: string,\n): Promise<void> {\n const fromPath = ensureLocalPath(fromFile);\n const toPath = ensureLocalPath(toFile);\n await fs.move(fromPath, toPath);\n}\n\nexport async function renameCacheFile(\n fromFile: string,\n toFile: string,\n): Promise<void> {\n const fromPath = ensureCachePath(fromFile);\n const toPath = ensureCachePath(toFile);\n await fs.rename(fromPath, toPath);\n}\n\nexport async function ensureDir(dirName: string): Promise<void> {\n // v8 ignore else -- TODO: add test #40625\n if (isNonEmptyString(dirName)) {\n await fs.ensureDir(dirName);\n }\n}\n\nexport async function ensureLocalDir(dirName: string): Promise<string> {\n const fullPath = ensureLocalPath(dirName);\n await fs.ensureDir(fullPath);\n return fullPath;\n}\n\nexport async function ensureCacheDir(name: string): Promise<string> {\n const cacheDirName = ensureCachePath(`others/${name}`);\n await fs.ensureDir(cacheDirName);\n return cacheDirName;\n}\n\n/**\n * Return the path of the private cache directory. This directory is wiped\n * between repositories, so they can be used to store private registries' index\n * without risk of that information leaking to other repositories/users.\n */\nexport function privateCacheDir(): string {\n // TODO: types (#22198)\n const cacheDir = GlobalConfig.get('cacheDir');\n return upath.join(cacheDir, '__renovate-private-cache');\n}\n\nexport async function localPathExists(pathName: string): Promise<boolean> {\n // Works for both files as well as directories\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.stat(path);\n return !!s;\n } catch {\n return false;\n }\n}\n\n/**\n * Validate local path without throwing.\n * @param path Path to check\n * @returns `true` if given `path` is a valid local path, otherwise `false`.\n */\nexport function isValidLocalPath(path: string): boolean {\n return isValidPath(path, 'localDir');\n}\n\n/**\n * Tries to find `otherFileName` in the directory where\n * `existingFileNameWithPath` is, then in its parent directory, then in the\n * grandparent, until we reach the top-level directory. All paths\n * must be relative to `localDir`.\n */\nexport async function findLocalSiblingOrParent(\n existingFileNameWithPath: string,\n otherFileName: string,\n): Promise<string | null> {\n if (upath.isAbsolute(existingFileNameWithPath)) {\n return null;\n }\n if (upath.isAbsolute(otherFileName)) {\n return null;\n }\n\n let current = existingFileNameWithPath;\n while (current !== '') {\n current = getParentDir(current);\n const candidate = upath.join(current, otherFileName);\n if (await localPathExists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n}\n\n/**\n * Get files by name from directory\n */\nexport async function readLocalDirectory(path: string): Promise<string[]> {\n const localPath = ensureLocalPath(path);\n const fileList = await fs.readdir(localPath);\n return fileList;\n}\n\nexport function createCacheWriteStream(path: string): fs.WriteStream {\n const fullPath = ensureCachePath(path);\n return fs.createWriteStream(fullPath);\n}\n\nexport function createCacheReadStream(path: string): fs.ReadStream {\n const fullPath = ensureCachePath(path);\n return fs.createReadStream(fullPath);\n}\n\nexport async function localPathIsFile(pathName: string): Promise<boolean> {\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.stat(path);\n return s.isFile();\n } catch {\n return false;\n }\n}\n\nexport async function localPathIsSymbolicLink(\n pathName: string,\n): Promise<boolean> {\n const path = ensureLocalPath(pathName);\n try {\n const s = await fs.lstat(path);\n return s.isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n/**\n * Find a file or directory by walking up parent directories within localDir\n */\n\nexport async function findUpLocal(\n fileName: string | string[],\n cwd: string,\n): Promise<string | null> {\n // TODO: types (#22198)\n const localDir = GlobalConfig.get('localDir');\n const absoluteCwd = upath.join(localDir, cwd);\n const normalizedAbsoluteCwd = upath.normalizeSafe(absoluteCwd);\n const res = await findUp(fileName, {\n cwd: normalizedAbsoluteCwd,\n type: 'file',\n });\n // Return null if nothing found\n if (!isNonEmptyString(res) || !isNonEmptyString(localDir)) {\n return null;\n }\n const safePath = upath.normalizeSafe(res);\n // Return relative path if file is inside of local dir\n if (safePath.startsWith(localDir)) {\n let relativePath = safePath.replace(localDir, '');\n // v8 ignore else -- TODO: add test #40625\n if (relativePath.startsWith('/')) {\n relativePath = relativePath.substring(1);\n }\n return relativePath;\n }\n // Return null if found file is outside of localDir\n return null;\n}\n\nexport function chmodLocalFile(\n fileName: string,\n mode: string | number,\n): Promise<void> {\n const fullFileName = ensureLocalPath(fileName);\n return fs.chmod(fullFileName, mode);\n}\n\nexport async function statLocalFile(\n fileName: string,\n): Promise<fs.Stats | null> {\n const fullFileName = ensureLocalPath(fileName);\n try {\n return await fs.stat(fullFileName);\n } catch {\n return null;\n }\n}\n\nexport async function statCacheFile(\n pathName: string,\n): Promise<fs.Stats | null> {\n const path = ensureCachePath(pathName);\n try {\n return await fs.stat(path);\n } catch {\n return null;\n }\n}\n\nexport function listCacheDir(\n path: string,\n options: { recursive: boolean } = { recursive: false },\n): Promise<string[]> {\n const fullPath = ensureCachePath(path);\n return fs.readdir(fullPath, {\n encoding: 'utf-8',\n recursive: options.recursive,\n });\n}\n\nexport async function rmCache(path: string): Promise<void> {\n const fullPath = ensureCachePath(path);\n // force: a missing path is a no-op, callers use this for cleanup\n await fs.rm(fullPath, { recursive: true, force: true });\n}\n\nexport async function cachePathExists(pathName: string): Promise<boolean> {\n const path = ensureCachePath(pathName);\n try {\n const s = await fs.stat(path);\n return !!s;\n } catch {\n return false;\n }\n}\n\nexport async function cachePathIsFile(pathName: string): Promise<boolean> {\n const path = ensureCachePath(pathName);\n try {\n const s = await fs.stat(path);\n return s.isFile();\n } catch {\n return false;\n }\n}\n\nexport async function readCacheFile(fileName: string): Promise<Buffer>;\nexport async function readCacheFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string>;\nexport function readCacheFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer> {\n const fullPath = ensureCachePath(fileName);\n return encoding ? fs.readFile(fullPath, encoding) : fs.readFile(fullPath);\n}\n\nexport function outputCacheFile(\n file: string,\n data: string | NodeJS.ArrayBufferView,\n): Promise<void> {\n const filePath = ensureCachePath(file);\n return fs.outputFile(filePath, data);\n}\n\nexport async function readSystemFile(fileName: string): Promise<Buffer>;\nexport async function readSystemFile(\n fileName: string,\n encoding: 'utf8',\n): Promise<string>;\nexport function readSystemFile(\n fileName: string,\n encoding?: BufferEncoding,\n): Promise<string | Buffer> {\n return encoding ? fs.readFile(fileName, encoding) : fs.readFile(fileName);\n}\n\nexport async function writeSystemFile(\n fileName: string,\n data: string | Buffer,\n): Promise<void> {\n await fs.outputFile(fileName, data);\n}\n\nexport async function getLocalFiles(\n fileNames: string[],\n): Promise<Record<string, string | null>> {\n const fileContentMap: Record<string, string | null> = {};\n\n for (const fileName of fileNames) {\n fileContentMap[fileName] = await readLocalFile(fileName, 'utf8');\n }\n\n return fileContentMap;\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,WAAW,KAAK,UAAU,OAAO,QAAQ;AAEtD,SAAgB,aAAa,UAA0B;CACrD,OAAO,MAAM,MAAM,QAAQ,CAAC,CAAC;AAC/B;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).split("\n").map((line) => line.trim()).find((line) => line.startsWith(headPrefix)).replace(headPrefix, "");
|
|
101
101
|
}
|
|
102
102
|
return res.replace("origin/", "").trim();
|
|
103
|
-
} catch (err)
|
|
103
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
104
104
|
logger.debug({ err }, "Error getting default branch");
|
|
105
105
|
const errChecked = checkForPlatformFailure(err);
|
|
106
106
|
if (errChecked) throw errChecked;
|
|
@@ -130,7 +130,7 @@ async function validateGitVersion() {
|
|
|
130
130
|
return false;
|
|
131
131
|
}
|
|
132
132
|
version = `${major}.${minor}.${patch}`;
|
|
133
|
-
} catch (err)
|
|
133
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
134
134
|
logger.error({ err }, "Error fetching git version");
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
@@ -165,7 +165,7 @@ async function fetchBranchCommits(preferUpstream = true) {
|
|
|
165
165
|
});
|
|
166
166
|
if (isNonEmptyObject(config.virtualBranches)) for (const [name, branch] of Object.entries(config.virtualBranches)) config.branchCommits[name] = branch.sha;
|
|
167
167
|
logger.trace({ branchCommits: config.branchCommits }, "branch commits");
|
|
168
|
-
} catch (err)
|
|
168
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
169
169
|
const errChecked = checkForPlatformFailure(err);
|
|
170
170
|
if (errChecked) throw errChecked;
|
|
171
171
|
logger.debug({ err }, "git error");
|
|
@@ -243,7 +243,7 @@ async function writeGitAuthor() {
|
|
|
243
243
|
logger.debug(`Setting git author email: ${gitAuthorEmail}`);
|
|
244
244
|
await git.addConfig("user.email", gitAuthorEmail);
|
|
245
245
|
}
|
|
246
|
-
} catch (err)
|
|
246
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
247
247
|
const errChecked = checkForPlatformFailure(err);
|
|
248
248
|
if (errChecked) throw errChecked;
|
|
249
249
|
logger.debug({
|
|
@@ -270,7 +270,7 @@ async function getSubmodules() {
|
|
|
270
270
|
"--get-regexp",
|
|
271
271
|
"\\.path"
|
|
272
272
|
]) || "").trim().split(regEx(/[\n\s]/)).filter((_e, i) => i % 2);
|
|
273
|
-
} catch (err)
|
|
273
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
274
274
|
logger.warn({ err }, "Error getting submodules");
|
|
275
275
|
return [];
|
|
276
276
|
}
|
|
@@ -350,7 +350,7 @@ const syncGit = withInstrumenting({ name: "syncGit" }, async () => {
|
|
|
350
350
|
const durationMs = Math.round(Date.now() - fetchStart);
|
|
351
351
|
logger.info({ durationMs }, "git fetch completed");
|
|
352
352
|
clone = false;
|
|
353
|
-
} catch (err)
|
|
353
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
354
354
|
if (err.message === "empty") throw err;
|
|
355
355
|
logger.info({ err }, "git fetch error, falling back to git clone");
|
|
356
356
|
}
|
|
@@ -371,7 +371,7 @@ const syncGit = withInstrumenting({ name: "syncGit" }, async () => {
|
|
|
371
371
|
await git.clone(config.url, ".", opts);
|
|
372
372
|
}
|
|
373
373
|
await gitRetry(() => instrument("emptyDirAndClone", emptyDirAndClone));
|
|
374
|
-
} catch (err)
|
|
374
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
375
375
|
logger.debug({ err }, "git clone error");
|
|
376
376
|
if (err.message?.includes("No space left on device")) throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);
|
|
377
377
|
if (err.message === "empty") throw err;
|
|
@@ -382,7 +382,7 @@ const syncGit = withInstrumenting({ name: "syncGit" }, async () => {
|
|
|
382
382
|
});
|
|
383
383
|
try {
|
|
384
384
|
config.currentBranchSha = toLongCommitSha((await git.raw(["rev-parse", "HEAD"])).trim());
|
|
385
|
-
} catch (err)
|
|
385
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
386
386
|
if (err.message?.includes("fatal: not a git repository")) throw new Error(REPOSITORY_CHANGED);
|
|
387
387
|
throw err;
|
|
388
388
|
}
|
|
@@ -390,7 +390,7 @@ const syncGit = withInstrumenting({ name: "syncGit" }, async () => {
|
|
|
390
390
|
try {
|
|
391
391
|
const latestCommit = (await git.log({ n: 1 })).latest;
|
|
392
392
|
logger.debug({ latestCommit }, "latest repository commit");
|
|
393
|
-
} catch (err)
|
|
393
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
394
394
|
const errChecked = checkForPlatformFailure(err);
|
|
395
395
|
if (errChecked) throw errChecked;
|
|
396
396
|
if (err.message.includes("does not have any commits yet")) throw new Error(REPOSITORY_EMPTY);
|
|
@@ -492,7 +492,7 @@ async function getCommitMessages() {
|
|
|
492
492
|
format: { message: "%s" },
|
|
493
493
|
"--no-merges": null
|
|
494
494
|
})).all.map((commit) => commit.message);
|
|
495
|
-
} catch
|
|
495
|
+
} catch /* v8 ignore next -- TODO: add test #40625 */ {
|
|
496
496
|
return [];
|
|
497
497
|
}
|
|
498
498
|
}
|
|
@@ -521,7 +521,7 @@ async function checkoutBranch(branchName) {
|
|
|
521
521
|
}, "latest commit");
|
|
522
522
|
await git.reset(ResetMode.HARD);
|
|
523
523
|
return config.currentBranchSha;
|
|
524
|
-
} catch (err)
|
|
524
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
525
525
|
const errChecked = checkForPlatformFailure(err);
|
|
526
526
|
if (errChecked) throw errChecked;
|
|
527
527
|
if (err.message?.includes("fatal: ambiguous argument")) {
|
|
@@ -625,7 +625,7 @@ async function getFileList() {
|
|
|
625
625
|
"-r",
|
|
626
626
|
`refs/heads/${branch}`
|
|
627
627
|
]);
|
|
628
|
-
} catch (err)
|
|
628
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
629
629
|
if (err.message?.includes("fatal: Not a valid object name")) {
|
|
630
630
|
logger.debug({ err }, "Branch not found when checking branch list - aborting");
|
|
631
631
|
throw new Error(REPOSITORY_CHANGED);
|
|
@@ -661,7 +661,7 @@ async function isBranchBehindBase(branchName, baseBranch) {
|
|
|
661
661
|
}, `branch.isBehindBase(): ${isBehind}`);
|
|
662
662
|
setCachedBehindBaseResult(branchName, isBehind);
|
|
663
663
|
return isBehind;
|
|
664
|
-
} catch (err)
|
|
664
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
665
665
|
const errChecked = checkForPlatformFailure(err);
|
|
666
666
|
if (errChecked) throw errChecked;
|
|
667
667
|
throw err;
|
|
@@ -696,7 +696,7 @@ async function isBranchModified(branchName, baseBranch) {
|
|
|
696
696
|
committedAuthors.add(commit.author_email);
|
|
697
697
|
committedAuthors.add(commit.committer_email);
|
|
698
698
|
}
|
|
699
|
-
} catch (err)
|
|
699
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
700
700
|
if (err.message?.includes("fatal: bad revision")) {
|
|
701
701
|
logger.debug({ err }, "Remote branch not found when checking last commit author - aborting run");
|
|
702
702
|
throw new Error(REPOSITORY_CHANGED);
|
|
@@ -781,7 +781,7 @@ async function isBranchConflicted(baseBranch, branch) {
|
|
|
781
781
|
try {
|
|
782
782
|
await git.merge(["--abort"]);
|
|
783
783
|
if (origBranch !== baseBranch) await git.checkout(origBranch);
|
|
784
|
-
} catch (err)
|
|
784
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
785
785
|
logger.debug({
|
|
786
786
|
baseBranch,
|
|
787
787
|
branch,
|
|
@@ -930,7 +930,7 @@ async function getBranchFilesFromRef(refName) {
|
|
|
930
930
|
await syncGit();
|
|
931
931
|
try {
|
|
932
932
|
return (await gitRetry(() => git.diffSummary([refName, `${refName}^`]))).files.map((file) => file.file);
|
|
933
|
-
} catch (err)
|
|
933
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
934
934
|
logger.warn({ err }, "getBranchFilesFromRef error");
|
|
935
935
|
const errChecked = checkForPlatformFailure(err);
|
|
936
936
|
if (errChecked) throw errChecked;
|
|
@@ -1009,7 +1009,7 @@ async function prepareCommit({ branchName, files, message, trailers, force = fal
|
|
|
1009
1009
|
if (file.type === "deletion") try {
|
|
1010
1010
|
await git.rm([fileName]);
|
|
1011
1011
|
deletedFiles.push(fileName);
|
|
1012
|
-
} catch (err)
|
|
1012
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1013
1013
|
const errChecked = checkForPlatformFailure(err);
|
|
1014
1014
|
if (errChecked) throw errChecked;
|
|
1015
1015
|
logger.trace({
|
|
@@ -1039,7 +1039,7 @@ async function prepareCommit({ branchName, files, message, trailers, force = fal
|
|
|
1039
1039
|
fileName
|
|
1040
1040
|
]);
|
|
1041
1041
|
addedModifiedFiles.push(fileName);
|
|
1042
|
-
} catch (err)
|
|
1042
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1043
1043
|
if (!err.message.includes("The following paths are ignored by one of your .gitignore files")) throw err;
|
|
1044
1044
|
logger.debug(`Cannot commit ignored file: ${fileName}`);
|
|
1045
1045
|
ignoredFiles.push(file.path);
|
|
@@ -1076,7 +1076,7 @@ async function prepareCommit({ branchName, files, message, trailers, force = fal
|
|
|
1076
1076
|
return addedModifiedFiles.includes(fileChange.path);
|
|
1077
1077
|
})
|
|
1078
1078
|
};
|
|
1079
|
-
} catch (err)
|
|
1079
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1080
1080
|
return handleCommitError(err, branchName, files);
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
@@ -1097,7 +1097,7 @@ async function pushCommit({ sourceRef, targetRef, files, pushOptions }) {
|
|
|
1097
1097
|
incLimitedValue("Commits");
|
|
1098
1098
|
incCountValue("HourlyCommits");
|
|
1099
1099
|
result = true;
|
|
1100
|
-
} catch (err)
|
|
1100
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1101
1101
|
handleCommitError(err, sourceRef, files);
|
|
1102
1102
|
}
|
|
1103
1103
|
return result;
|
|
@@ -1116,7 +1116,7 @@ async function fetchBranch(branchName) {
|
|
|
1116
1116
|
config.branchCommits[branchName] = commit;
|
|
1117
1117
|
config.branchIsModified[branchName] = false;
|
|
1118
1118
|
return commit;
|
|
1119
|
-
} catch (err)
|
|
1119
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1120
1120
|
return handleCommitError(err, branchName);
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
@@ -1137,7 +1137,7 @@ async function commitFiles(commitConfig) {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
1139
|
return null;
|
|
1140
|
-
} catch (err)
|
|
1140
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1141
1141
|
if (err.message.includes("[rejected] (stale info)")) throw new Error(REPOSITORY_CHANGED);
|
|
1142
1142
|
throw err;
|
|
1143
1143
|
}
|
|
@@ -1205,7 +1205,7 @@ async function clearRenovateRefs() {
|
|
|
1205
1205
|
try {
|
|
1206
1206
|
const refs = (await git.listRemote([config.url, "refs/renovate/branches/*"])).split(newlineRegex).map((line) => line.replace(regEx(/[0-9a-f]+\s+/i), "").trim()).filter((line) => line.startsWith("refs/renovate/branches/"));
|
|
1207
1207
|
renovateRefs.push(...refs);
|
|
1208
|
-
} catch (err)
|
|
1208
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1209
1209
|
logger.warn({ err }, `Renovate refs cleanup error`);
|
|
1210
1210
|
}
|
|
1211
1211
|
// v8 ignore else -- TODO: add test #40625
|
|
@@ -1225,7 +1225,7 @@ async function clearRenovateRefs() {
|
|
|
1225
1225
|
ref
|
|
1226
1226
|
];
|
|
1227
1227
|
await git.push(pushOpts);
|
|
1228
|
-
} catch (err)
|
|
1228
|
+
} catch (err) /* v8 ignore next -- TODO: add test #40625 */ {
|
|
1229
1229
|
logger.debug({ err }, "Error deleting \"refs/renovate/branches/*\"");
|
|
1230
1230
|
break;
|
|
1231
1231
|
}
|
|
@@ -1298,14 +1298,12 @@ async function diffCommitTree(parentCommitSha, commitSha) {
|
|
|
1298
1298
|
sha: toLongCommitSha(newSha)
|
|
1299
1299
|
});
|
|
1300
1300
|
break;
|
|
1301
|
-
default:
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
});
|
|
1308
|
-
break;
|
|
1301
|
+
default: result.push({
|
|
1302
|
+
path: targetPath ?? sourcePath,
|
|
1303
|
+
mode: newMode,
|
|
1304
|
+
type: treeTypeFromMode(newMode),
|
|
1305
|
+
sha: toLongCommitSha(newSha)
|
|
1306
|
+
});
|
|
1309
1307
|
}
|
|
1310
1308
|
}
|
|
1311
1309
|
}
|
|
@@ -1340,7 +1338,7 @@ async function syncForkWithUpstream(branchName) {
|
|
|
1340
1338
|
else await checkoutBranchFromRemote(branchName, RENOVATE_FORK_UPSTREAM);
|
|
1341
1339
|
await resetHardFromRemote(`${RENOVATE_FORK_UPSTREAM}/${branchName}`);
|
|
1342
1340
|
await forcePushToRemote(branchName, "origin");
|
|
1343
|
-
} catch (err)
|
|
1341
|
+
} catch (err) /* v8 ignore next -- shouldn't happen */ {
|
|
1344
1342
|
logger.error({ err }, "Error synchronizing fork");
|
|
1345
1343
|
throw new Error(UNKNOWN_ERROR);
|
|
1346
1344
|
}
|
|
@@ -1352,7 +1350,7 @@ async function getRemotes() {
|
|
|
1352
1350
|
const remotes = await git.getRemotes();
|
|
1353
1351
|
logger.debug(`Found remotes: ${remotes.map((r) => r.name).join(", ")}`);
|
|
1354
1352
|
return remotes.map((remote) => remote.name);
|
|
1355
|
-
} catch (err)
|
|
1353
|
+
} catch (err) /* v8 ignore next -- git.getRemotes only fails on repo corruption, not simulated in specs */ {
|
|
1356
1354
|
logger.error({ err }, "Error getting remotes");
|
|
1357
1355
|
throw err;
|
|
1358
1356
|
}
|