-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The --msbuild-parameters flag is performing incorrectly when spawned by child_process #358
Comments
Not reproducible. Executed locally
It passes Executed as part of GitHub workflow action name: AWS .NET Extensions for CLI Lambda tools package test
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Setup AWS .NET Extensions for CLI Lambda tools
run: dotnet tool install -g Amazon.Lambda.Tools
- name: Build project
run: dotnet build ./LambdaNet8Test -c Release
- name: Package using dotnet lambda
run: dotnet lambda package --disable-interactive true --project-location ./LambdaNet8Test --output-package publish/output.zip --function-runtime dotnet8 --function-architecture arm64
- name: Package using dotnet lambda (with "--no-restore --no-build")
run: dotnet lambda package --disable-interactive true --project-location ./LambdaNet8Test --output-package publish/output.zip --function-runtime dotnet8 --function-architecture arm64 --msbuild-parameters "--no-restore --no-build" Works fine with below output for Package using dotnet lambda (with "--no-restore --no-build") step:
Notice that parameters @Levelleor Please share the minimal repro setup for troubleshooting the issue. Thanks, |
Sure, thank you, @ashishdhingra. The issue is not github actions themselves but how arguments are handled by the aws tool when spawning commands in a child process using javascript, I am assuming in Python I'll be getting the same issue, but I haven't tested that. A minimal example looks like this:
I included absolute bare minimum: some basic code and absolutely no dependencies. I install .NET lambda tool and run it with msbuild parameters set. Please let me know if there's anything else needed. I'd love to see a workaround to get this working meanwhile! Thanks! |
@Levelleor Thanks for the repro steps. Issue is reproducible. Looks like |
Describe the bug
I am executing the following command via a JS Github Action:
I need the ability to pass multiple arguments via msbuild-parameters flag and thus I've encapsulated them into double quotes as requested by the help manual. Both --no-restore and --no-build here are appended as a single command-line argument and are not parsed by dotnet correctly, instead being set on MSBuild call and failing the execution.
Regression Issue
Expected Behavior
I expect this to be called:
Current Behavior
I get this result instead:
.NET isn't parsing --no-restore and --no-build because it didn't recognize them and thus it passed these down to msbuild it seems like.
Reproduction Steps
I already tried the following:
args.push(...this.inputs.publishArgs.split(/\s+/).flatMap(a => [
--msbuild-parameters, a]));
args.push(
--msbuild-parameters, ...this.inputs.publishArgs.split(/\s+/));
args.push(
--msbuild-parameters,
'${this.inputs.publishArgs}');
args.push(
--msbuild-parameters="${this.inputs.publishArgs}");
None of these provide the desired results. Some of these result into missing arguments (effectively just ignoring them), others fail with the error of MSBuild not recognizing given options.
Later after these args are set they are fed into an actions/exec package which then spawns them in a child_process.
await exec(cmd, args, opt);
Possible Solution
No response
Additional Information/Context
No response
Targeted .NET platform
.NET 8
CLI extension version
Package Id Version Commands
amazon.lambda.tools 5.12.3 dotnet-lambda
Environment details (OS name and version, etc.)
RHEL9
The text was updated successfully, but these errors were encountered: