Skip to content

fix: use the more portable CDK executable for cdk overrides#4808

Merged
mergify[bot] merged 3 commits intoaws:mainlinefrom
Lou1415926:fix/overrides/windows/exec
May 1, 2023
Merged

fix: use the more portable CDK executable for cdk overrides#4808
mergify[bot] merged 3 commits intoaws:mainlinefrom
Lou1415926:fix/overrides/windows/exec

Conversation

@Lou1415926
Copy link
Copy Markdown
Contributor

The old one points to a script with shebang line, which is ignored by Windows. As a result, when I used cdk overrides on Windows, it ends up not being able to interprete the cdk.js file

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@Lou1415926 Lou1415926 requested a review from a team as a code owner April 27, 2023 00:34
@Lou1415926 Lou1415926 requested review from paragbhingre and removed request for a team April 27, 2023 00:34
@Lou1415926 Lou1415926 force-pushed the fix/overrides/windows/exec branch from 2d8de08 to b35ba2a Compare April 27, 2023 00:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2023

🍕 Here are the new binary sizes!

Name New size (kiB) size (kiB) Delta (%)
macOS (amd) 50596 50328 +0.53
macOS (arm) 50796 50516 +0.55
linux (amd) 44540 44304 +0.53
linux (arm) 42820 42564 +0.60
windows (amd) 41420 41204 +0.52

Copy link
Copy Markdown
Contributor

@bvtujo bvtujo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find on this fix!

// We assume that a node_modules/ dir is present with the CDK downloaded after running "npm install".
// This way clients don't need to install the CDK toolkit separately.
cmd := cdk.exec.Command(filepath.Join("node_modules", "aws-cdk", "bin", "cdk"), "synth", "--no-version-reporting")
cmd := cdk.exec.Command(filepath.Join("node_modules", ".bin", "cdk"), "synth", "--no-version-reporting")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the .bin/cdk file's content look like out of curiosity?

Copy link
Copy Markdown
Contributor Author

@Lou1415926 Lou1415926 Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks the same as aws-cdk/bin/cdk on Unix systems, but on Windows it looked different! After I got home I can check on my little Windows machine.

Putting the DNM label on so that i can post the snippet before it's merged!

Copy link
Copy Markdown
Contributor

@dannyrandall dannyrandall Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(on windows) node_modules/.bin/cdk:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node" ]; then
  exec "$basedir/node"  "$basedir/../aws-cdk/bin/cdk" "$@"
else 
  exec node  "$basedir/../aws-cdk/bin/cdk" "$@"
fi

(on mac) node_modules/.bin/cdk

#!/usr/bin/env node
require('./cdk.js');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty!

@Lou1415926 Lou1415926 added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Apr 27, 2023
@Lou1415926 Lou1415926 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label May 1, 2023
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #4808 (6584db0) into mainline (4c29094) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 6584db0 differs from pull request most recent head a883c4a. Consider uploading reports for the commit a883c4a to get more accurate results

@@            Coverage Diff            @@
##           mainline    #4808   +/-   ##
=========================================
  Coverage     70.05%   70.05%           
=========================================
  Files           287      287           
  Lines         41126    41126           
  Branches        280      280           
=========================================
  Hits          28810    28810           
  Misses        10929    10929           
  Partials       1387     1387           
Impacted Files Coverage Δ
internal/pkg/override/cdk.go 77.60% <100.00%> (ø)

@mergify mergify Bot merged commit 0a2994a into aws:mainline May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants