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

feat(cdk-v2): Adding build scripts for CDK v2 #353

Merged
merged 7 commits into from
Sep 16, 2021
Merged

Conversation

hnishar
Copy link
Contributor

@hnishar hnishar commented Aug 31, 2021

Issue #, if available: 348

Description of changes:

Adding build scripts for CDK v2 build

@hnishar hnishar self-assigned this Aug 31, 2021
@hnishar hnishar linked an issue Aug 31, 2021 that may be closed by this pull request
2 tasks
@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: cbe0d74
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: 1ef438c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: 422bf20
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: e1320d7
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

// 1 - align the version in a package.json file to the version of the repo
// 2 - Remove all entries starting with @aws-cdk/* and constructs from "dependencies": { ... }
// 3 - Remove all entries starting with @aws-cdk/* and constructs from "peerDependencies": { ... }, Add { "aws-cdk-lib": "^2.0.0-rc.1", "constructs": "^10.0.0" }
// 4 - Add { "aws-cdk-lib": "2.0.0-rc.1", "constructs": "^10.0.0" } to "devDependencies"
Copy link
Contributor

Choose a reason for hiding this comment

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

If someone runs v2/align-version, is there any way to go back to v1?

Seems like v1/align-version needs to reset things back to v1 - if someone screws up and checks in files already set to v2 there's going to be problems down the line if v1 doesn't reset it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Steps to go back to v1 is
1 - reset v2/align deployment/v2/align-version.sh revert
2 - set v1/align deployment/align-version.sh

function processPeerDependencies(section, file) {
let newdependencies = {};
for (const [ name, version ] of Object.entries(section)) {
// Remove all entries starting with @aws-cdk/* and constructs
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm - seeing what you're doing here makes it look like going backwards is not possible, there's no way to determine what aws-cdk module dependencies need to be included.

Are we relying on revert to undo all this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, reverting back the files from git is how you can go back to v1 codebase


echo "============================================================================================="
echo "reverting back TypeScript import statements for CDK v2..."
git checkout `find . -name *.ts | grep -v node_modules | grep -v **/*.d.ts`
Copy link
Contributor

Choose a reason for hiding this comment

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

What's going on here - looks like we're refreshing the node_modules folder similar to npm install?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverting back the *.ts file from Git which will essentially revert back the rewritten import statements

mv CHANGELOG.v2.md CHANGELOG.md

# Rename lerna.json
echo "Rename source/lerna.json to source/lerna.json.bak"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned that v1 is unchanged through all this, it leaves us open to making more changes when v2 becomes the standard build in 3 months. It would be better if both the v1 and v2 versions made the changes required to work.

eg - rather than the two changelog files being:

changelog.v2.md
changelog.md

and v1 gets pushed aside during rebuild, they should be

changelog.v2.md
changelog.v1.md

and the correct one gets put in place for a build. Similar with lerna.json. There is no changelog.md stored in the repo. Right now we're telling everyone that solutions constructs IS v1, but in 3 months that will change to v2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not following here, if the concern is to rename the existing changelog.md to changelog.v1.md and lerna.json to lerna.v1.json that's doable, is it more than that?

@@ -0,0 +1,201 @@
Apache License
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we duplicating the cdk migration tool here?

Why would we do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes, for the same reason as cdk-integ-tools, it needed to be modified to handle special case of rewriting the import statments for IConstruct

biffgaut
biffgaut previously approved these changes Sep 9, 2021
@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: db56b02
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: 3ef08e7
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-fkVQbXRiQi6A
  • Commit ID: 7844d67
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@hnishar hnishar merged commit 5657b98 into main Sep 16, 2021
@hnishar hnishar deleted the cdk-v2-build-scripts branch September 16, 2021 16:42
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.

Build scripts for CDK v2
3 participants