Skip to content
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

fix(cli): stop cli argument defaults from overriding cdk.json settings #21891

Conversation

berenddeboer
Copy link
Contributor

@berenddeboer berenddeboer commented Sep 2, 2022

This PR fixes the problems mentioned in #3573. Previously pathMetadata, assetMetadata, debug, and staging could not be set in cdk.json as command-line parameters defaults would always overwrite this. In particular this cdk.json would be ignored:

{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}

The issue is this piece of code:

 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();

commandLineArguments returns true for the above mentioned options.


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Sep 2, 2022

@github-actions github-actions bot added the p2 label Sep 2, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team September 2, 2022 06:13
@berenddeboer
Copy link
Contributor Author

Linter fails saying a fix should make a change to a test file, unfortunately there was no test file that tests command-line parsing and integration with cdk.json.

@berenddeboer berenddeboer changed the title fix(cli): stop argument defaults to override cdk.json settings fix(cli): stop cli argument defaults from overriding cdk.json settings Sep 5, 2022
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@corymhall
Copy link
Contributor

Running through the test pipeline.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 76c6cc8
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@corymhall corymhall added the pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested label Oct 21, 2022
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Nov 20, 2022
@aws-cdk-automation
Copy link
Collaborator

The pull request linter fails with the following errors:

❌ Fixes must contain a change to a test file.
❌ Fixes must contain a change to an integration test file and the resulting snapshot.

PRs must pass status checks before we can provide a meaningful review.

@jbschooley
Copy link

Could we get this reopened?

iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.
iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.
iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.
iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.

There are already unit tests around the cli which show that the same behavior works, located
here:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

fixes aws#3573
shoutout to @berenddeboer who did the work, I'm just reviving it.
iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.

There are already unit tests around the cli which show that the same behavior works, located
here:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

fixes aws#3573
shoutout to @berenddeboer who did the work, I'm just reviving it.
iph pushed a commit to iph/aws-cdk that referenced this pull request Mar 9, 2023
Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json`
as command-line parameters defaults would always overwrite this. In particular, this
`cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy
of aws#21891 which fell through the cracks, so I'm picking
up as this can potentially cause outages to resources that have drift under the hood, and
adding metadata looks like an `Update` operation to CloudFormation.

There are already unit tests around the cli which show that the same behavior works, located
here:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

fixes aws#3573
shoutout to @berenddeboer who did the work, I'm just reviving it.
mergify bot pushed a commit that referenced this pull request Mar 22, 2023
…d in cdk.json (#24533)

Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json` as command-line parameters defaults would always overwrite this. In particular, this `cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy of #21891 which fell through the cracks, so I'm picking up as this can potentially cause outages to resources that have drift under the hood, and adding metadata looks like an `Update` operation to CloudFormation.

There are already unit tests around the cli which show that the same behavior works, located here:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts
 
shoutout to @berenddeboer who did the work, I'm just reviving it.

Closes #3573

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
homakk pushed a commit to homakk/aws-cdk that referenced this pull request Mar 28, 2023
…d in cdk.json (aws#24533)

Previously, pathMetadata, assetMetadata, debug and staging could not be set in `cdk.json` as command-line parameters defaults would always overwrite this. In particular, this `cdk.json` would be ignored:

```
{
  "app": "npx ts-node --prefer-ts-exts bin/example",
  ...
  "pathMetadata": false,
  "assetMetadata": false
}
```

The issue is this piece of code:
```
 this.settings = this.defaultConfig
            .merge(userConfig)
            .merge(this.projectConfig)
            .merge(this.commandLineArguments)
            .makeReadOnly();
```

`commandLineArguments` returns true for the above mentioned options. This commit is a copy of aws#21891 which fell through the cracks, so I'm picking up as this can potentially cause outages to resources that have drift under the hood, and adding metadata looks like an `Update` operation to CloudFormation.

There are already unit tests around the cli which show that the same behavior works, located here:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts
 
shoutout to @berenddeboer who did the work, I'm just reviving it.

Closes aws#3573

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants