@go-to-k/cdkd 0.115.2 → 0.115.4

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.
@@ -2896,6 +2896,87 @@ async function spawnStreaming(cmd, args, options = {}) {
2896
2896
  }
2897
2897
  });
2898
2898
  }
2899
+ /**
2900
+ * Spawn a docker-compatible CLI binary (resolved via `getDockerCmd`) attached
2901
+ * to the parent process's stdio so the user sees live output (`docker pull`
2902
+ * layer progress, `docker login` interactive prompts that should never fire
2903
+ * with `--password-stdin` but still safe to inherit, etc.). Resolves on exit
2904
+ * code 0; rejects with a plain `Error` carrying the exit code on any non-zero
2905
+ * exit, so the caller can wrap with its own error class.
2906
+ *
2907
+ * Differs from {@link runDockerStreaming} in two ways:
2908
+ * 1. `stdio: 'inherit'` — output is NOT captured, so terminal control codes
2909
+ * (color, progress bar overwrites) flow through unchanged. This is the
2910
+ * load-bearing reason for the split: `docker pull`'s progress bars only
2911
+ * animate properly when stdout is a real TTY connected to the parent.
2912
+ * 2. No `input` / `streamLive` options — inherit-mode has nothing to
2913
+ * capture and nothing to mirror.
2914
+ *
2915
+ * Used by the `--verbose`-mode `docker pull` plumbing in `docker-runner.ts`
2916
+ * and `ecr-puller.ts` (visible layer progress). Non-verbose pulls go through
2917
+ * {@link runDockerStreaming} so stderr can be folded into the error message.
2918
+ */
2919
+ async function runDockerForeground(args, options = {}) {
2920
+ return spawnForeground(getDockerCmd(), args, options);
2921
+ }
2922
+ /**
2923
+ * Foreground (stdio-inherit) spawn — the inherit-mode counterpart to
2924
+ * {@link spawnStreaming}. Used by {@link runDockerForeground} for docker-CLI
2925
+ * subprocesses.
2926
+ *
2927
+ * The ENOENT branch crafts a docker-specific install hint ("Install Docker
2928
+ * (or set CDK_DOCKER ...)"), so non-docker callers reusing this helper
2929
+ * would see a misleading error on missing-binary failures. Keep the binary
2930
+ * docker-shaped, or update the ENOENT message before adding a non-docker
2931
+ * call site.
2932
+ */
2933
+ async function spawnForeground(cmd, args, options = {}) {
2934
+ const env = options.env ? mergeEnv(options.env) : void 0;
2935
+ return new Promise((resolve, reject) => {
2936
+ const child = spawn(cmd, args, {
2937
+ cwd: options.cwd,
2938
+ env,
2939
+ stdio: "inherit"
2940
+ });
2941
+ child.once("error", (err) => {
2942
+ if (err.code === "ENOENT") {
2943
+ const usingOverride = process.env["CDK_DOCKER"] === cmd && cmd !== "docker";
2944
+ reject(/* @__PURE__ */ new Error(usingOverride ? `Failed to find and execute '${cmd}' (resolved via CDK_DOCKER). Install '${cmd}' or unset CDK_DOCKER to fall back to 'docker'.` : `Failed to find and execute '${cmd}'. Install Docker (or set the 'CDK_DOCKER' environment variable to a compatible binary such as podman / finch).`));
2945
+ } else reject(/* @__PURE__ */ new Error(`${cmd} failed: ${err.message}`));
2946
+ });
2947
+ child.once("close", (code) => {
2948
+ if (code === 0) resolve();
2949
+ else reject(/* @__PURE__ */ new Error(`${cmd} exited with code ${code}`));
2950
+ });
2951
+ });
2952
+ }
2953
+ /**
2954
+ * Format the stderr from a failed `docker login` so the surfaced cdkd
2955
+ * error gives the user an actionable workaround when the underlying
2956
+ * failure is a credential-helper persistence bug (which has nothing to
2957
+ * do with cdkd, AWS, or IAM perms — the docker CLI itself fails to
2958
+ * save the auth token to the platform's credential store). The most
2959
+ * common shape is `osxkeychain` on macOS rejecting an overwrite for
2960
+ * an existing entry, but `wincred` (Windows), `pass` (Linux), and
2961
+ * `secretservice` (Linux) hit the same class of `Error saving
2962
+ * credentials` failure, so the rewritten message stays platform-
2963
+ * agnostic — `docker logout <endpoint>` is the correct recovery on
2964
+ * every backend.
2965
+ *
2966
+ * Detected docker / docker-credential-* output patterns:
2967
+ * - `error storing credentials - err: exit status 1, out: \`The
2968
+ * specified item already exists in the keychain.\`` (osxkeychain)
2969
+ * - `Error saving credentials: ...` (any backend)
2970
+ *
2971
+ * Non-matching failures (genuine IAM / network / endpoint problems)
2972
+ * pass through with just the stderr trimmed — the original message
2973
+ * stays load-bearing for diagnosis.
2974
+ */
2975
+ function formatDockerLoginError(stderr, endpoint) {
2976
+ const trimmed = stderr.trim();
2977
+ if (trimmed.includes("already exists in the keychain") || trimmed.includes("Error saving credentials")) return `docker's credential helper (osxkeychain on macOS / wincred on Windows / pass / secretservice on Linux) failed to persist the ECR auth token. The "already exists in the keychain" / "Error saving credentials" output is a known docker-credential-helpers issue — unrelated to cdkd, AWS credentials, or IAM perms. Quick fix: run \`docker logout ${endpoint}\` to clear the stale entry, then retry the cdkd command. Permanent fix: edit ~/.docker/config.json and remove (or empty) the platform-specific "credsStore" entry (e.g. "osxkeychain" → "" or "desktop" on macOS Docker Desktop). Original docker stderr: ${trimmed}`;
2978
+ return trimmed;
2979
+ }
2899
2980
  function mergeEnv(overrides) {
2900
2981
  const merged = { ...process.env };
2901
2982
  for (const [k, v] of Object.entries(overrides)) if (v === void 0) delete merged[k];
@@ -2965,7 +3046,7 @@ async function buildDockerImage(asset, cdkOutDir, options) {
2965
3046
  function buildDockerBuildCommand(source, tag, platformOverride) {
2966
3047
  const args = [
2967
3048
  "build",
2968
- "-t",
3049
+ "--tag",
2969
3050
  tag
2970
3051
  ];
2971
3052
  if (source.dockerBuildArgs) for (const [k, v] of Object.entries(source.dockerBuildArgs)) args.push("--build-arg", `${k}=${v}`);
@@ -2973,7 +3054,7 @@ function buildDockerBuildCommand(source, tag, platformOverride) {
2973
3054
  if (source.dockerBuildSecrets) for (const [k, v] of Object.entries(source.dockerBuildSecrets)) args.push("--secret", `id=${k},${v}`);
2974
3055
  if (source.dockerBuildSsh) args.push("--ssh", source.dockerBuildSsh);
2975
3056
  if (source.dockerBuildTarget) args.push("--target", source.dockerBuildTarget);
2976
- if (source.dockerFile) args.push("-f", source.dockerFile);
3057
+ if (source.dockerFile) args.push("--file", source.dockerFile);
2977
3058
  if (source.networkMode) args.push("--network", source.networkMode);
2978
3059
  const platform = platformOverride ?? source.platform;
2979
3060
  if (platform) args.push("--platform", platform);
@@ -3129,7 +3210,7 @@ var DockerAssetPublisher = class {
3129
3210
  ], { input: password });
3130
3211
  } catch (err) {
3131
3212
  const e = err;
3132
- throw new AssetError(`ECR login failed: ${e.stderr?.trim() || e.message || String(err)}`);
3213
+ throw new AssetError(`ECR login failed: ${formatDockerLoginError(e.stderr || e.message || String(err), endpoint)}`);
3133
3214
  }
3134
3215
  }
3135
3216
  /**
@@ -9740,5 +9821,5 @@ var DeployEngine = class {
9740
9821
  };
9741
9822
 
9742
9823
  //#endregion
9743
- export { StackTerminationProtectionError as $, getDefaultStateBucketName as A, resolveBucketRegion as B, AssetPublisher as C, getDockerCmd as D, buildDockerImage as E, resolveStateBucketWithDefault as F, LocalInvokeBuildError as G, CdkdError as H, resolveStateBucketWithDefaultAndSource as I, ProvisioningError as J, LockError as K, warnDeprecatedNoPrefixCliFlag as L, resolveApp as M, resolveCaptureObservedState as N, runDockerStreaming as O, resolveSkipPrefix as P, StackHasActiveImportsError as Q, AssemblyReader as R, shouldRetainResource as S, WorkGraph as T, ConfigError as U, AssetError as V, DependencyError as W, ResourceUpdateNotSupportedError as X, ResourceTimeoutError as Y, RouteDiscoveryError as Z, DiffCalculator as _, withRetry as a, withErrorHandling as at, LockManager as b, collectInlinePolicyNamesManagedBySiblings as c, setLogger as ct, normalizeAwsTagsToCfn as d, PATTERN_B_NAME_PROPERTIES as dt, StateError as et, resolveExplicitPhysicalId as f, PATTERN_B_RESOURCE_TYPES as ft, IntrinsicFunctionResolver as g, withStackName as gt, assertRegionMatch as h, withSkipPrefix as ht, withResourceDeadline as i, normalizeAwsError as it, getLegacyStateBucketName as j, Synthesizer as k, CDK_PATH_TAG as l, runStackBuffered as lt, CloudControlProvider as m, generateResourceNameWithFallback as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, formatError as nt, IMPLICIT_DELETE_DEPENDENCIES as o, ConsoleLogger as ot, ProviderRegistry as p, generateResourceName as pt, PartialFailureError as q, DeployEngine as r, isCdkdError as rt, IAMRoleProvider as s, getLogger as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, SynthesisError as tt, matchesCdkPath as u, getLiveRenderer as ut, DagBuilder as v, stringifyValue as w, S3StateBackend as x, TemplateParser as y, clearBucketRegionCache as z };
9744
- //# sourceMappingURL=deploy-engine-AoZgViZN.js.map
9824
+ export { RouteDiscoveryError as $, runDockerStreaming as A, AssemblyReader as B, AssetPublisher as C, formatDockerLoginError as D, buildDockerImage as E, resolveCaptureObservedState as F, ConfigError as G, resolveBucketRegion as H, resolveSkipPrefix as I, LockError as J, DependencyError as K, resolveStateBucketWithDefault as L, getDefaultStateBucketName as M, getLegacyStateBucketName as N, getDockerCmd as O, resolveApp as P, ResourceUpdateNotSupportedError as Q, resolveStateBucketWithDefaultAndSource as R, shouldRetainResource as S, WorkGraph as T, AssetError as U, clearBucketRegionCache as V, CdkdError as W, ProvisioningError as X, PartialFailureError as Y, ResourceTimeoutError as Z, DiffCalculator as _, withSkipPrefix as _t, withRetry as a, isCdkdError as at, LockManager as b, collectInlinePolicyNamesManagedBySiblings as c, ConsoleLogger as ct, normalizeAwsTagsToCfn as d, runStackBuffered as dt, StackHasActiveImportsError as et, resolveExplicitPhysicalId as f, getLiveRenderer as ft, IntrinsicFunctionResolver as g, generateResourceNameWithFallback as gt, assertRegionMatch as h, generateResourceName as ht, withResourceDeadline as i, formatError as it, Synthesizer as j, runDockerForeground as k, CDK_PATH_TAG as l, getLogger as lt, CloudControlProvider as m, PATTERN_B_RESOURCE_TYPES as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, StateError as nt, IMPLICIT_DELETE_DEPENDENCIES as o, normalizeAwsError as ot, ProviderRegistry as p, PATTERN_B_NAME_PROPERTIES as pt, LocalInvokeBuildError as q, DeployEngine as r, SynthesisError as rt, IAMRoleProvider as s, withErrorHandling as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, StackTerminationProtectionError as tt, matchesCdkPath as u, setLogger as ut, DagBuilder as v, withStackName as vt, stringifyValue as w, S3StateBackend as x, TemplateParser as y, warnDeprecatedNoPrefixCliFlag as z };
9825
+ //# sourceMappingURL=deploy-engine-Chzg_hDE.js.map