aws / aws/aws-cdk

cdk-assets: [Windows] Failed to docker from Tarball assets. [100%] fail: spawn sh ENOENT

Open
#20,731 2 comments 6 reactions 0 assignees View on GitHub
@aws-cdk/assets bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

command: cdk deploy *-dev
under linux deploy process works fine, but the same project under windows ends with error.
Looks like cdk tries to spawn a sh process and fails under windows.

### Expected Behavior

same behavior on windows and linux machine. Probably not spawn "sh" during publishing docker image from Tarball.

### Current Behavior

```
app-dev
app-dev: deploying...
Retrieved account ID XXXXXXXXXXX from disk cache
Assuming role 'arn:aws:iam::XXXXXXXXXXX:role/cdk-hnb659fds-deploy-role-XXXXXXXXXXX-eu-central-1'.
Waiting for stack CDKToolkit to finish creating or updating...
[0%] start: Publishing d2922772e7f7c307b3e65a4e5338de4859973b8ce43567f974d87d86806153cf:XXXXXXXXXXX-eu-central-1
[0%] start: Publishing 60444682739e7d4b7433c805f6a6c40abd1aba2f779ea396ae2d04971fc96311:XXXXXXXXXXX-eu-central-1
Retrieved account ID XXXXXXXXXXX from disk cache
Assuming role 'arn:aws:iam::XXXXXXXXXXX:role/cdk-hnb659fds-file-publishing-role-XXXXXXXXXXX-eu-central-1'.
Retrieved account ID XXXXXXXXXXX from disk cache
Assuming role 'arn:aws:iam::XXXXXXXXXXX:role/cdk-hnb659fds-image-publishing-role-XXXXXXXXXXX-eu-central-1'.
[0%] check: Check s3://cdk-hnb659fds-assets-XXXXXXXXXXX-eu-central-1/d2922772e7f7c307b3e65a4e5338de4859973b8ce43567f974d87d86806153cf.json
[0%] check: Check XXXXXXXXXXX.dkr.ecr.eu-central-1.amazonaws.com/cdk-hnb659fds-container-assets-XXXXXXXXXXX-eu-central-1:60444682739e7d4b7433c805f6a6c40abd1aba2f779ea396ae2d04971fc96311 Call failed: describeImages({"repositoryName":"cdk-hnb659fds-container-assets-XXXXXXXXXXX-eu-central-1","imageIds":[{"imageTag":"60444682739e7d4b7433c805f6a6c40abd1aba2f779ea396ae2d04971fc96311"}]}) => The image with imageId {imageDigest:'null', imageTag:'60444682739e7d4b7433c805f6a6c40abd1aba2f779ea396ae2d04971fc96311'} does not exist within the repository with name 'cdk-hnb659fds-container-assets-XXXXXXXXXXX-eu-central-1' in the registry with id 'XXXXXXXXXXX' (code=ImageNotFoundException)
[0%] debug: docker login --username AWS --password-stdin https://XXXXXXXXXXX.dkr.ecr.eu-central-1.amazonaws.com
[0%] upload: Upload s3://cdk-hnb659fds-assets-XXXXXXXXXXX-eu-central-1/d2922772e7f7c307b3e65a4e5338de4859973b8ce43567f974d87d86806153cf.json
[50%] success: Published d2922772e7f7c307b3e65a4e5338de4859973b8ce43567f974d87d86806153cf:XXXXXXXXXXX-eu-central-1
[50%] build: Building Docker image using command 'sh,-c,docker load -i asset.60444682739e7d4b7433c805f6a6c40abd1aba2f779ea396ae2d04971fc96311.tar | sed "s/Loaded image: //g"'
[100%] fail: spawn sh ENOENT

❌ app-dev failed: Error: Failed to publish one or more assets. See the error messages above for more information.
at publishAssets (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\util\asset-publishing.ts:44:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at CloudFormationDeployments.publishStackAssets (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\cloudformation-deployments.ts:464:7)
at CloudFormationDeployments.deployStack (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\cloudformation-deployments.ts:339:7)
at CdkToolkit.deploy (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\cdk-toolkit.ts:209:24)
at initCommandLine (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\cli.ts:341:12)
Reading cached notices from C:\Users\Yevgen\.cdk\cache\notices.json

Failed to publish one or more assets. See the error messages above for more information.
Error: Failed to publish one or more assets. See the error messages above for more information.
at publishAssets (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\util\asset-publishing.ts:44:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at CloudFormationDeployments.publishStackAssets (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\cloudformation-deployments.ts:464:7)
at CloudFormationDeployments.deployStack (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\cloudformation-deployments.ts:339:7)
at CdkToolkit.deploy (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\cdk-toolkit.ts:209:24)
at initCommandLine (C:\Users\Yevgen\AppData\Roaming\npm\node_modules\aws-cdk\lib\cli.ts:341:12)
```

### Reproduction Steps

dwcDownloadTaskDefinition = FargateTaskDefinition.Builder.create(this, "TaskDefinition").build();

containerDefinition = dwcDownloadTaskDefinition.addContainer("AppContainer",
ContainerDefinitionOptions.builder()
.image(ContainerImage.fromTarball("build/assets/app.tar"))
.build());

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.27.0 (build 8e89048)

### Framework Version

_No response_

### Node.js Version

v16.5.0

### OS

Windows 10

### Language

Java

### Language Version

8

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in lib/util/asset-publishing.ts and trace the Docker tarball publishing path shown in the stack trace, especially the command that invokes sh and sed. Reproduce with ContainerImage.fromTarball on Windows using the reported cdk deploy flow. Done means the asset publishes without spawn sh ENOENT and deployment succeeds on Windows as it does on Linux.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.