renovate 44.85.0 → 44.86.0
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/constants/error-messages.d.ts +3 -2
- package/dist/constants/error-messages.js +3 -1
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/modules/manager/apm/artifacts.js +2 -1
- package/dist/modules/manager/apm/artifacts.js.map +1 -1
- package/dist/modules/manager/bazel-module/artifacts.js +2 -1
- package/dist/modules/manager/bazel-module/artifacts.js.map +1 -1
- package/dist/modules/manager/bazelisk/artifacts.js +2 -1
- package/dist/modules/manager/bazelisk/artifacts.js.map +1 -1
- package/dist/modules/manager/bun/artifacts.js +2 -1
- package/dist/modules/manager/bun/artifacts.js.map +1 -1
- package/dist/modules/manager/bundler/artifacts.js +1 -1
- package/dist/modules/manager/bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/bundler/common.js +11 -16
- package/dist/modules/manager/bundler/common.js.map +1 -1
- package/dist/modules/manager/cargo/artifacts.js +5 -3
- package/dist/modules/manager/cargo/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/artifacts.js +6 -7
- package/dist/modules/manager/composer/artifacts.js.map +1 -1
- package/dist/modules/manager/composer/utils.js +1 -10
- package/dist/modules/manager/composer/utils.js.map +1 -1
- package/dist/modules/manager/conan/artifacts.js +2 -1
- package/dist/modules/manager/conan/artifacts.js.map +1 -1
- package/dist/modules/manager/copier/artifacts.js +3 -3
- package/dist/modules/manager/copier/artifacts.js.map +1 -1
- package/dist/modules/manager/deno/artifacts.js +2 -1
- package/dist/modules/manager/deno/artifacts.js.map +1 -1
- package/dist/modules/manager/devbox/artifacts.js +8 -5
- package/dist/modules/manager/devbox/artifacts.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +34 -34
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/github-actions/artifacts.js +6 -4
- package/dist/modules/manager/github-actions/artifacts.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 +8 -6
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/artifacts.js +2 -1
- package/dist/modules/manager/gradle/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js +2 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/helmfile/artifacts.js +4 -3
- package/dist/modules/manager/helmfile/artifacts.js.map +1 -1
- package/dist/modules/manager/helmv3/artifacts.js +2 -1
- package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js +2 -1
- package/dist/modules/manager/jsonnet-bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/artifacts.js +4 -2
- package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
- package/dist/modules/manager/kustomize/common.js +2 -2
- package/dist/modules/manager/kustomize/common.js.map +1 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js +2 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/mise/artifacts.js +13 -11
- package/dist/modules/manager/mise/artifacts.js.map +1 -1
- package/dist/modules/manager/mix/artifacts.js +3 -2
- package/dist/modules/manager/mix/artifacts.js.map +1 -1
- package/dist/modules/manager/nix/artifacts.js +2 -1
- package/dist/modules/manager/nix/artifacts.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/post-update/node-version.js +2 -1
- package/dist/modules/manager/npm/post-update/node-version.js.map +1 -1
- package/dist/modules/manager/npm/post-update/npm.js +2 -1
- package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/pnpm.js +2 -1
- package/dist/modules/manager/npm/post-update/pnpm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js +5 -3
- package/dist/modules/manager/npm/post-update/yarn.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/pep621/processors/pdm.js +3 -2
- package/dist/modules/manager/pep621/processors/pdm.js.map +1 -1
- package/dist/modules/manager/pep621/processors/pixi.js +4 -3
- package/dist/modules/manager/pep621/processors/pixi.js.map +1 -1
- package/dist/modules/manager/pep621/processors/uv.js +3 -3
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pip-compile/common.js +14 -36
- package/dist/modules/manager/pip-compile/common.js.map +1 -1
- package/dist/modules/manager/pip_requirements/artifacts.js +3 -2
- package/dist/modules/manager/pip_requirements/artifacts.js.map +1 -1
- package/dist/modules/manager/pipenv/artifacts.js +3 -2
- package/dist/modules/manager/pipenv/artifacts.js.map +1 -1
- package/dist/modules/manager/pixi/artifacts.js +2 -1
- package/dist/modules/manager/pixi/artifacts.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/pub/artifacts.js +11 -10
- package/dist/modules/manager/pub/artifacts.js.map +1 -1
- package/dist/modules/manager/types.d.ts +23 -3
- package/dist/modules/manager/util.js +28 -1
- package/dist/modules/manager/util.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/gitlab/index.js +11 -3
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/workers/repository/error.js +5 -0
- package/dist/workers/repository/error.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +2 -2
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/updates/generate.js +11 -4
- package/dist/workers/repository/updates/generate.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
- package/dist/modules/manager/copier/utils.js +0 -24
- package/dist/modules/manager/copier/utils.js.map +0 -1
|
@@ -34,10 +34,11 @@ declare const REPOSITORY_FORKED = "fork";
|
|
|
34
34
|
declare const REPOSITORY_MIRRORED = "mirror";
|
|
35
35
|
declare const REPOSITORY_NOT_FOUND = "not-found";
|
|
36
36
|
declare const REPOSITORY_NO_PACKAGE_FILES = "no-package-files";
|
|
37
|
+
declare const REPOSITORY_PENDING_DELETION = "pending-deletion";
|
|
37
38
|
declare const REPOSITORY_RENAMED = "renamed";
|
|
38
39
|
declare const REPOSITORY_UNINITIATED = "uninitiated";
|
|
39
40
|
/** cause repo to be considered as disabled */
|
|
40
|
-
declare const RepositoryErrors: readonly ["forbidden", "archived", "blocked", "cannot-fork", "disabled", "disabled-closed-onboarding", "disabled-by-config", "disabled-no-config", "empty", "fork-missing", "fork-mode-forked", "fork", "mirror", "not-found", "no-package-files", "renamed", "uninitiated"];
|
|
41
|
+
declare const RepositoryErrors: readonly ["forbidden", "archived", "blocked", "cannot-fork", "disabled", "disabled-closed-onboarding", "disabled-by-config", "disabled-no-config", "empty", "fork-missing", "fork-mode-forked", "fork", "mirror", "not-found", "no-package-files", "pending-deletion", "renamed", "uninitiated"];
|
|
41
42
|
declare const REPOSITORY_CHANGED = "repository-changed";
|
|
42
43
|
declare const TEMPORARY_ERROR = "temporary-error";
|
|
43
44
|
declare const NO_VULNERABILITY_ALERTS = "no-vulnerability-alerts";
|
|
@@ -58,5 +59,5 @@ declare const MISSING_API_CREDENTIALS = "missing-api-credentials";
|
|
|
58
59
|
/** Logger not initialized */
|
|
59
60
|
declare const LOGGER_NOT_INITIALIZED = "logger-not-initialized";
|
|
60
61
|
//#endregion
|
|
61
|
-
export { BUNDLER_INVALID_CREDENTIALS, CONFIG_GIT_URL_UNAVAILABLE, CONFIG_INHERIT_NOT_FOUND, CONFIG_INHERIT_PARSE_ERROR, CONFIG_PRESETS_INVALID, CONFIG_SECRETS_EXPOSED, CONFIG_SECRETS_INVALID, CONFIG_VALIDATION, CONFIG_VARIABLES_INVALID, ConfigErrors, EXTERNAL_HOST_ERROR, FILE_ACCESS_VIOLATION_ERROR, HOST_BLOCKED, HOST_DISABLED, IGNORABLE_HOST_ERROR, INVALID_PATH, LOGGER_NOT_INITIALIZED, MANAGER_LOCKFILE_ERROR, MISSING_API_CREDENTIALS, NO_VULNERABILITY_ALERTS, PAGE_NOT_FOUND_ERROR, PLATFORM_AUTHENTICATION_ERROR, PLATFORM_BAD_CREDENTIALS, PLATFORM_GPG_FAILED, PLATFORM_INTEGRATION_UNAUTHORIZED, PLATFORM_NOT_FOUND, PLATFORM_RATE_LIMIT_EXCEEDED, PLATFORM_UNKNOWN_ERROR, PR_ALREADY_IN_MERGE_QUEUE, PlatformErrors, REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_BLOCKED, REPOSITORY_CANNOT_FORK, REPOSITORY_CHANGED, REPOSITORY_CLOSED_ONBOARDING, REPOSITORY_DISABLED, REPOSITORY_DISABLED_BY_CONFIG, REPOSITORY_EMPTY, REPOSITORY_FORKED, REPOSITORY_FORK_MISSING, REPOSITORY_FORK_MODE_FORKED, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, REPOSITORY_NO_CONFIG, REPOSITORY_NO_PACKAGE_FILES, REPOSITORY_RENAMED, REPOSITORY_UNINITIATED, RepositoryErrors, SYSTEM_INSUFFICIENT_DISK_SPACE, SYSTEM_INSUFFICIENT_MEMORY, SystemErrors, TEMPORARY_ERROR, TemporaryErrors, UNKNOWN_ERROR, WORKER_FILE_UPDATE_FAILED };
|
|
62
|
+
export { BUNDLER_INVALID_CREDENTIALS, CONFIG_GIT_URL_UNAVAILABLE, CONFIG_INHERIT_NOT_FOUND, CONFIG_INHERIT_PARSE_ERROR, CONFIG_PRESETS_INVALID, CONFIG_SECRETS_EXPOSED, CONFIG_SECRETS_INVALID, CONFIG_VALIDATION, CONFIG_VARIABLES_INVALID, ConfigErrors, EXTERNAL_HOST_ERROR, FILE_ACCESS_VIOLATION_ERROR, HOST_BLOCKED, HOST_DISABLED, IGNORABLE_HOST_ERROR, INVALID_PATH, LOGGER_NOT_INITIALIZED, MANAGER_LOCKFILE_ERROR, MISSING_API_CREDENTIALS, NO_VULNERABILITY_ALERTS, PAGE_NOT_FOUND_ERROR, PLATFORM_AUTHENTICATION_ERROR, PLATFORM_BAD_CREDENTIALS, PLATFORM_GPG_FAILED, PLATFORM_INTEGRATION_UNAUTHORIZED, PLATFORM_NOT_FOUND, PLATFORM_RATE_LIMIT_EXCEEDED, PLATFORM_UNKNOWN_ERROR, PR_ALREADY_IN_MERGE_QUEUE, PlatformErrors, REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_BLOCKED, REPOSITORY_CANNOT_FORK, REPOSITORY_CHANGED, REPOSITORY_CLOSED_ONBOARDING, REPOSITORY_DISABLED, REPOSITORY_DISABLED_BY_CONFIG, REPOSITORY_EMPTY, REPOSITORY_FORKED, REPOSITORY_FORK_MISSING, REPOSITORY_FORK_MODE_FORKED, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, REPOSITORY_NO_CONFIG, REPOSITORY_NO_PACKAGE_FILES, REPOSITORY_PENDING_DELETION, REPOSITORY_RENAMED, REPOSITORY_UNINITIATED, RepositoryErrors, SYSTEM_INSUFFICIENT_DISK_SPACE, SYSTEM_INSUFFICIENT_MEMORY, SystemErrors, TEMPORARY_ERROR, TemporaryErrors, UNKNOWN_ERROR, WORKER_FILE_UPDATE_FAILED };
|
|
62
63
|
//# sourceMappingURL=error-messages.d.ts.map
|
|
@@ -51,6 +51,7 @@ const REPOSITORY_FORKED = "fork";
|
|
|
51
51
|
const REPOSITORY_MIRRORED = "mirror";
|
|
52
52
|
const REPOSITORY_NOT_FOUND = "not-found";
|
|
53
53
|
const REPOSITORY_NO_PACKAGE_FILES = "no-package-files";
|
|
54
|
+
const REPOSITORY_PENDING_DELETION = "pending-deletion";
|
|
54
55
|
const REPOSITORY_RENAMED = "renamed";
|
|
55
56
|
const REPOSITORY_UNINITIATED = "uninitiated";
|
|
56
57
|
/** cause repo to be considered as disabled */
|
|
@@ -70,6 +71,7 @@ const RepositoryErrors = [
|
|
|
70
71
|
REPOSITORY_MIRRORED,
|
|
71
72
|
REPOSITORY_NOT_FOUND,
|
|
72
73
|
REPOSITORY_NO_PACKAGE_FILES,
|
|
74
|
+
REPOSITORY_PENDING_DELETION,
|
|
73
75
|
REPOSITORY_RENAMED,
|
|
74
76
|
REPOSITORY_UNINITIATED
|
|
75
77
|
];
|
|
@@ -97,6 +99,6 @@ const MISSING_API_CREDENTIALS = "missing-api-credentials";
|
|
|
97
99
|
/** Logger not initialized */
|
|
98
100
|
const LOGGER_NOT_INITIALIZED = "logger-not-initialized";
|
|
99
101
|
//#endregion
|
|
100
|
-
export { BUNDLER_INVALID_CREDENTIALS, CONFIG_GIT_URL_UNAVAILABLE, CONFIG_INHERIT_NOT_FOUND, CONFIG_INHERIT_PARSE_ERROR, CONFIG_PRESETS_INVALID, CONFIG_SECRETS_EXPOSED, CONFIG_SECRETS_INVALID, CONFIG_VALIDATION, CONFIG_VARIABLES_INVALID, ConfigErrors, EXTERNAL_HOST_ERROR, FILE_ACCESS_VIOLATION_ERROR, HOST_BLOCKED, HOST_DISABLED, IGNORABLE_HOST_ERROR, INVALID_PATH, LOGGER_NOT_INITIALIZED, MANAGER_LOCKFILE_ERROR, MISSING_API_CREDENTIALS, NO_VULNERABILITY_ALERTS, PAGE_NOT_FOUND_ERROR, PLATFORM_AUTHENTICATION_ERROR, PLATFORM_BAD_CREDENTIALS, PLATFORM_GPG_FAILED, PLATFORM_INTEGRATION_UNAUTHORIZED, PLATFORM_NOT_FOUND, PLATFORM_RATE_LIMIT_EXCEEDED, PLATFORM_UNKNOWN_ERROR, PR_ALREADY_IN_MERGE_QUEUE, PlatformErrors, REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_BLOCKED, REPOSITORY_CANNOT_FORK, REPOSITORY_CHANGED, REPOSITORY_CLOSED_ONBOARDING, REPOSITORY_DISABLED, REPOSITORY_DISABLED_BY_CONFIG, REPOSITORY_EMPTY, REPOSITORY_FORKED, REPOSITORY_FORK_MISSING, REPOSITORY_FORK_MODE_FORKED, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, REPOSITORY_NO_CONFIG, REPOSITORY_NO_PACKAGE_FILES, REPOSITORY_RENAMED, REPOSITORY_UNINITIATED, RepositoryErrors, SYSTEM_INSUFFICIENT_DISK_SPACE, SYSTEM_INSUFFICIENT_MEMORY, SystemErrors, TEMPORARY_ERROR, TemporaryErrors, UNKNOWN_ERROR, WORKER_FILE_UPDATE_FAILED };
|
|
102
|
+
export { BUNDLER_INVALID_CREDENTIALS, CONFIG_GIT_URL_UNAVAILABLE, CONFIG_INHERIT_NOT_FOUND, CONFIG_INHERIT_PARSE_ERROR, CONFIG_PRESETS_INVALID, CONFIG_SECRETS_EXPOSED, CONFIG_SECRETS_INVALID, CONFIG_VALIDATION, CONFIG_VARIABLES_INVALID, ConfigErrors, EXTERNAL_HOST_ERROR, FILE_ACCESS_VIOLATION_ERROR, HOST_BLOCKED, HOST_DISABLED, IGNORABLE_HOST_ERROR, INVALID_PATH, LOGGER_NOT_INITIALIZED, MANAGER_LOCKFILE_ERROR, MISSING_API_CREDENTIALS, NO_VULNERABILITY_ALERTS, PAGE_NOT_FOUND_ERROR, PLATFORM_AUTHENTICATION_ERROR, PLATFORM_BAD_CREDENTIALS, PLATFORM_GPG_FAILED, PLATFORM_INTEGRATION_UNAUTHORIZED, PLATFORM_NOT_FOUND, PLATFORM_RATE_LIMIT_EXCEEDED, PLATFORM_UNKNOWN_ERROR, PR_ALREADY_IN_MERGE_QUEUE, PlatformErrors, REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_BLOCKED, REPOSITORY_CANNOT_FORK, REPOSITORY_CHANGED, REPOSITORY_CLOSED_ONBOARDING, REPOSITORY_DISABLED, REPOSITORY_DISABLED_BY_CONFIG, REPOSITORY_EMPTY, REPOSITORY_FORKED, REPOSITORY_FORK_MISSING, REPOSITORY_FORK_MODE_FORKED, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, REPOSITORY_NO_CONFIG, REPOSITORY_NO_PACKAGE_FILES, REPOSITORY_PENDING_DELETION, REPOSITORY_RENAMED, REPOSITORY_UNINITIATED, RepositoryErrors, SYSTEM_INSUFFICIENT_DISK_SPACE, SYSTEM_INSUFFICIENT_MEMORY, SystemErrors, TEMPORARY_ERROR, TemporaryErrors, UNKNOWN_ERROR, WORKER_FILE_UPDATE_FAILED };
|
|
101
103
|
|
|
102
104
|
//# sourceMappingURL=error-messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-messages.js","names":[],"sources":["../../lib/constants/error-messages.ts"],"sourcesContent":["// System error\nexport const SYSTEM_INSUFFICIENT_DISK_SPACE = 'disk-space';\nexport const SYSTEM_INSUFFICIENT_MEMORY = 'out-of-memory';\n\nexport const SystemErrors = [\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n SYSTEM_INSUFFICIENT_MEMORY,\n] as const;\n\n// Platform Error\nexport const PLATFORM_AUTHENTICATION_ERROR = 'authentication-error';\nexport const PLATFORM_BAD_CREDENTIALS = 'bad-credentials';\nexport const PLATFORM_GPG_FAILED = 'gpg-failed';\nexport const PLATFORM_INTEGRATION_UNAUTHORIZED = 'integration-unauthorized';\nexport const PLATFORM_NOT_FOUND = 'platform-not-found';\nexport const PLATFORM_RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded';\nexport const PLATFORM_UNKNOWN_ERROR = 'platform-unknown-error';\n\nexport const PlatformErrors = [\n PLATFORM_AUTHENTICATION_ERROR,\n PLATFORM_BAD_CREDENTIALS,\n PLATFORM_GPG_FAILED,\n PLATFORM_INTEGRATION_UNAUTHORIZED,\n PLATFORM_NOT_FOUND,\n PLATFORM_RATE_LIMIT_EXCEEDED,\n PLATFORM_UNKNOWN_ERROR,\n] as const;\n\n// Config Error\nexport const CONFIG_VALIDATION = 'config-validation';\nexport const CONFIG_PRESETS_INVALID = 'config-presets-invalid';\nexport const CONFIG_SECRETS_EXPOSED = 'config-secrets-exposed';\nexport const CONFIG_SECRETS_INVALID = 'config-secrets-invalid';\nexport const CONFIG_VARIABLES_INVALID = 'config-variables-invalid';\nexport const CONFIG_GIT_URL_UNAVAILABLE = 'config-git-url-unavailable';\nexport const CONFIG_INHERIT_NOT_FOUND = 'config-inherit-not-found';\nexport const CONFIG_INHERIT_PARSE_ERROR = 'config-inherit-parse-error';\n\nexport const ConfigErrors = [\n CONFIG_VALIDATION,\n CONFIG_PRESETS_INVALID,\n CONFIG_SECRETS_EXPOSED,\n CONFIG_SECRETS_INVALID,\n CONFIG_VARIABLES_INVALID,\n CONFIG_GIT_URL_UNAVAILABLE,\n CONFIG_INHERIT_NOT_FOUND,\n CONFIG_INHERIT_PARSE_ERROR,\n] as const;\n\n// Repository Errors - causes repo to be considered as disabled\nexport const REPOSITORY_ACCESS_FORBIDDEN = 'forbidden';\nexport const REPOSITORY_ARCHIVED = 'archived';\nexport const REPOSITORY_BLOCKED = 'blocked';\nexport const REPOSITORY_CANNOT_FORK = 'cannot-fork';\nexport const REPOSITORY_DISABLED = 'disabled';\nexport const REPOSITORY_CLOSED_ONBOARDING = 'disabled-closed-onboarding';\nexport const REPOSITORY_DISABLED_BY_CONFIG = 'disabled-by-config';\nexport const REPOSITORY_NO_CONFIG = 'disabled-no-config';\nexport const REPOSITORY_EMPTY = 'empty';\nexport const REPOSITORY_FORK_MISSING = 'fork-missing';\nexport const REPOSITORY_FORK_MODE_FORKED = 'fork-mode-forked';\nexport const REPOSITORY_FORKED = 'fork';\nexport const REPOSITORY_MIRRORED = 'mirror';\nexport const REPOSITORY_NOT_FOUND = 'not-found';\nexport const REPOSITORY_NO_PACKAGE_FILES = 'no-package-files';\nexport const REPOSITORY_RENAMED = 'renamed';\nexport const REPOSITORY_UNINITIATED = 'uninitiated';\n\n/** cause repo to be considered as disabled */\nexport const RepositoryErrors = [\n REPOSITORY_ACCESS_FORBIDDEN,\n REPOSITORY_ARCHIVED,\n REPOSITORY_BLOCKED,\n REPOSITORY_CANNOT_FORK,\n REPOSITORY_DISABLED,\n REPOSITORY_CLOSED_ONBOARDING,\n REPOSITORY_DISABLED_BY_CONFIG,\n REPOSITORY_NO_CONFIG,\n REPOSITORY_EMPTY,\n REPOSITORY_FORK_MISSING,\n REPOSITORY_FORK_MODE_FORKED,\n REPOSITORY_FORKED,\n REPOSITORY_MIRRORED,\n REPOSITORY_NOT_FOUND,\n REPOSITORY_NO_PACKAGE_FILES,\n REPOSITORY_RENAMED,\n REPOSITORY_UNINITIATED,\n] as const;\n\n// Temporary Error\nexport const REPOSITORY_CHANGED = 'repository-changed';\nexport const TEMPORARY_ERROR = 'temporary-error';\nexport const NO_VULNERABILITY_ALERTS = 'no-vulnerability-alerts';\n\nexport const TemporaryErrors = [\n REPOSITORY_CHANGED,\n TEMPORARY_ERROR,\n NO_VULNERABILITY_ALERTS,\n] as const;\n\n// Manager Error\nexport const MANAGER_LOCKFILE_ERROR = 'lockfile-error';\nexport const FILE_ACCESS_VIOLATION_ERROR = 'file-access-violation-error';\n\n// Host error\nexport const EXTERNAL_HOST_ERROR = 'external-host-error';\nexport const IGNORABLE_HOST_ERROR = 'ignorable-host-error';\nexport const HOST_BLOCKED = 'host-blocked';\nexport const HOST_DISABLED = 'host-disabled';\n\n// Worker Error\nexport const WORKER_FILE_UPDATE_FAILED = 'update-failure';\n\n// PR Error\nexport const PR_ALREADY_IN_MERGE_QUEUE = 'pr-already-in-merge-queue';\n\n// Bundler Error\nexport const BUNDLER_INVALID_CREDENTIALS = 'bundler-credentials';\n\n// Unknown Error\nexport const UNKNOWN_ERROR = 'unknown-error';\n\n// PATH Error\nexport const INVALID_PATH = 'invalid-path';\n\n// PAGE NOT FOUND\nexport const PAGE_NOT_FOUND_ERROR = 'page-not-found';\n\n// Missing API required credentials\nexport const MISSING_API_CREDENTIALS = 'missing-api-credentials';\n\n/** Logger not initialized */\nexport const LOGGER_NOT_INITIALIZED = 'logger-not-initialized';\n"],"mappings":";AACA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,eAAe,CAC1B,gCACA,0BACF;AAGA,MAAa,gCAAgC;AAC7C,MAAa,2BAA2B;AACxC,MAAa,sBAAsB;AACnC,MAAa,oCAAoC;AACjD,MAAa,qBAAqB;AAClC,MAAa,+BAA+B;AAC5C,MAAa,yBAAyB;AAEtC,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AACtC,MAAa,yBAAyB;AACtC,MAAa,yBAAyB;AACtC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAE1C,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,8BAA8B;AAC3C,MAAa,sBAAsB;AACnC,MAAa,qBAAqB;AAClC,MAAa,yBAAyB;AACtC,MAAa,sBAAsB;AACnC,MAAa,+BAA+B;AAC5C,MAAa,gCAAgC;AAC7C,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,0BAA0B;AACvC,MAAa,8BAA8B;AAC3C,MAAa,oBAAoB;AACjC,MAAa,sBAAsB;AACnC,MAAa,uBAAuB;AACpC,MAAa,8BAA8B;AAC3C,MAAa,qBAAqB;AAClC,MAAa,yBAAyB;;AAGtC,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,qBAAqB;AAClC,MAAa,kBAAkB;AAC/B,MAAa,0BAA0B;AAEvC,MAAa,kBAAkB;CAC7B;CACA;CACA;AACF;AAGA,MAAa,yBAAyB;AACtC,MAAa,8BAA8B;AAG3C,MAAa,sBAAsB;AACnC,MAAa,uBAAuB;AACpC,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAG7B,MAAa,4BAA4B;AAGzC,MAAa,4BAA4B;AAGzC,MAAa,8BAA8B;AAG3C,MAAa,gBAAgB;AAG7B,MAAa,eAAe;AAG5B,MAAa,uBAAuB;AAGpC,MAAa,0BAA0B;;AAGvC,MAAa,yBAAyB"}
|
|
1
|
+
{"version":3,"file":"error-messages.js","names":[],"sources":["../../lib/constants/error-messages.ts"],"sourcesContent":["// System error\nexport const SYSTEM_INSUFFICIENT_DISK_SPACE = 'disk-space';\nexport const SYSTEM_INSUFFICIENT_MEMORY = 'out-of-memory';\n\nexport const SystemErrors = [\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n SYSTEM_INSUFFICIENT_MEMORY,\n] as const;\n\n// Platform Error\nexport const PLATFORM_AUTHENTICATION_ERROR = 'authentication-error';\nexport const PLATFORM_BAD_CREDENTIALS = 'bad-credentials';\nexport const PLATFORM_GPG_FAILED = 'gpg-failed';\nexport const PLATFORM_INTEGRATION_UNAUTHORIZED = 'integration-unauthorized';\nexport const PLATFORM_NOT_FOUND = 'platform-not-found';\nexport const PLATFORM_RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded';\nexport const PLATFORM_UNKNOWN_ERROR = 'platform-unknown-error';\n\nexport const PlatformErrors = [\n PLATFORM_AUTHENTICATION_ERROR,\n PLATFORM_BAD_CREDENTIALS,\n PLATFORM_GPG_FAILED,\n PLATFORM_INTEGRATION_UNAUTHORIZED,\n PLATFORM_NOT_FOUND,\n PLATFORM_RATE_LIMIT_EXCEEDED,\n PLATFORM_UNKNOWN_ERROR,\n] as const;\n\n// Config Error\nexport const CONFIG_VALIDATION = 'config-validation';\nexport const CONFIG_PRESETS_INVALID = 'config-presets-invalid';\nexport const CONFIG_SECRETS_EXPOSED = 'config-secrets-exposed';\nexport const CONFIG_SECRETS_INVALID = 'config-secrets-invalid';\nexport const CONFIG_VARIABLES_INVALID = 'config-variables-invalid';\nexport const CONFIG_GIT_URL_UNAVAILABLE = 'config-git-url-unavailable';\nexport const CONFIG_INHERIT_NOT_FOUND = 'config-inherit-not-found';\nexport const CONFIG_INHERIT_PARSE_ERROR = 'config-inherit-parse-error';\n\nexport const ConfigErrors = [\n CONFIG_VALIDATION,\n CONFIG_PRESETS_INVALID,\n CONFIG_SECRETS_EXPOSED,\n CONFIG_SECRETS_INVALID,\n CONFIG_VARIABLES_INVALID,\n CONFIG_GIT_URL_UNAVAILABLE,\n CONFIG_INHERIT_NOT_FOUND,\n CONFIG_INHERIT_PARSE_ERROR,\n] as const;\n\n// Repository Errors - causes repo to be considered as disabled\nexport const REPOSITORY_ACCESS_FORBIDDEN = 'forbidden';\nexport const REPOSITORY_ARCHIVED = 'archived';\nexport const REPOSITORY_BLOCKED = 'blocked';\nexport const REPOSITORY_CANNOT_FORK = 'cannot-fork';\nexport const REPOSITORY_DISABLED = 'disabled';\nexport const REPOSITORY_CLOSED_ONBOARDING = 'disabled-closed-onboarding';\nexport const REPOSITORY_DISABLED_BY_CONFIG = 'disabled-by-config';\nexport const REPOSITORY_NO_CONFIG = 'disabled-no-config';\nexport const REPOSITORY_EMPTY = 'empty';\nexport const REPOSITORY_FORK_MISSING = 'fork-missing';\nexport const REPOSITORY_FORK_MODE_FORKED = 'fork-mode-forked';\nexport const REPOSITORY_FORKED = 'fork';\nexport const REPOSITORY_MIRRORED = 'mirror';\nexport const REPOSITORY_NOT_FOUND = 'not-found';\nexport const REPOSITORY_NO_PACKAGE_FILES = 'no-package-files';\nexport const REPOSITORY_PENDING_DELETION = 'pending-deletion';\nexport const REPOSITORY_RENAMED = 'renamed';\nexport const REPOSITORY_UNINITIATED = 'uninitiated';\n\n/** cause repo to be considered as disabled */\nexport const RepositoryErrors = [\n REPOSITORY_ACCESS_FORBIDDEN,\n REPOSITORY_ARCHIVED,\n REPOSITORY_BLOCKED,\n REPOSITORY_CANNOT_FORK,\n REPOSITORY_DISABLED,\n REPOSITORY_CLOSED_ONBOARDING,\n REPOSITORY_DISABLED_BY_CONFIG,\n REPOSITORY_NO_CONFIG,\n REPOSITORY_EMPTY,\n REPOSITORY_FORK_MISSING,\n REPOSITORY_FORK_MODE_FORKED,\n REPOSITORY_FORKED,\n REPOSITORY_MIRRORED,\n REPOSITORY_NOT_FOUND,\n REPOSITORY_NO_PACKAGE_FILES,\n REPOSITORY_PENDING_DELETION,\n REPOSITORY_RENAMED,\n REPOSITORY_UNINITIATED,\n] as const;\n\n// Temporary Error\nexport const REPOSITORY_CHANGED = 'repository-changed';\nexport const TEMPORARY_ERROR = 'temporary-error';\nexport const NO_VULNERABILITY_ALERTS = 'no-vulnerability-alerts';\n\nexport const TemporaryErrors = [\n REPOSITORY_CHANGED,\n TEMPORARY_ERROR,\n NO_VULNERABILITY_ALERTS,\n] as const;\n\n// Manager Error\nexport const MANAGER_LOCKFILE_ERROR = 'lockfile-error';\nexport const FILE_ACCESS_VIOLATION_ERROR = 'file-access-violation-error';\n\n// Host error\nexport const EXTERNAL_HOST_ERROR = 'external-host-error';\nexport const IGNORABLE_HOST_ERROR = 'ignorable-host-error';\nexport const HOST_BLOCKED = 'host-blocked';\nexport const HOST_DISABLED = 'host-disabled';\n\n// Worker Error\nexport const WORKER_FILE_UPDATE_FAILED = 'update-failure';\n\n// PR Error\nexport const PR_ALREADY_IN_MERGE_QUEUE = 'pr-already-in-merge-queue';\n\n// Bundler Error\nexport const BUNDLER_INVALID_CREDENTIALS = 'bundler-credentials';\n\n// Unknown Error\nexport const UNKNOWN_ERROR = 'unknown-error';\n\n// PATH Error\nexport const INVALID_PATH = 'invalid-path';\n\n// PAGE NOT FOUND\nexport const PAGE_NOT_FOUND_ERROR = 'page-not-found';\n\n// Missing API required credentials\nexport const MISSING_API_CREDENTIALS = 'missing-api-credentials';\n\n/** Logger not initialized */\nexport const LOGGER_NOT_INITIALIZED = 'logger-not-initialized';\n"],"mappings":";AACA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;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4BAA4B;AAGzC,MAAa,8BAA8B;AAG3C,MAAa,gBAAgB;AAG7B,MAAa,eAAe;AAG5B,MAAa,uBAAuB;AAGpC,MAAa,0BAA0B;;AAGvC,MAAa,yBAAyB"}
|
|
@@ -3,6 +3,7 @@ import { logger } from "../../../logger/index.js";
|
|
|
3
3
|
import { deleteLocalFile, getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
4
4
|
import { exec } from "../../../util/exec/index.js";
|
|
5
5
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
6
|
+
import { resolveToolConstraint } from "../util.js";
|
|
6
7
|
import { isNonEmptyArray } from "@sindresorhus/is";
|
|
7
8
|
//#region lib/modules/manager/apm/artifacts.ts
|
|
8
9
|
async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileContent, config }) {
|
|
@@ -25,7 +26,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
25
26
|
docker: {},
|
|
26
27
|
toolConstraints: [{
|
|
27
28
|
toolName: "apm",
|
|
28
|
-
constraint: config
|
|
29
|
+
constraint: await resolveToolConstraint(config, "apm")
|
|
29
30
|
}]
|
|
30
31
|
};
|
|
31
32
|
await exec("apm install", execOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/apm/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`apm.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('apm: no updated deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'apm.lock.yaml');\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('apm: no lock file found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/apm/artifacts.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`apm.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('apm: no updated deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'apm.lock.yaml');\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('apm: no lock file found');\n return null;\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'apm',\n constraint: await resolveToolConstraint(config, 'apm'),\n },\n ],\n };\n await exec('apm install', execOptions);\n\n // `apm install` regenerates the lockfile and re-deploys the harness\n // directories (`.github/`, `.claude/`, ...) that APM consumers commit, so\n // return every file it changed - not just the lockfile - or the committed\n // instruction files go stale after a bump. `apm_modules/` is the gitignored\n // cache, so it is not reported here.\n const status = await getRepoStatus();\n const res: UpdateArtifactsResult[] = [];\n for (const path of [...status.modified, ...status.not_added]) {\n // the manifest itself is committed as an updated package file\n if (path === packageFileName) {\n continue;\n }\n res.push({\n file: { type: 'addition', path, contents: await readLocalFile(path) },\n });\n }\n for (const path of status.deleted) {\n res.push({ file: { type: 'deletion', path } });\n }\n if (!res.length) {\n logger.debug('apm: no changed files after install');\n return null;\n }\n return res;\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName}`);\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: `${err}`,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;AAeA,eAAsB,gBAAgB,EACpC,iBACA,aACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,CAAC,gBAAgB,WAAW,KAAK,CAAC,uBAAuB;EAC3D,OAAO,MAAM,uCAAuC;EACpD,OAAO;CACT;CAEA,MAAM,eAAe,mBAAmB,iBAAiB,eAAe;CAExE,IAAI,CAAC,MADiC,cAAc,cAAc,MAAM,GAC1C;EAC5B,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,IAAI;EACF,MAAM,eAAe,iBAAiB,qBAAqB;EAC3D,IAAI,uBACF,MAAM,gBAAgB,YAAY;EAGpC,MAAM,cAA2B;GAC/B,SAAS;GACT,QAAQ,CAAC;GACT,iBAAiB,CACf;IACE,UAAU;IACV,YAAY,MAAM,sBAAsB,QAAQ,KAAK;GACvD,CACF;EACF;EACA,MAAM,KAAK,eAAe,WAAW;EAOrC,MAAM,SAAS,MAAM,cAAc;EACnC,MAAM,MAA+B,CAAC;EACtC,KAAK,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,GAAG;GAE5D,IAAI,SAAS,iBACX;GAEF,IAAI,KAAK,EACP,MAAM;IAAE,MAAM;IAAY;IAAM,UAAU,MAAM,cAAc,IAAI;GAAE,EACtE,CAAC;EACH;EACA,KAAK,MAAM,QAAQ,OAAO,SACxB,IAAI,KAAK,EAAE,MAAM;GAAE,MAAM;GAAY;EAAK,EAAE,CAAC;EAE/C,IAAI,CAAC,IAAI,QAAQ;GACf,OAAO,MAAM,qCAAqC;GAClD,OAAO;EACT;EACA,OAAO;CACT,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,MAAM,EAAE,IAAI,GAAG,oBAAoB,cAAc;EACxD,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,GAAG;EACb,EACF,CACF;CACF;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { logger } from "../../../logger/index.js";
|
|
2
2
|
import { getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
3
|
+
import { resolveToolConstraint } from "../util.js";
|
|
3
4
|
import { updateBazelLockfile } from "./lockfile.js";
|
|
4
5
|
//#region lib/modules/manager/bazel-module/artifacts.ts
|
|
5
6
|
async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileContent, config }) {
|
|
@@ -15,7 +16,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
18
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
|
18
|
-
return await updateBazelLockfile(lockFileName, packageFileName, isLockFileMaintenance, config
|
|
19
|
+
return await updateBazelLockfile(lockFileName, packageFileName, isLockFileMaintenance, await resolveToolConstraint(config, "bazelisk"));
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
21
22
|
export { updateArtifacts };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bazel-module/artifacts.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { updateBazelLockfile } from './lockfile.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`bazel-module.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!updatedDeps.length && !isLockFileMaintenance) {\n logger.debug('No updated bazel-module deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'MODULE.bazel.lock');\n\n const existingLockContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockContent) {\n logger.debug('No MODULE.bazel.lock found - skipping artifact update');\n return null;\n }\n\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n return await updateBazelLockfile(\n lockFileName,\n packageFileName,\n isLockFileMaintenance,\n config
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bazel-module/artifacts.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { updateBazelLockfile } from './lockfile.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`bazel-module.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!updatedDeps.length && !isLockFileMaintenance) {\n logger.debug('No updated bazel-module deps - returning null');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'MODULE.bazel.lock');\n\n const existingLockContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockContent) {\n logger.debug('No MODULE.bazel.lock found - skipping artifact update');\n return null;\n }\n\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n return await updateBazelLockfile(\n lockFileName,\n packageFileName,\n isLockFileMaintenance,\n await resolveToolConstraint(config, 'bazelisk'),\n );\n}\n"],"mappings":";;;;;AAUA,eAAsB,gBAAgB,EACpC,iBACA,aACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,gCAAgC,gBAAgB,EAAE;CAC/D,MAAM,EAAE,0BAA0B;CAElC,IAAI,CAAC,YAAY,UAAU,CAAC,uBAAuB;EACjD,OAAO,MAAM,+CAA+C;EAC5D,OAAO;CACT;CAEA,MAAM,eAAe,mBAAmB,iBAAiB,mBAAmB;CAG5E,IAAI,CAAC,MAD6B,cAAc,cAAc,MAAM,GAC1C;EACxB,OAAO,MAAM,uDAAuD;EACpE,OAAO;CACT;CAEA,MAAM,eAAe,iBAAiB,qBAAqB;CAE3D,OAAO,MAAM,oBACX,cACA,iBACA,uBACA,MAAM,sBAAsB,QAAQ,UAAU,CAChD;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { logger } from "../../../logger/index.js";
|
|
2
2
|
import { getSiblingFileName, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
3
|
+
import { resolveToolConstraint } from "../util.js";
|
|
3
4
|
import { updateBazelLockfile } from "../bazel-module/lockfile.js";
|
|
4
5
|
//#region lib/modules/manager/bazelisk/artifacts.ts
|
|
5
6
|
async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileContent, config }) {
|
|
@@ -19,7 +20,7 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
|
22
|
-
return await updateBazelLockfile(lockFileName, moduleFileName, config.isLockFileMaintenance, config
|
|
23
|
+
return await updateBazelLockfile(lockFileName, moduleFileName, config.isLockFileMaintenance, await resolveToolConstraint(config, "bazelisk"));
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
26
|
export { updateArtifacts };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bazelisk/artifacts.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { updateBazelLockfile } from '../bazel-module/lockfile.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`bazelisk.updateArtifacts(${packageFileName})`);\n\n if (!updatedDeps.length && !config.isLockFileMaintenance) {\n logger.debug('No updated bazelisk deps - returning null');\n return null;\n }\n\n const moduleFileName = getSiblingFileName(packageFileName, 'MODULE.bazel');\n const existingModuleContent = await readLocalFile(moduleFileName, 'utf8');\n if (!existingModuleContent) {\n logger.debug('No MODULE.bazel found - skipping artifact update');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'MODULE.bazel.lock');\n const existingLockContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockContent) {\n logger.debug('No MODULE.bazel.lock found - skipping artifact update');\n return null;\n }\n\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n return await updateBazelLockfile(\n lockFileName,\n moduleFileName,\n config.isLockFileMaintenance,\n config
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bazelisk/artifacts.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { updateBazelLockfile } from '../bazel-module/lockfile.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`bazelisk.updateArtifacts(${packageFileName})`);\n\n if (!updatedDeps.length && !config.isLockFileMaintenance) {\n logger.debug('No updated bazelisk deps - returning null');\n return null;\n }\n\n const moduleFileName = getSiblingFileName(packageFileName, 'MODULE.bazel');\n const existingModuleContent = await readLocalFile(moduleFileName, 'utf8');\n if (!existingModuleContent) {\n logger.debug('No MODULE.bazel found - skipping artifact update');\n return null;\n }\n\n const lockFileName = getSiblingFileName(packageFileName, 'MODULE.bazel.lock');\n const existingLockContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockContent) {\n logger.debug('No MODULE.bazel.lock found - skipping artifact update');\n return null;\n }\n\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n return await updateBazelLockfile(\n lockFileName,\n moduleFileName,\n config.isLockFileMaintenance,\n await resolveToolConstraint(config, 'bazelisk'),\n );\n}\n"],"mappings":";;;;;AAUA,eAAsB,gBAAgB,EACpC,iBACA,aACA,uBACA,UAC0D;CAC1D,OAAO,MAAM,4BAA4B,gBAAgB,EAAE;CAE3D,IAAI,CAAC,YAAY,UAAU,CAAC,OAAO,uBAAuB;EACxD,OAAO,MAAM,2CAA2C;EACxD,OAAO;CACT;CAEA,MAAM,iBAAiB,mBAAmB,iBAAiB,cAAc;CAEzE,IAAI,CAAC,MAD+B,cAAc,gBAAgB,MAAM,GAC5C;EAC1B,OAAO,MAAM,kDAAkD;EAC/D,OAAO;CACT;CAEA,MAAM,eAAe,mBAAmB,iBAAiB,mBAAmB;CAE5E,IAAI,CAAC,MAD6B,cAAc,cAAc,MAAM,GAC1C;EACxB,OAAO,MAAM,uDAAuD;EACpE,OAAO;CACT;CAEA,MAAM,eAAe,iBAAiB,qBAAqB;CAE3D,OAAO,MAAM,oBACX,cACA,gBACA,OAAO,uBACP,MAAM,sBAAsB,QAAQ,UAAU,CAChD;AACF"}
|
|
@@ -3,6 +3,7 @@ import { GlobalConfig } from "../../../config/global.js";
|
|
|
3
3
|
import { logger } from "../../../logger/index.js";
|
|
4
4
|
import { deleteLocalFile, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
5
5
|
import { exec } from "../../../util/exec/index.js";
|
|
6
|
+
import { resolveToolConstraint } from "../util.js";
|
|
6
7
|
import { processHostRules } from "../npm/post-update/rules.js";
|
|
7
8
|
import { getNpmrcContent, resetNpmrcContent, updateNpmrcContent } from "../npm/utils.js";
|
|
8
9
|
import { isEmptyArray } from "@sindresorhus/is";
|
|
@@ -40,7 +41,7 @@ async function updateArtifacts(updateArtifact) {
|
|
|
40
41
|
docker: {},
|
|
41
42
|
toolConstraints: [{
|
|
42
43
|
toolName: "bun",
|
|
43
|
-
constraint:
|
|
44
|
+
constraint: await resolveToolConstraint(config, "bun")
|
|
44
45
|
}]
|
|
45
46
|
};
|
|
46
47
|
await exec(cmd, execOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bun.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated bun deps - returning null');\n return null;\n }\n\n // Find the first bun dependency in order to handle mixed manager updates,\n // eventually falling back to the first lock file from config.\n const lockFileName =\n updatedDeps.find((dep) => dep.manager === 'bun')?.lockFiles?.[0] ??\n config.lockFiles?.[0];\n\n if (!lockFileName) {\n logger.debug(`bun: No lock file found`);\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.debug(`No ${lockFileName} found`);\n return null;\n }\n\n const pkgFileDir = upath.dirname(packageFileName);\n const npmrcContent = await getNpmrcContent(pkgFileDir);\n const { additionalNpmrcContent } = processHostRules();\n await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n let cmd = 'bun install';\n\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n cmd += ' --ignore-scripts';\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'bun',\n constraint:
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/bun/artifacts.ts"],"sourcesContent":["import { isEmptyArray } from '@sindresorhus/is';\nimport upath from 'upath';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { processHostRules } from '../npm/post-update/rules.ts';\nimport {\n getNpmrcContent,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../npm/utils.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bun.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (isEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated bun deps - returning null');\n return null;\n }\n\n // Find the first bun dependency in order to handle mixed manager updates,\n // eventually falling back to the first lock file from config.\n const lockFileName =\n updatedDeps.find((dep) => dep.manager === 'bun')?.lockFiles?.[0] ??\n config.lockFiles?.[0];\n\n if (!lockFileName) {\n logger.debug(`bun: No lock file found`);\n return null;\n }\n\n const oldLockFileContent = await readLocalFile(lockFileName);\n if (!oldLockFileContent) {\n logger.debug(`No ${lockFileName} found`);\n return null;\n }\n\n const pkgFileDir = upath.dirname(packageFileName);\n const npmrcContent = await getNpmrcContent(pkgFileDir);\n const { additionalNpmrcContent } = processHostRules();\n await updateNpmrcContent(pkgFileDir, npmrcContent, additionalNpmrcContent);\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n }\n\n let cmd = 'bun install';\n\n if (!GlobalConfig.get('allowScripts') || config.ignoreScripts) {\n cmd += ' --ignore-scripts';\n }\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n docker: {},\n toolConstraints: [\n {\n toolName: 'bun',\n constraint: await resolveToolConstraint(config, 'bun'),\n },\n ],\n };\n\n await exec(cmd, execOptions);\n await resetNpmrcContent(pkgFileDir, npmrcContent);\n\n const newLockFileContent = await readLocalFile(lockFileName);\n if (\n !newLockFileContent ||\n Buffer.compare(oldLockFileContent, newLockFileContent) === 0\n ) {\n return null;\n }\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newLockFileContent,\n },\n },\n ];\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.warn({ lockfile: lockFileName, err }, `Failed to update lock file`);\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,eAAsB,gBACpB,gBACyC;CACzC,MAAM,EAAE,iBAAiB,aAAa,uBAAuB,WAC3D;CACF,OAAO,MAAM,uBAAuB,gBAAgB,EAAE;CACtD,MAAM,EAAE,0BAA0B;CAElC,IAAI,aAAa,WAAW,KAAK,CAAC,uBAAuB;EACvD,OAAO,MAAM,sCAAsC;EACnD,OAAO;CACT;CAIA,MAAM,eACJ,YAAY,MAAM,QAAQ,IAAI,YAAY,KAAK,CAAC,EAAE,YAAY,MAC9D,OAAO,YAAY;CAErB,IAAI,CAAC,cAAc;EACjB,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,MAAM,qBAAqB,MAAM,cAAc,YAAY;CAC3D,IAAI,CAAC,oBAAoB;EACvB,OAAO,MAAM,MAAM,aAAa,OAAO;EACvC,OAAO;CACT;CAEA,MAAM,aAAa,MAAM,QAAQ,eAAe;CAChD,MAAM,eAAe,MAAM,gBAAgB,UAAU;CACrD,MAAM,EAAE,2BAA2B,iBAAiB;CACpD,MAAM,mBAAmB,YAAY,cAAc,sBAAsB;CAEzE,IAAI;EACF,MAAM,eAAe,iBAAiB,qBAAqB;EAC3D,IAAI,uBACF,MAAM,gBAAgB,YAAY;EAGpC,IAAI,MAAM;EAEV,IAAI,CAAC,aAAa,IAAI,cAAc,KAAK,OAAO,eAC9C,OAAO;EAGT,MAAM,cAA2B;GAC/B,SAAS;GACT,QAAQ,CAAC;GACT,iBAAiB,CACf;IACE,UAAU;IACV,YAAY,MAAM,sBAAsB,QAAQ,KAAK;GACvD,CACF;EACF;EAEA,MAAM,KAAK,KAAK,WAAW;EAC3B,MAAM,kBAAkB,YAAY,YAAY;EAEhD,MAAM,qBAAqB,MAAM,cAAc,YAAY;EAC3D,IACE,CAAC,sBACD,OAAO,QAAQ,oBAAoB,kBAAkB,MAAM,GAE3D,OAAO;EAET,OAAO,CACL,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU;EACZ,EACF,CACF;CACF,SAAS,KAAK;EACZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,OAAO,KAAK;GAAE,UAAU;GAAc;EAAI,GAAG,4BAA4B;EACzE,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,IAAI;EACd,EACF,CACF;CACF;AACF"}
|
|
@@ -70,7 +70,7 @@ async function updateArtifacts(updateArtifact, recursionLimit = 10) {
|
|
|
70
70
|
...variables,
|
|
71
71
|
...buildBundleHostVariable(hostRule)
|
|
72
72
|
}), {});
|
|
73
|
-
const bundler = getBundlerConstraint(updateArtifact, existingLockFileContent);
|
|
73
|
+
const bundler = await getBundlerConstraint(updateArtifact, existingLockFileContent);
|
|
74
74
|
const preCommands = ["ruby --version"];
|
|
75
75
|
const execOptions = {
|
|
76
76
|
cwdFile: lockFileName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["memCache.get"],"sources":["../../../../lib/modules/manager/bundler/artifacts.ts"],"sourcesContent":["import { isNonEmptyStringAndNotWhitespace, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport {\n BUNDLER_INVALID_CREDENTIALS,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport * as memCache from '../../../util/cache/memory/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n getBundlerConstraint,\n getLockFilePath,\n getRubyConstraint,\n} from './common.ts';\nimport {\n findAllAuthenticatable,\n getAuthenticationHeaderValue,\n} from './host-rules.ts';\n\nconst hostConfigVariablePrefix = 'BUNDLE_';\n\nfunction buildBundleHostVariable(hostRule: HostRule): Record<string, string> {\n // istanbul ignore if: doesn't happen in practice\n if (!hostRule.resolvedHost) {\n return {};\n }\n const varName = hostConfigVariablePrefix.concat(\n hostRule.resolvedHost\n .toUpperCase()\n .split('.')\n .join('__')\n .split('-')\n .join('___'),\n );\n return {\n [varName]: `${getAuthenticationHeaderValue(hostRule)}`,\n };\n}\n\nconst resolvedPkgRegex = regEx(\n /(?<pkg>\\S+)(?:\\s*\\([^)]+\\)\\s*)? was resolved to/,\n);\n\nfunction getResolvedPackages(input: string): string[] {\n const lines = input.split(newlineRegex);\n const result: string[] = [];\n for (const line of lines) {\n const resolveMatchGroups = line.match(resolvedPkgRegex)?.groups;\n if (resolveMatchGroups) {\n const { pkg } = resolveMatchGroups;\n result.push(pkg);\n }\n }\n\n return [...new Set(result)];\n}\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n recursionLimit = 10,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bundler.updateArtifacts(${packageFileName})`);\n const existingError = memCache.get<string>('bundlerArtifactsError');\n // istanbul ignore if\n if (existingError) {\n logger.debug('Aborting Bundler artifacts due to previous failed attempt');\n throw new Error(existingError);\n }\n const lockFileName = await getLockFilePath(packageFileName);\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('No Gemfile.lock found');\n return null;\n }\n\n const updatedDepNames: string[] = updatedDeps\n .map(({ depName }) => depName)\n .filter(isNonEmptyStringAndNotWhitespace);\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n const commands: string[] = [];\n\n if (config.isLockFileMaintenance) {\n commands.push('bundler lock --update');\n } else {\n const bundlerUpgraded = updatedDeps\n .map((dep) => dep.depName)\n .includes('bundler');\n if (bundlerUpgraded) {\n commands.push('bundler lock --update --bundler');\n }\n\n const updateTypes = {\n patch: '--patch ',\n minor: '--minor ',\n major: '',\n };\n for (const [updateType, updateArg] of Object.entries(updateTypes)) {\n const deps = updatedDeps\n .filter((dep) => (dep.updateType ?? 'major') === updateType)\n .map((dep) => dep.depName)\n .filter(isString)\n .filter((dep) => dep !== 'ruby' && dep !== 'bundler');\n let additionalArgs = '';\n if (config.postUpdateOptions?.includes('bundlerConservative')) {\n additionalArgs = '--conservative ';\n }\n if (deps.length) {\n const cmd = `bundler lock ${updateArg}${additionalArgs}--update ${deps\n .map(quote)\n .join(' ')}`;\n commands.push(cmd);\n }\n }\n\n const rubyUpgraded = updatedDeps\n .map((dep) => dep.depName)\n .includes('ruby');\n if (rubyUpgraded) {\n commands.push('bundler lock');\n }\n }\n\n const bundlerHostRules = findAllAuthenticatable({\n hostType: 'rubygems',\n });\n\n const bundlerHostRulesVariables = bundlerHostRules.reduce(\n (variables, hostRule) => ({\n ...variables,\n ...buildBundleHostVariable(hostRule),\n }),\n {} as Record<string, string>,\n );\n\n const bundler = getBundlerConstraint(\n updateArtifact,\n existingLockFileContent,\n );\n const preCommands = ['ruby --version'];\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n extraEnv: {\n ...bundlerHostRulesVariables,\n GEM_HOME: await ensureCacheDir('bundler'),\n },\n docker: {},\n toolConstraints: [\n {\n toolName: 'ruby',\n constraint: await getRubyConstraint(updateArtifact),\n },\n {\n toolName: 'bundler',\n constraint: bundler,\n },\n ],\n preCommands,\n };\n await exec(commands, execOptions);\n\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated Gemfile.lock');\n const lockFileContent = await readLocalFile(lockFileName);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: lockFileContent,\n },\n },\n ];\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n const output = `${String(err.stdout)}\\n${String(err.stderr)}`;\n if (\n err.message.includes('fatal: Could not parse object') ||\n output.includes('but that version could not be found')\n ) {\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: output,\n },\n },\n ];\n }\n if (\n err.stdout?.includes('Please supply credentials for this source') ||\n err.stderr?.includes('Authentication is required') ||\n err.stderr?.includes(\n 'Please make sure you have the correct access rights',\n )\n ) {\n logger.debug(\n { err },\n 'Gemfile.lock update failed due to missing credentials - skipping branch',\n );\n // Do not generate these PRs because we don't yet support Bundler authentication\n memCache.set('bundlerArtifactsError', BUNDLER_INVALID_CREDENTIALS);\n throw new Error(BUNDLER_INVALID_CREDENTIALS);\n }\n const resolveMatches: string[] = getResolvedPackages(output).filter(\n (depName) => !updatedDepNames.includes(depName),\n );\n if (\n recursionLimit > 0 &&\n resolveMatches.length &&\n !config.isLockFileMaintenance\n ) {\n logger.debug(\n { resolveMatches, updatedDeps },\n 'Found new resolve matches - reattempting recursively',\n );\n const newUpdatedDeps = [\n ...new Set([\n ...updatedDeps,\n ...resolveMatches.map((match) => ({ depName: match })),\n ]),\n ];\n return updateArtifacts(\n {\n packageFileName,\n updatedDeps: newUpdatedDeps,\n newPackageFileContent,\n config,\n },\n recursionLimit - 1,\n );\n }\n\n logger.info({ err }, 'Gemfile.lock update failed due to an unknown reason');\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(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["memCache.get"],"sources":["../../../../lib/modules/manager/bundler/artifacts.ts"],"sourcesContent":["import { isNonEmptyStringAndNotWhitespace, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport {\n BUNDLER_INVALID_CREDENTIALS,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { HostRule } from '../../../types/index.ts';\nimport * as memCache from '../../../util/cache/memory/index.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n ensureCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport {\n getBundlerConstraint,\n getLockFilePath,\n getRubyConstraint,\n} from './common.ts';\nimport {\n findAllAuthenticatable,\n getAuthenticationHeaderValue,\n} from './host-rules.ts';\n\nconst hostConfigVariablePrefix = 'BUNDLE_';\n\nfunction buildBundleHostVariable(hostRule: HostRule): Record<string, string> {\n // istanbul ignore if: doesn't happen in practice\n if (!hostRule.resolvedHost) {\n return {};\n }\n const varName = hostConfigVariablePrefix.concat(\n hostRule.resolvedHost\n .toUpperCase()\n .split('.')\n .join('__')\n .split('-')\n .join('___'),\n );\n return {\n [varName]: `${getAuthenticationHeaderValue(hostRule)}`,\n };\n}\n\nconst resolvedPkgRegex = regEx(\n /(?<pkg>\\S+)(?:\\s*\\([^)]+\\)\\s*)? was resolved to/,\n);\n\nfunction getResolvedPackages(input: string): string[] {\n const lines = input.split(newlineRegex);\n const result: string[] = [];\n for (const line of lines) {\n const resolveMatchGroups = line.match(resolvedPkgRegex)?.groups;\n if (resolveMatchGroups) {\n const { pkg } = resolveMatchGroups;\n result.push(pkg);\n }\n }\n\n return [...new Set(result)];\n}\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n recursionLimit = 10,\n): Promise<UpdateArtifactsResult[] | null> {\n const { packageFileName, updatedDeps, newPackageFileContent, config } =\n updateArtifact;\n logger.debug(`bundler.updateArtifacts(${packageFileName})`);\n const existingError = memCache.get<string>('bundlerArtifactsError');\n // istanbul ignore if\n if (existingError) {\n logger.debug('Aborting Bundler artifacts due to previous failed attempt');\n throw new Error(existingError);\n }\n const lockFileName = await getLockFilePath(packageFileName);\n const existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug('No Gemfile.lock found');\n return null;\n }\n\n const updatedDepNames: string[] = updatedDeps\n .map(({ depName }) => depName)\n .filter(isNonEmptyStringAndNotWhitespace);\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n const commands: string[] = [];\n\n if (config.isLockFileMaintenance) {\n commands.push('bundler lock --update');\n } else {\n const bundlerUpgraded = updatedDeps\n .map((dep) => dep.depName)\n .includes('bundler');\n if (bundlerUpgraded) {\n commands.push('bundler lock --update --bundler');\n }\n\n const updateTypes = {\n patch: '--patch ',\n minor: '--minor ',\n major: '',\n };\n for (const [updateType, updateArg] of Object.entries(updateTypes)) {\n const deps = updatedDeps\n .filter((dep) => (dep.updateType ?? 'major') === updateType)\n .map((dep) => dep.depName)\n .filter(isString)\n .filter((dep) => dep !== 'ruby' && dep !== 'bundler');\n let additionalArgs = '';\n if (config.postUpdateOptions?.includes('bundlerConservative')) {\n additionalArgs = '--conservative ';\n }\n if (deps.length) {\n const cmd = `bundler lock ${updateArg}${additionalArgs}--update ${deps\n .map(quote)\n .join(' ')}`;\n commands.push(cmd);\n }\n }\n\n const rubyUpgraded = updatedDeps\n .map((dep) => dep.depName)\n .includes('ruby');\n if (rubyUpgraded) {\n commands.push('bundler lock');\n }\n }\n\n const bundlerHostRules = findAllAuthenticatable({\n hostType: 'rubygems',\n });\n\n const bundlerHostRulesVariables = bundlerHostRules.reduce(\n (variables, hostRule) => ({\n ...variables,\n ...buildBundleHostVariable(hostRule),\n }),\n {} as Record<string, string>,\n );\n\n const bundler = await getBundlerConstraint(\n updateArtifact,\n existingLockFileContent,\n );\n const preCommands = ['ruby --version'];\n\n const execOptions: ExecOptions = {\n cwdFile: lockFileName,\n extraEnv: {\n ...bundlerHostRulesVariables,\n GEM_HOME: await ensureCacheDir('bundler'),\n },\n docker: {},\n toolConstraints: [\n {\n toolName: 'ruby',\n constraint: await getRubyConstraint(updateArtifact),\n },\n {\n toolName: 'bundler',\n constraint: bundler,\n },\n ],\n preCommands,\n };\n await exec(commands, execOptions);\n\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated Gemfile.lock');\n const lockFileContent = await readLocalFile(lockFileName);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: lockFileContent,\n },\n },\n ];\n } catch (err) {\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n const output = `${String(err.stdout)}\\n${String(err.stderr)}`;\n if (\n err.message.includes('fatal: Could not parse object') ||\n output.includes('but that version could not be found')\n ) {\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: output,\n },\n },\n ];\n }\n if (\n err.stdout?.includes('Please supply credentials for this source') ||\n err.stderr?.includes('Authentication is required') ||\n err.stderr?.includes(\n 'Please make sure you have the correct access rights',\n )\n ) {\n logger.debug(\n { err },\n 'Gemfile.lock update failed due to missing credentials - skipping branch',\n );\n // Do not generate these PRs because we don't yet support Bundler authentication\n memCache.set('bundlerArtifactsError', BUNDLER_INVALID_CREDENTIALS);\n throw new Error(BUNDLER_INVALID_CREDENTIALS);\n }\n const resolveMatches: string[] = getResolvedPackages(output).filter(\n (depName) => !updatedDepNames.includes(depName),\n );\n if (\n recursionLimit > 0 &&\n resolveMatches.length &&\n !config.isLockFileMaintenance\n ) {\n logger.debug(\n { resolveMatches, updatedDeps },\n 'Found new resolve matches - reattempting recursively',\n );\n const newUpdatedDeps = [\n ...new Set([\n ...updatedDeps,\n ...resolveMatches.map((match) => ({ depName: match })),\n ]),\n ];\n return updateArtifacts(\n {\n packageFileName,\n updatedDeps: newUpdatedDeps,\n newPackageFileContent,\n config,\n },\n recursionLimit - 1,\n );\n }\n\n logger.info({ err }, 'Gemfile.lock update failed due to an unknown reason');\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(err.stderr)}`,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,2BAA2B;AAEjC,SAAS,wBAAwB,UAA4C;;CAE3E,IAAI,CAAC,SAAS,cACZ,OAAO,CAAC;CAUV,OAAO,GARS,yBAAyB,OACvC,SAAS,aACN,YAAY,CAAC,CACb,MAAM,GAAG,CAAC,CACV,KAAK,IAAI,CAAC,CACV,MAAM,GAAG,CAAC,CACV,KAAK,KAAK,CAGN,IAAI,GAAG,6BAA6B,QAAQ,IACrD;AACF;AAEA,MAAM,mBAAmB,MACvB,iDACF;AAEA,SAAS,oBAAoB,OAAyB;CACpD,MAAM,QAAQ,MAAM,MAAM,YAAY;CACtC,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,qBAAqB,KAAK,MAAM,gBAAgB,CAAC,EAAE;EACzD,IAAI,oBAAoB;GACtB,MAAM,EAAE,QAAQ;GAChB,OAAO,KAAK,GAAG;EACjB;CACF;CAEA,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;AAC5B;AAEA,eAAsB,gBACpB,gBACA,iBAAiB,IACwB;CACzC,MAAM,EAAE,iBAAiB,aAAa,uBAAuB,WAC3D;CACF,OAAO,MAAM,2BAA2B,gBAAgB,EAAE;CAC1D,MAAM,gBAAgBA,IAAqB,uBAAuB;;CAElE,IAAI,eAAe;EACjB,OAAO,MAAM,2DAA2D;EACxE,MAAM,IAAI,MAAM,aAAa;CAC/B;CACA,MAAM,eAAe,MAAM,gBAAgB,eAAe;CAC1D,MAAM,0BAA0B,MAAM,cAAc,cAAc,MAAM;CACxE,IAAI,CA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EAEA,OAAO,KAAK,EAAE,IAAI,GAAG,qDAAqD;EAC1E,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,GAAG,OAAO,IAAI,MAAM,EAAE,IAAI,OAAO,IAAI,MAAM;EACrD,EACF,CACF;CACF;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { regEx } from "../../../util/regex.js";
|
|
2
2
|
import { logger } from "../../../logger/index.js";
|
|
3
3
|
import { getSiblingFileName, localPathExists, readLocalFile } from "../../../util/fs/index.js";
|
|
4
|
+
import { resolveToolConstraint } from "../util.js";
|
|
4
5
|
//#region lib/modules/manager/bundler/common.ts
|
|
5
6
|
const delimiters = ["\"", "'"];
|
|
6
7
|
function extractRubyVersion(txt) {
|
|
@@ -9,14 +10,7 @@ function extractRubyVersion(txt) {
|
|
|
9
10
|
const quotedVersion = rubyMatch.groups.version;
|
|
10
11
|
return quotedVersion.substring(1, quotedVersion.length - 1);
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
-
const { packageFileName, config, newPackageFileContent } = updateArtifact;
|
|
14
|
-
const { constraints = {} } = config;
|
|
15
|
-
const { ruby } = constraints;
|
|
16
|
-
if (ruby) {
|
|
17
|
-
logger.debug("Using ruby constraint from config");
|
|
18
|
-
return ruby;
|
|
19
|
-
}
|
|
13
|
+
async function getRubyConstraintFromFiles(packageFileName, newPackageFileContent) {
|
|
20
14
|
const rubyMatch = extractRubyVersion(newPackageFileContent);
|
|
21
15
|
if (rubyMatch) {
|
|
22
16
|
logger.debug("Using ruby version from gemfile");
|
|
@@ -39,14 +33,11 @@ async function getRubyConstraint(updateArtifact) {
|
|
|
39
33
|
}
|
|
40
34
|
return null;
|
|
41
35
|
}
|
|
42
|
-
function
|
|
43
|
-
const { config } = updateArtifact;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
logger.debug("Using bundler constraint from config");
|
|
48
|
-
return bundler;
|
|
49
|
-
}
|
|
36
|
+
async function getRubyConstraint(updateArtifact) {
|
|
37
|
+
const { packageFileName, config, newPackageFileContent } = updateArtifact;
|
|
38
|
+
return await resolveToolConstraint(config, "ruby", () => getRubyConstraintFromFiles(packageFileName, newPackageFileContent));
|
|
39
|
+
}
|
|
40
|
+
function getBundlerConstraintFromLockFile(existingLockFileContent) {
|
|
50
41
|
const bundledWith = regEx(/\nBUNDLED WITH\n\s+(?<version>.*?)(?:\n|$)/).exec(existingLockFileContent);
|
|
51
42
|
if (bundledWith) {
|
|
52
43
|
logger.debug("Using bundler version specified in lockfile");
|
|
@@ -54,6 +45,10 @@ function getBundlerConstraint(updateArtifact, existingLockFileContent) {
|
|
|
54
45
|
}
|
|
55
46
|
return null;
|
|
56
47
|
}
|
|
48
|
+
async function getBundlerConstraint(updateArtifact, existingLockFileContent) {
|
|
49
|
+
const { config } = updateArtifact;
|
|
50
|
+
return await resolveToolConstraint(config, "bundler", () => getBundlerConstraintFromLockFile(existingLockFileContent));
|
|
51
|
+
}
|
|
57
52
|
async function getLockFilePath(packageFilePath) {
|
|
58
53
|
const lockFilePath = await localPathExists(`${packageFilePath}.lock`) ? `${packageFilePath}.lock` : `Gemfile.lock`;
|
|
59
54
|
logger.debug(`Lockfile for ${packageFilePath} found in ${lockFilePath}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","names":[],"sources":["../../../../lib/modules/manager/bundler/common.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n} from '../../../util/fs/index.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport type { UpdateArtifact } from '../types.ts';\n\nexport const delimiters = ['\"', \"'\"];\n\nexport function extractRubyVersion(txt: string): string | null {\n const rubyMatch = regEx(/^ruby\\s+(?<version>\"[^\"]+\"|'[^']+')\\s*$/gm).exec(\n txt,\n );\n if (!rubyMatch?.groups) {\n return null;\n }\n const quotedVersion = rubyMatch.groups.version;\n return quotedVersion.substring(1, quotedVersion.length - 1);\n}\n\
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../../../../lib/modules/manager/bundler/common.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport {\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n} from '../../../util/fs/index.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport type { UpdateArtifact } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\n\nexport const delimiters = ['\"', \"'\"];\n\nexport function extractRubyVersion(txt: string): string | null {\n const rubyMatch = regEx(/^ruby\\s+(?<version>\"[^\"]+\"|'[^']+')\\s*$/gm).exec(\n txt,\n );\n if (!rubyMatch?.groups) {\n return null;\n }\n const quotedVersion = rubyMatch.groups.version;\n return quotedVersion.substring(1, quotedVersion.length - 1);\n}\n\nasync function getRubyConstraintFromFiles(\n packageFileName: string,\n newPackageFileContent: string,\n): Promise<string | null> {\n const rubyMatch = extractRubyVersion(newPackageFileContent);\n if (rubyMatch) {\n logger.debug('Using ruby version from gemfile');\n return rubyMatch;\n }\n for (const file of ['.ruby-version', '.tool-versions']) {\n const rubyVersion = (\n await readLocalFile(getSiblingFileName(packageFileName, file), 'utf8')\n )?.match(regEx(/^(?:ruby(?:-|\\s+))?(?<version>\\d[\\d.]*)/m))?.groups\n ?.version;\n if (rubyVersion) {\n logger.debug(`Using ruby version specified in ${file}`);\n return rubyVersion;\n }\n }\n const lockFile = await getLockFilePath(packageFileName);\n if (lockFile) {\n const rubyVersion = (await readLocalFile(lockFile, 'utf8'))?.match(\n regEx(/^ {3}ruby (?<version>\\d[\\d.]*)(?:[a-z]|\\s|$)/m),\n )?.groups?.version;\n if (rubyVersion) {\n logger.debug(`Using ruby version specified in lock file`);\n return rubyVersion;\n }\n }\n\n return null;\n}\n\nexport async function getRubyConstraint(\n updateArtifact: UpdateArtifact,\n): Promise<string | undefined> {\n const { packageFileName, config, newPackageFileContent } = updateArtifact;\n return await resolveToolConstraint(config, 'ruby', () =>\n getRubyConstraintFromFiles(packageFileName, newPackageFileContent),\n );\n}\n\nfunction getBundlerConstraintFromLockFile(\n existingLockFileContent: string,\n): string | null {\n const bundledWith = regEx(/\\nBUNDLED WITH\\n\\s+(?<version>.*?)(?:\\n|$)/).exec(\n existingLockFileContent,\n );\n if (bundledWith) {\n logger.debug('Using bundler version specified in lockfile');\n return bundledWith.groups!.version;\n }\n\n return null;\n}\n\nexport async function getBundlerConstraint(\n updateArtifact: Pick<UpdateArtifact, 'config'>,\n existingLockFileContent: string,\n): Promise<string | undefined> {\n const { config } = updateArtifact;\n return await resolveToolConstraint(config, 'bundler', () =>\n getBundlerConstraintFromLockFile(existingLockFileContent),\n );\n}\n\nexport async function getLockFilePath(\n packageFilePath: string,\n): Promise<string> {\n const lockFilePath = (await localPathExists(`${packageFilePath}.lock`))\n ? `${packageFilePath}.lock`\n : `Gemfile.lock`;\n logger.debug(`Lockfile for ${packageFilePath} found in ${lockFilePath}`);\n return lockFilePath;\n}\n"],"mappings":";;;;;AAUA,MAAa,aAAa,CAAC,MAAK,GAAG;AAEnC,SAAgB,mBAAmB,KAA4B;CAC7D,MAAM,YAAY,MAAM,2CAA2C,CAAC,CAAC,KACnE,GACF;CACA,IAAI,CAAC,WAAW,QACd,OAAO;CAET,MAAM,gBAAgB,UAAU,OAAO;CACvC,OAAO,cAAc,UAAU,GAAG,cAAc,SAAS,CAAC;AAC5D;AAEA,eAAe,2BACb,iBACA,uBACwB;CACxB,MAAM,YAAY,mBAAmB,qBAAqB;CAC1D,IAAI,WAAW;EACb,OAAO,MAAM,iCAAiC;EAC9C,OAAO;CACT;CACA,KAAK,MAAM,QAAQ,CAAC,iBAAiB,gBAAgB,GAAG;EACtD,MAAM,eACJ,MAAM,cAAc,mBAAmB,iBAAiB,IAAI,GAAG,MAAM,EAAA,EACpE,MAAM,MAAM,0CAA0C,CAAC,CAAC,EAAE,QACzD;EACJ,IAAI,aAAa;GACf,OAAO,MAAM,mCAAmC,MAAM;GACtD,OAAO;EACT;CACF;CACA,MAAM,WAAW,MAAM,gBAAgB,eAAe;CACtD,IAAI,UAAU;EACZ,MAAM,eAAe,MAAM,cAAc,UAAU,MAAM,EAAA,EAAI,MAC3D,MAAM,+CAA+C,CACvD,CAAC,EAAE,QAAQ;EACX,IAAI,aAAa;GACf,OAAO,MAAM,2CAA2C;GACxD,OAAO;EACT;CACF;CAEA,OAAO;AACT;AAEA,eAAsB,kBACpB,gBAC6B;CAC7B,MAAM,EAAE,iBAAiB,QAAQ,0BAA0B;CAC3D,OAAO,MAAM,sBAAsB,QAAQ,cACzC,2BAA2B,iBAAiB,qBAAqB,CACnE;AACF;AAEA,SAAS,iCACP,yBACe;CACf,MAAM,cAAc,MAAM,4CAA4C,CAAC,CAAC,KACtE,uBACF;CACA,IAAI,aAAa;EACf,OAAO,MAAM,6CAA6C;EAC1D,OAAO,YAAY,OAAQ;CAC7B;CAEA,OAAO;AACT;AAEA,eAAsB,qBACpB,gBACA,yBAC6B;CAC7B,MAAM,EAAE,WAAW;CACnB,OAAO,MAAM,sBAAsB,QAAQ,iBACzC,iCAAiC,uBAAuB,CAC1D;AACF;AAEA,eAAsB,gBACpB,iBACiB;CACjB,MAAM,eAAgB,MAAM,gBAAgB,GAAG,gBAAgB,MAAM,IACjE,GAAG,gBAAgB,SACnB;CACJ,OAAO,MAAM,gBAAgB,gBAAgB,YAAY,cAAc;CACvE,OAAO;AACT"}
|
|
@@ -4,6 +4,7 @@ import { coerceArray } from "../../../util/array.js";
|
|
|
4
4
|
import { logger } from "../../../logger/index.js";
|
|
5
5
|
import { findLocalSiblingOrParent, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
6
6
|
import { CrateDatasource } from "../../datasource/crate/index.js";
|
|
7
|
+
import { resolveToolConstraint } from "../util.js";
|
|
7
8
|
import { withGitEnvironment } from "../../../util/git/exec.js";
|
|
8
9
|
import { extractLockFileContentVersions } from "./locked-version.js";
|
|
9
10
|
import { quote } from "shlex";
|
|
@@ -55,17 +56,18 @@ async function updateArtifactsImpl({ packageFileName, updatedDeps, newPackageFil
|
|
|
55
56
|
contents: existingLockFileContent
|
|
56
57
|
} }];
|
|
57
58
|
}
|
|
59
|
+
const rustConstraint = await resolveToolConstraint(config, "rust");
|
|
58
60
|
try {
|
|
59
61
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
|
60
62
|
logger.debug(`Updating ${lockFileName}`);
|
|
61
|
-
if (isLockFileMaintenance) await cargoUpdate(packageFileName, true,
|
|
63
|
+
if (isLockFileMaintenance) await cargoUpdate(packageFileName, true, rustConstraint);
|
|
62
64
|
else {
|
|
63
65
|
const hasNonCrateDep = updatedDeps.some((dep) => dep.datasource !== CrateDatasource.id);
|
|
64
66
|
const crateDepWithoutLockedVersion = updatedDeps.find((dep) => !dep.lockedVersion && dep.datasource === CrateDatasource.id);
|
|
65
67
|
if (hasNonCrateDep || crateDepWithoutLockedVersion) {
|
|
66
68
|
if (crateDepWithoutLockedVersion) logger.warn({ dependency: crateDepWithoutLockedVersion.depName }, "Missing locked version for dependency");
|
|
67
|
-
await cargoUpdate(packageFileName, false,
|
|
68
|
-
} else await cargoUpdatePrecise(packageFileName, updatedDeps,
|
|
69
|
+
await cargoUpdate(packageFileName, false, rustConstraint);
|
|
70
|
+
} else await cargoUpdatePrecise(packageFileName, updatedDeps, rustConstraint);
|
|
69
71
|
}
|
|
70
72
|
logger.debug("Returning updated Cargo.lock");
|
|
71
73
|
const newCargoLockContent = await readLocalFile(lockFileName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cargo/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n findLocalSiblingOrParent,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { CrateDatasource } from '../../datasource/crate/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport { extractLockFileContentVersions } from './locked-version.ts';\n\nconst gitExec = withGitEnvironment(['cargo']);\n\nasync function cargoUpdate(\n manifestPath: string,\n isLockFileMaintenance: boolean,\n constraint: string | undefined,\n): Promise<void> {\n let cmd = `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(\n manifestPath,\n )}`;\n // If we're updating a specific crate, `cargo-update` requires `--workspace`\n // for more information, see: https://github.com/renovatebot/renovate/issues/12332\n if (!isLockFileMaintenance) {\n cmd += ` --workspace`;\n }\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n await gitExec(cmd, execOptions);\n}\n\nasync function cargoUpdatePrecise(\n manifestPath: string,\n updatedDeps: Upgrade[],\n constraint: string | undefined,\n): Promise<void> {\n const cmds = [];\n\n // First update individual dependencies to their `newVersion`. Necessary when\n // using the `update-lockfile` rangeStrategy which doesn't touch Cargo.toml.\n for (const dep of updatedDeps) {\n // If the range is bumped in Cargo.toml, the old lockedVersion may no longer\n // exist in Cargo's dependency graph, so let the --workspace update at the\n // end re-resolve it instead.\n if (dep.currentValue && dep.newValue && dep.currentValue !== dep.newValue) {\n continue;\n }\n\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true` +\n ` --manifest-path ${quote(manifestPath)}` +\n ` --package ${quote(`${dep.packageName}@${dep.lockedVersion}`)}` +\n ` --precise ${quote(dep.newVersion!)}`,\n );\n }\n\n // Then update all dependencies that have been bumped in `Cargo.toml`.\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(manifestPath)} --workspace`,\n );\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n\n await gitExec(cmds, execOptions);\n}\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n return await updateArtifactsImpl(updateArtifact);\n}\n\nasync function updateArtifactsImpl(\n {\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n }: UpdateArtifact,\n recursionLimit = 10,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`cargo.updateArtifacts(${packageFileName})`);\n\n // For standalone package crates, the `Cargo.lock` will be in the same\n // directory as `Cargo.toml` (ie. a sibling). For cargo workspaces, it\n // will be further up.\n const lockFileName = await findLocalSiblingOrParent(\n packageFileName,\n 'Cargo.lock',\n );\n const existingLockFileContent = lockFileName\n ? await readLocalFile(lockFileName)\n : null;\n if (!existingLockFileContent || !lockFileName) {\n logger.debug('No Cargo.lock found');\n return null;\n }\n\n const { isLockFileMaintenance } = config;\n if (!isLockFileMaintenance && !updatedDeps?.length) {\n logger.debug('No more dependencies to update');\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: existingLockFileContent,\n },\n },\n ];\n }\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n logger.debug(`Updating ${lockFileName}`);\n\n if (isLockFileMaintenance) {\n await cargoUpdate(packageFileName, true,
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":[],"sources":["../../../../lib/modules/manager/cargo/artifacts.ts"],"sourcesContent":["import { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport type { ExecOptions } from '../../../util/exec/types.ts';\nimport {\n findLocalSiblingOrParent,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { withGitEnvironment } from '../../../util/git/exec.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { CrateDatasource } from '../../datasource/crate/index.ts';\nimport type {\n UpdateArtifact,\n UpdateArtifactsResult,\n Upgrade,\n} from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { extractLockFileContentVersions } from './locked-version.ts';\n\nconst gitExec = withGitEnvironment(['cargo']);\n\nasync function cargoUpdate(\n manifestPath: string,\n isLockFileMaintenance: boolean,\n constraint: string | undefined,\n): Promise<void> {\n let cmd = `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(\n manifestPath,\n )}`;\n // If we're updating a specific crate, `cargo-update` requires `--workspace`\n // for more information, see: https://github.com/renovatebot/renovate/issues/12332\n if (!isLockFileMaintenance) {\n cmd += ` --workspace`;\n }\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n await gitExec(cmd, execOptions);\n}\n\nasync function cargoUpdatePrecise(\n manifestPath: string,\n updatedDeps: Upgrade[],\n constraint: string | undefined,\n): Promise<void> {\n const cmds = [];\n\n // First update individual dependencies to their `newVersion`. Necessary when\n // using the `update-lockfile` rangeStrategy which doesn't touch Cargo.toml.\n for (const dep of updatedDeps) {\n // If the range is bumped in Cargo.toml, the old lockedVersion may no longer\n // exist in Cargo's dependency graph, so let the --workspace update at the\n // end re-resolve it instead.\n if (dep.currentValue && dep.newValue && dep.currentValue !== dep.newValue) {\n continue;\n }\n\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true` +\n ` --manifest-path ${quote(manifestPath)}` +\n ` --package ${quote(`${dep.packageName}@${dep.lockedVersion}`)}` +\n ` --precise ${quote(dep.newVersion!)}`,\n );\n }\n\n // Then update all dependencies that have been bumped in `Cargo.toml`.\n cmds.push(\n `cargo update --config net.git-fetch-with-cli=true --manifest-path ${quote(manifestPath)} --workspace`,\n );\n\n const execOptions: ExecOptions = {\n docker: {},\n toolConstraints: [{ toolName: 'rust', constraint }],\n };\n\n await gitExec(cmds, execOptions);\n}\n\nexport async function updateArtifacts(\n updateArtifact: UpdateArtifact,\n): Promise<UpdateArtifactsResult[] | null> {\n return await updateArtifactsImpl(updateArtifact);\n}\n\nasync function updateArtifactsImpl(\n {\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n }: UpdateArtifact,\n recursionLimit = 10,\n): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`cargo.updateArtifacts(${packageFileName})`);\n\n // For standalone package crates, the `Cargo.lock` will be in the same\n // directory as `Cargo.toml` (ie. a sibling). For cargo workspaces, it\n // will be further up.\n const lockFileName = await findLocalSiblingOrParent(\n packageFileName,\n 'Cargo.lock',\n );\n const existingLockFileContent = lockFileName\n ? await readLocalFile(lockFileName)\n : null;\n if (!existingLockFileContent || !lockFileName) {\n logger.debug('No Cargo.lock found');\n return null;\n }\n\n const { isLockFileMaintenance } = config;\n if (!isLockFileMaintenance && !updatedDeps?.length) {\n logger.debug('No more dependencies to update');\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: existingLockFileContent,\n },\n },\n ];\n }\n\n const rustConstraint = await resolveToolConstraint(config, 'rust');\n\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n logger.debug(`Updating ${lockFileName}`);\n\n if (isLockFileMaintenance) {\n await cargoUpdate(packageFileName, true, rustConstraint);\n } else {\n const hasNonCrateDep = updatedDeps.some(\n (dep) => dep.datasource !== CrateDatasource.id,\n );\n const crateDepWithoutLockedVersion = updatedDeps.find(\n (dep) => !dep.lockedVersion && dep.datasource === CrateDatasource.id,\n );\n // Non-crate dependencies (like git ones) do not have locked versions.\n // For crate dependencies, a locked version is expected.\n // In both situations, perform a regular workspace lockfile update.\n if (hasNonCrateDep || crateDepWithoutLockedVersion) {\n if (crateDepWithoutLockedVersion) {\n // Only warn when a crate dependency has no locked version\n logger.warn(\n { dependency: crateDepWithoutLockedVersion.depName },\n 'Missing locked version for dependency',\n );\n }\n await cargoUpdate(packageFileName, false, rustConstraint);\n } else {\n // If all dependencies have locked versions then update them precisely.\n await cargoUpdatePrecise(packageFileName, updatedDeps, rustConstraint);\n }\n }\n\n logger.debug('Returning updated Cargo.lock');\n const newCargoLockContent = await readLocalFile(lockFileName);\n if (existingLockFileContent === newCargoLockContent) {\n logger.debug('Cargo.lock is unchanged');\n return null;\n }\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newCargoLockContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n\n // Sometimes `cargo update` will fail when a preceding dependency update\n // causes another dependency to update. In this case we can no longer\n // reference the dependency by its old version, so we filter it out\n // and retry recursively.\n const newCargoLockContent = await readLocalFile(lockFileName, 'utf8');\n if (\n recursionLimit > 0 &&\n newCargoLockContent &&\n regEx(/error: package ID specification/).test(err.stderr)\n ) {\n const versions = extractLockFileContentVersions(newCargoLockContent);\n const newUpdatedDeps = updatedDeps.filter(\n (dep) =>\n !coerceArray(versions?.get(dep.packageName!)).includes(\n dep.newVersion!,\n ),\n );\n\n if (newUpdatedDeps.length < updatedDeps.length) {\n logger.debug(\n 'Dependency already up to date - reattempting recursively',\n );\n return updateArtifactsImpl(\n {\n packageFileName,\n updatedDeps: newUpdatedDeps,\n newPackageFileContent,\n config,\n },\n recursionLimit - 1,\n );\n }\n }\n\n logger.debug({ err }, 'Failed to update Cargo lock file');\n\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,UAAU,mBAAmB,CAAC,OAAO,CAAC;AAE5C,eAAe,YACb,cACA,uBACA,YACe;CACf,IAAI,MAAM,qEAAqE,MAC7E,YACF;CAGA,IAAI,CAAC,uBACH,OAAO;CAOT,MAAM,QAAQ,KAAK;EAHjB,QAAQ,CAAC;EACT,iBAAiB,CAAC;GAAE,UAAU;GAAQ;EAAW,CAAC;CAEvB,CAAC;AAChC;AAEA,eAAe,mBACb,cACA,aACA,YACe;CACf,MAAM,OAAO,CAAC;CAId,KAAK,MAAM,OAAO,aAAa;EAI7B,IAAI,IAAI,gBAAgB,IAAI,YAAY,IAAI,iBAAiB,IAAI,UAC/D;EAGF,KAAK,KACH,qEACsB,MAAM,YAAY,EAAA,aACx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iBAAiB,OAAO,cAAc;GAC1D,OAEE,MAAM,mBAAmB,iBAAiB,aAAa,cAAc;EAEzE;EAEA,OAAO,MAAM,8BAA8B;EAC3C,MAAM,sBAAsB,MAAM,cAAc,YAAY;EAC5D,IAAI,4BAA4B,qBAAqB;GACnD,OAAO,MAAM,yBAAyB;GACtC,OAAO;EACT;EACA,OAAO,CACL,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU;EACZ,EACF,CACF;CACF,SAAS,KAAK;;EAEZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAOR,MAAM,sBAAsB,MAAM,cAAc,cAAc,MAAM;EACpE,IACE,iBAAiB,KACjB,uBACA,MAAM,iCAAiC,CAAC,CAAC,KAAK,IAAI,MAAM,GACxD;GACA,MAAM,WAAW,+BAA+B,mBAAmB;GACnE,MAAM,iBAAiB,YAAY,QAChC,QACC,CAAC,YAAY,UAAU,IAAI,IAAI,WAAY,CAAC,CAAC,CAAC,SAC5C,IAAI,UACN,CACJ;GAEA,IAAI,eAAe,SAAS,YAAY,QAAQ;IAC9C,OAAO,MACL,0DACF;IACA,OAAO,oBACL;KACE;KACA,aAAa;KACb;KACA;IACF,GACA,iBAAiB,CACnB;GACF;EACF;EAEA,OAAO,MAAM,EAAE,IAAI,GAAG,kCAAkC;EAExD,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,IAAI;EACd,EACF,CACF;CACF;AACF"}
|
|
@@ -7,13 +7,15 @@ import { logger } from "../../../logger/index.js";
|
|
|
7
7
|
import { find, findAll } from "../../../util/host-rules.js";
|
|
8
8
|
import { deleteLocalFile, ensureCacheDir, ensureLocalDir, getSiblingFileName, localPathExists, readLocalFile, writeLocalFile } from "../../../util/fs/index.js";
|
|
9
9
|
import { Json } from "../../../util/schema-utils/index.js";
|
|
10
|
+
import { Lazy } from "../../../util/lazy.js";
|
|
10
11
|
import { exec } from "../../../util/exec/index.js";
|
|
11
12
|
import { getRepoStatus } from "../../../util/git/index.js";
|
|
12
13
|
import { GitTagsDatasource } from "../../datasource/git-tags/index.js";
|
|
13
14
|
import { PackagistDatasource } from "../../datasource/packagist/index.js";
|
|
15
|
+
import { resolveToolConstraint } from "../util.js";
|
|
14
16
|
import { findGithubToken, takePersonalAccessTokenIfPossible } from "../../../util/check-token.js";
|
|
15
17
|
import { Lockfile, PackageFile } from "./schema.js";
|
|
16
|
-
import { extractConstraints, getComposerArguments, getComposerUpdateArguments,
|
|
18
|
+
import { extractConstraints, getComposerArguments, getComposerUpdateArguments, isArtifactAuthEnabled, requireComposerDependencyInstallation } from "./utils.js";
|
|
17
19
|
import { isEmptyObject, isString } from "@sindresorhus/is";
|
|
18
20
|
import { z } from "zod/v4";
|
|
19
21
|
import { quote } from "shlex";
|
|
@@ -69,17 +71,14 @@ async function updateArtifacts({ packageFileName, updatedDeps, newPackageFileCon
|
|
|
69
71
|
await ensureLocalDir(vendorDir);
|
|
70
72
|
try {
|
|
71
73
|
await writeLocalFile(packageFileName, newPackageFileContent);
|
|
72
|
-
const
|
|
73
|
-
...extractConstraints(file, lockfile),
|
|
74
|
-
...config.constraints
|
|
75
|
-
};
|
|
74
|
+
const fileConstraints = new Lazy(() => extractConstraints(file, lockfile));
|
|
76
75
|
const composerToolConstraint = {
|
|
77
76
|
toolName: "composer",
|
|
78
|
-
constraint:
|
|
77
|
+
constraint: await resolveToolConstraint(config, "composer", () => fileConstraints.getValue().composer)
|
|
79
78
|
};
|
|
80
79
|
const phpToolConstraint = {
|
|
81
80
|
toolName: "php",
|
|
82
|
-
constraint:
|
|
81
|
+
constraint: await resolveToolConstraint(config, "php", () => fileConstraints.getValue().php)
|
|
83
82
|
};
|
|
84
83
|
const execOptions = {
|
|
85
84
|
cwdFile: packageFileName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","names":["hostRules.find","hostRules.findAll"],"sources":["../../../../lib/modules/manager/composer/artifacts.ts"],"sourcesContent":["import { isEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { z } from 'zod/v4';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport {\n findGithubToken,\n takePersonalAccessTokenIfPossible,\n} from '../../../util/check-token.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ToolConstraint,\n} from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n ensureLocalDir,\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Json } from '../../../util/schema-utils/index.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { GitTagsDatasource } from '../../datasource/git-tags/index.ts';\nimport { PackagistDatasource } from '../../datasource/packagist/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { Lockfile, PackageFile } from './schema.ts';\nimport type { AuthJson } from './types.ts';\nimport {\n extractConstraints,\n getComposerArguments,\n getComposerUpdateArguments,\n getPhpConstraint,\n isArtifactAuthEnabled,\n requireComposerDependencyInstallation,\n} from './utils.ts';\n\nfunction getAuthJson(): string | null {\n const authJson: AuthJson = {};\n\n const githubHostRule = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n const gitTagsHostRule = hostRules.find({\n hostType: GitTagsDatasource.id,\n url: 'https://github.com',\n });\n\n const selectedGithubToken = takePersonalAccessTokenIfPossible(\n isArtifactAuthEnabled(githubHostRule)\n ? findGithubToken(githubHostRule)\n : undefined,\n isArtifactAuthEnabled(gitTagsHostRule)\n ? findGithubToken(gitTagsHostRule)\n : undefined,\n );\n\n if (selectedGithubToken) {\n authJson['github-oauth'] = {\n 'github.com': selectedGithubToken,\n };\n }\n\n for (const gitlabHostRule of hostRules.findAll({ hostType: 'gitlab' })) {\n if (!isArtifactAuthEnabled(gitlabHostRule)) {\n continue;\n }\n\n if (gitlabHostRule?.token) {\n const host = coerceString(gitlabHostRule.resolvedHost, 'gitlab.com');\n authJson['gitlab-token'] = coerceObject(authJson['gitlab-token']);\n authJson['gitlab-token'][host] = gitlabHostRule.token;\n // https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token\n authJson['gitlab-domains'] = [\n host,\n ...coerceArray(authJson['gitlab-domains']),\n ];\n }\n }\n\n for (const packagistHostRule of hostRules.findAll({\n hostType: PackagistDatasource.id,\n })) {\n if (!isArtifactAuthEnabled(packagistHostRule)) {\n continue;\n }\n\n const { resolvedHost, username, password, token } = packagistHostRule;\n if (resolvedHost && username && password) {\n authJson['http-basic'] = coerceObject(authJson['http-basic']);\n authJson['http-basic'][resolvedHost] = { username, password };\n } else if (resolvedHost && token) {\n authJson.bearer = coerceObject(authJson.bearer);\n authJson.bearer[resolvedHost] = token;\n }\n }\n\n return isEmptyObject(authJson) ? null : JSON.stringify(authJson);\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`composer.updateArtifacts(${packageFileName})`);\n\n const file = Json.pipe(PackageFile).parse(newPackageFileContent);\n\n const lockFileName = packageFileName.replace(regEx(/\\.json$/), '.lock');\n const lockfile = await z\n .string()\n .transform((f) => readLocalFile(f, 'utf8'))\n .pipe(Json)\n .pipe(Lockfile)\n .nullable()\n .catch(null)\n .parseAsync(lockFileName);\n if (!lockfile) {\n logger.debug('Composer: unable to read lockfile');\n return null;\n }\n\n const vendorDir = getSiblingFileName(packageFileName, 'vendor');\n const commitVendorFiles = await localPathExists(vendorDir);\n await ensureLocalDir(vendorDir);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n const constraints = {\n ...extractConstraints(file, lockfile),\n ...config.constraints,\n };\n\n const composerToolConstraint: ToolConstraint = {\n toolName: 'composer',\n constraint: constraints.composer,\n };\n\n const phpToolConstraint: ToolConstraint = {\n toolName: 'php',\n constraint: getPhpConstraint(constraints),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n COMPOSER_CACHE_DIR: await ensureCacheDir('composer'),\n COMPOSER_AUTH: getAuthJson(),\n },\n toolConstraints: [phpToolConstraint, composerToolConstraint],\n docker: {},\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n\n // Determine whether install is required before update\n if (requireComposerDependencyInstallation(lockfile)) {\n const preCmd = 'composer';\n const preArgs = `install${getComposerArguments(config, composerToolConstraint)}`;\n logger.trace({ preCmd, preArgs }, 'composer pre-update command');\n commands.push('git stash -- composer.json');\n commands.push(`${preCmd} ${preArgs}`);\n commands.push({ command: ['git', 'stash', 'pop'], ignoreFailure: true });\n }\n\n if (config.isLockFileMaintenance) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n await deleteLocalFile(lockFileName);\n }\n\n const cmd = 'composer';\n let args: string;\n if (config.isLockFileMaintenance) {\n args = 'update';\n } else {\n args =\n (\n 'update ' +\n updatedDeps\n .map((dep) =>\n dep.newVersion\n ? quote(`${dep.depName}:${dep.newVersion}`)\n : quote(dep.depName!),\n )\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')\n ).trim() +\n (config.postUpdateOptions?.includes('composerWithAll')\n ? ' --with-all-dependencies'\n : ' --with-dependencies');\n }\n args += getComposerUpdateArguments(config, composerToolConstraint);\n logger.trace({ cmd, args }, 'composer command');\n commands.push(`${cmd} ${args}`);\n\n await exec(commands, execOptions);\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated composer.lock');\n const res: UpdateArtifactsResult[] = [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: await readLocalFile(lockFileName),\n },\n },\n ];\n\n if (!commitVendorFiles) {\n return res;\n }\n\n logger.debug(`Committing vendor files in ${vendorDir}`);\n for (const f of [...status.modified, ...status.not_added]) {\n if (f.startsWith(vendorDir)) {\n res.push({\n file: {\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n },\n });\n }\n }\n for (const f of status.deleted) {\n res.push({\n file: {\n type: 'deletion',\n path: f,\n },\n });\n }\n\n return res;\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n if (\n err.message?.includes(\n 'Your requirements could not be resolved to an installable set of packages.',\n )\n ) {\n logger.info('Composer requirements cannot be resolved');\n } else if (err.message?.includes('write error (disk full?)')) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n } else {\n logger.debug({ err }, 'Failed to generate composer.lock');\n }\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,cAA6B;CACpC,MAAM,WAAqB,CAAC;CAE5B,MAAM,iBAAiBA,KAAe;EACpC,UAAU;EACV,KAAK;CACP,CAAC;CAED,MAAM,kBAAkBA,KAAe;EACrC,UAAU,kBAAkB;EAC5B,KAAK;CACP,CAAC;CAED,MAAM,sBAAsB,kCAC1B,sBAAsB,cAAc,IAChC,gBAAgB,cAAc,IAC9B,KAAA,GACJ,sBAAsB,eAAe,IACjC,gBAAgB,eAAe,IAC/B,KAAA,CACN;CAEA,IAAI,qBACF,SAAS,kBAAkB,EACzB,cAAc,oBAChB;CAGF,KAAK,MAAM,kBAAkBC,QAAkB,EAAE,UAAU,SAAS,CAAC,GAAG;EACtE,IAAI,CAAC,sBAAsB,cAAc,GACvC;EAGF,IAAI,gBAAgB,OAAO;GACzB,MAAM,OAAO,aAAa,eAAe,cAAc,YAAY;GACnE,SAAS,kBAAkB,aAAa,SAAS,eAAe;GAChE,SAAS,eAAe,CAAC,QAAQ,eAA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S,MAAM,cAAc;EACnC,IAAI,CAAC,OAAO,SAAS,SAAS,YAAY,GACxC,OAAO;EAET,OAAO,MAAM,iCAAiC;EAC9C,MAAM,MAA+B,CACnC,EACE,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU,MAAM,cAAc,YAAY;EAC5C,EACF,CACF;EAEA,IAAI,CAAC,mBACH,OAAO;EAGT,OAAO,MAAM,8BAA8B,WAAW;EACtD,KAAK,MAAM,KAAK,CAAC,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,GACtD,IAAI,EAAE,WAAW,SAAS,GACxB,IAAI,KAAK,EACP,MAAM;GACJ,MAAM;GACN,MAAM;GACN,UAAU,MAAM,cAAc,CAAC;EACjC,EACF,CAAC;EAGL,KAAK,MAAM,KAAK,OAAO,SACrB,IAAI,KAAK,EACP,MAAM;GACJ,MAAM;GACN,MAAM;EACR,EACF,CAAC;EAGH,OAAO;CACT,SAAS,KAAK;;EAEZ,IAAI,IAAI,YAAA,mBACN,MAAM;EAER,IACE,IAAI,SAAS,SACX,4EACF,GAEA,OAAO,KAAK,0CAA0C;OACjD,IAAI,IAAI,SAAS,SAAS,0BAA0B,GACzD,MAAM,IAAI,MAAM,8BAA8B;OAE9C,OAAO,MAAM,EAAE,IAAI,GAAG,kCAAkC;EAE1D,OAAO,CACL,EACE,eAAe;GACb,UAAU;GACV,QAAQ,IAAI;EACd,EACF,CACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"artifacts.js","names":["hostRules.find","hostRules.findAll"],"sources":["../../../../lib/modules/manager/composer/artifacts.ts"],"sourcesContent":["import { isEmptyObject, isString } from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { z } from 'zod/v4';\nimport {\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n TEMPORARY_ERROR,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport {\n findGithubToken,\n takePersonalAccessTokenIfPossible,\n} from '../../../util/check-token.ts';\nimport { exec } from '../../../util/exec/index.ts';\nimport type {\n CommandWithOptions,\n ExecOptions,\n ToolConstraint,\n} from '../../../util/exec/types.ts';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n ensureLocalDir,\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs/index.ts';\nimport { getRepoStatus } from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { Lazy } from '../../../util/lazy.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { Json } from '../../../util/schema-utils/index.ts';\nimport { coerceString } from '../../../util/string.ts';\nimport { GitTagsDatasource } from '../../datasource/git-tags/index.ts';\nimport { PackagistDatasource } from '../../datasource/packagist/index.ts';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types.ts';\nimport { resolveToolConstraint } from '../util.ts';\nimport { Lockfile, PackageFile } from './schema.ts';\nimport type { AuthJson } from './types.ts';\nimport {\n extractConstraints,\n getComposerArguments,\n getComposerUpdateArguments,\n isArtifactAuthEnabled,\n requireComposerDependencyInstallation,\n} from './utils.ts';\n\nfunction getAuthJson(): string | null {\n const authJson: AuthJson = {};\n\n const githubHostRule = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n });\n\n const gitTagsHostRule = hostRules.find({\n hostType: GitTagsDatasource.id,\n url: 'https://github.com',\n });\n\n const selectedGithubToken = takePersonalAccessTokenIfPossible(\n isArtifactAuthEnabled(githubHostRule)\n ? findGithubToken(githubHostRule)\n : undefined,\n isArtifactAuthEnabled(gitTagsHostRule)\n ? findGithubToken(gitTagsHostRule)\n : undefined,\n );\n\n if (selectedGithubToken) {\n authJson['github-oauth'] = {\n 'github.com': selectedGithubToken,\n };\n }\n\n for (const gitlabHostRule of hostRules.findAll({ hostType: 'gitlab' })) {\n if (!isArtifactAuthEnabled(gitlabHostRule)) {\n continue;\n }\n\n if (gitlabHostRule?.token) {\n const host = coerceString(gitlabHostRule.resolvedHost, 'gitlab.com');\n authJson['gitlab-token'] = coerceObject(authJson['gitlab-token']);\n authJson['gitlab-token'][host] = gitlabHostRule.token;\n // https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token\n authJson['gitlab-domains'] = [\n host,\n ...coerceArray(authJson['gitlab-domains']),\n ];\n }\n }\n\n for (const packagistHostRule of hostRules.findAll({\n hostType: PackagistDatasource.id,\n })) {\n if (!isArtifactAuthEnabled(packagistHostRule)) {\n continue;\n }\n\n const { resolvedHost, username, password, token } = packagistHostRule;\n if (resolvedHost && username && password) {\n authJson['http-basic'] = coerceObject(authJson['http-basic']);\n authJson['http-basic'][resolvedHost] = { username, password };\n } else if (resolvedHost && token) {\n authJson.bearer = coerceObject(authJson.bearer);\n authJson.bearer[resolvedHost] = token;\n }\n }\n\n return isEmptyObject(authJson) ? null : JSON.stringify(authJson);\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`composer.updateArtifacts(${packageFileName})`);\n\n const file = Json.pipe(PackageFile).parse(newPackageFileContent);\n\n const lockFileName = packageFileName.replace(regEx(/\\.json$/), '.lock');\n const lockfile = await z\n .string()\n .transform((f) => readLocalFile(f, 'utf8'))\n .pipe(Json)\n .pipe(Lockfile)\n .nullable()\n .catch(null)\n .parseAsync(lockFileName);\n if (!lockfile) {\n logger.debug('Composer: unable to read lockfile');\n return null;\n }\n\n const vendorDir = getSiblingFileName(packageFileName, 'vendor');\n const commitVendorFiles = await localPathExists(vendorDir);\n await ensureLocalDir(vendorDir);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n\n // `extractConstraints()` re-reads the updated package file, so its values win\n // over what extraction saw on the base branch. It only runs when a user\n // constraint is missing for at least one of the tools.\n const fileConstraints = new Lazy(() => extractConstraints(file, lockfile));\n\n const composerToolConstraint: ToolConstraint = {\n toolName: 'composer',\n constraint: await resolveToolConstraint(\n config,\n 'composer',\n () => fileConstraints.getValue().composer,\n ),\n };\n\n const phpToolConstraint: ToolConstraint = {\n toolName: 'php',\n constraint: await resolveToolConstraint(\n config,\n 'php',\n () => fileConstraints.getValue().php,\n ),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv: {\n COMPOSER_CACHE_DIR: await ensureCacheDir('composer'),\n COMPOSER_AUTH: getAuthJson(),\n },\n toolConstraints: [phpToolConstraint, composerToolConstraint],\n docker: {},\n };\n\n const commands: (string | CommandWithOptions)[] = [];\n\n // Determine whether install is required before update\n if (requireComposerDependencyInstallation(lockfile)) {\n const preCmd = 'composer';\n const preArgs = `install${getComposerArguments(config, composerToolConstraint)}`;\n logger.trace({ preCmd, preArgs }, 'composer pre-update command');\n commands.push('git stash -- composer.json');\n commands.push(`${preCmd} ${preArgs}`);\n commands.push({ command: ['git', 'stash', 'pop'], ignoreFailure: true });\n }\n\n if (config.isLockFileMaintenance) {\n logger.debug(\n `Removing ${lockFileName} first due to lock file maintenance upgrade`,\n );\n await deleteLocalFile(lockFileName);\n }\n\n const cmd = 'composer';\n let args: string;\n if (config.isLockFileMaintenance) {\n args = 'update';\n } else {\n args =\n (\n 'update ' +\n updatedDeps\n .map((dep) =>\n dep.newVersion\n ? quote(`${dep.depName}:${dep.newVersion}`)\n : quote(dep.depName!),\n )\n .filter(isString)\n .map((dep) => quote(dep))\n .join(' ')\n ).trim() +\n (config.postUpdateOptions?.includes('composerWithAll')\n ? ' --with-all-dependencies'\n : ' --with-dependencies');\n }\n args += getComposerUpdateArguments(config, composerToolConstraint);\n logger.trace({ cmd, args }, 'composer command');\n commands.push(`${cmd} ${args}`);\n\n await exec(commands, execOptions);\n const status = await getRepoStatus();\n if (!status.modified.includes(lockFileName)) {\n return null;\n }\n logger.debug('Returning updated composer.lock');\n const res: UpdateArtifactsResult[] = [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: await readLocalFile(lockFileName),\n },\n },\n ];\n\n if (!commitVendorFiles) {\n return res;\n }\n\n logger.debug(`Committing vendor files in ${vendorDir}`);\n for (const f of [...status.modified, ...status.not_added]) {\n if (f.startsWith(vendorDir)) {\n res.push({\n file: {\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n },\n });\n }\n }\n for (const f of status.deleted) {\n res.push({\n file: {\n type: 'deletion',\n path: f,\n },\n });\n }\n\n return res;\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n if (\n err.message?.includes(\n 'Your requirements could not be resolved to an installable set of packages.',\n )\n ) {\n logger.info('Composer requirements cannot be resolved');\n } else if (err.message?.includes('write error (disk full?)')) {\n throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);\n } else {\n logger.debug({ err }, 'Failed to generate composer.lock');\n }\n return [\n {\n artifactError: {\n fileName: lockFileName,\n stderr: err.message,\n },\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAS,cAA6B;CACpC,MAAM,WAAqB,CAAC;CAE5B,MAAM,iBAAiBA,KAAe;EACpC,UAAU;EACV,KAAK;CACP,CAAC;CAED,MAAM,kBAAkBA,KAAe;EACrC,UAAU,kBAAkB;EAC5B,KAAK;CACP,CAAC;CAED,MAAM,sBAAsB,kCAC1B,sBAAsB,cAAc,IAChC,gBAAgB,cAAc,IAC9B,KAAA,GACJ,sBAAsB,eAAe,IACjC,gBAAgB,eAAe,IAC/B,KAAA,CACN;CAEA,IAAI,qBACF,SAAS,kBAAkB,EACzB,cAAc,oBAChB;CAGF,KAAK,MAAM,kBAAkBC,QAAkB,EAAE,UAAU,SAAS,CAAC,GAAG;EACtE,IAAI,CAAC,sBAAsB,cAAc,GACvC;EAGF,IAAI,gBAAgB,OAAO;GACzB,MAAM,OAAO,aAAa,eAAe,cAAc,YAAY;GACnE,SAAS,kBAAkB,aAAa,SAAS,eAAe;GAChE,SAAS,eAAe,CAAC,QAAQ,eAAe;GAEhD,SAAS,oB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