Skip to content

Commit

Permalink
chore: regenerate attributions on automatic dependency upgrades (#19439)
Browse files Browse the repository at this point in the history
Even since #18667, our build process validates that the `THIRD_PARTY_LICENSES` file of the CLI package is up to date. That is, the version of it committed to source code matches the one being auto generated.

This behavior breaks our automatic dependency upgrades whenever it includes an upgrade to one of the CLI's dependencies. This is because the autogenerated file will (for sure) have different dependency versions, and possibly also include new transitive dependencies. 

This manifests an error like so:

```console
aws-cdk: In package package.json
aws-cdk: - [bundle/outdated-attributions] THIRD_PARTY_LICENSES is outdated (fixable)
aws-cdk: Error: Some package.json files had errors
```

To fix this, we currently need to manually regenerate the `THIRD_PARTY_LICENSES` file by running `yarn pkglint` on the CLI package. 

> For example: 5ca8ebf

This PR adds a regeneration step to the upgrade workflow so that the PR also includes the up to date document. 
Note that if this doesn't mean attribution validation will always pass. If any dependencies changed licenses to one that isn't allowlisted, the validation will still fail.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
iliapolo committed Mar 17, 2022
1 parent 16d293d commit 90bc197
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/yarn-upgrade.yml
Expand Up @@ -33,9 +33,13 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |-
${{ runner.os }}-yarn-
- name: Yarn Install
run: yarn install --frozen-lockfile
- name: Install Tools
run: |-
npm -g install lerna npm-check-updates@^9.0.0
- name: Build CLI
run: cd packages/aws-cdk && ../../scripts/buildup
- name: List Mono-Repo Packages
id: list-packages
# These need to be ignored from the `ncu` runs!
Expand All @@ -59,12 +63,16 @@ jobs:
lerna exec --parallel ncu -- --upgrade --filter=@types/node,@types/fs-extra --target=minor
lerna exec --parallel ncu -- --upgrade --filter=typescript --target=patch
lerna exec --parallel ncu -- --upgrade --reject='@types/node,@types/fs-extra,constructs,typescript,aws-sdk,aws-sdk-mock,${{ steps.list-packages.outputs.list }}' --target=minor
# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn update" to run)
- name: Run "yarn install"
run: yarn install

- name: Run "yarn upgrade"
run: yarn upgrade

- name: Regenerate CLI attributions
run: cd packages/aws-cdk && yarn pkglint

# Next, create and upload the changes as a patch file. This will later be downloaded to create a pull request
# Creating a pull request requires write permissions and it's best to keep write privileges isolated.
Expand Down

0 comments on commit 90bc197

Please sign in to comment.