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 Build Integration Test #1219

Merged

Conversation

MrArnoldPalmer
Copy link
Contributor

Adds @jsii/integ-test private module for defining new integration tests.
Adds a new integration test that downloads the latest CDK release source
code and builds it with the local version of jsii and jsii-pacmak.

This unit test requires a github access token defined in the environment
to get the latest release version and download the asset.

Fixes: #1209


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

@MrArnoldPalmer MrArnoldPalmer added the pr/do-not-merge This PR should not be merged at this time. label Jan 27, 2020
@MrArnoldPalmer MrArnoldPalmer requested a review from a team as a code owner January 27, 2020 03:37
@MrArnoldPalmer
Copy link
Contributor Author

MrArnoldPalmer commented Jan 27, 2020

@RomainMuller

  1. Where is the best place to actually add yarn test:integ in our CD pipeline. I would think in the deploy pipeline but adding it to buildspec.yml means it will run on all PRs and other events? Do we need to specify some conditional logic in buildspec to decide?
  2. Specified a 60min timeout which on my machine it finishes comfortably. That feel right to you?
  3. Process management stuff is interesting, potentially we could do other integration testing in a similar way. I would like to build integration tests for the jsii-config tool with similar interactions via child_process.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

packages/@jsii/integ-test/README.md Outdated Show resolved Hide resolved
packages/@jsii/integ-test/package.json Outdated Show resolved Hide resolved
packages/@jsii/integ-test/package.json Outdated Show resolved Hide resolved
packages/@jsii/integ-test/package.json Outdated Show resolved Hide resolved
packages/@jsii/integ-test/package.json Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from a99ddf7 to ca6bf1b Compare January 28, 2020 01:48
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

Noice! Looking solid at this point... some super minor comments, but nothing blocking.

Waiting for you to figure out why the PR build does not pass & fix that :)

packages/@jsii/integ-test/test/build-cdk.test.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Show resolved Hide resolved
packages/@jsii/integ-test/utils/index.ts Outdated Show resolved Hide resolved
@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from ca6bf1b to 342020b Compare January 29, 2020 01:36
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from 342020b to ae2cbb8 Compare January 29, 2020 18:38
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from ae2cbb8 to 1e76dd6 Compare January 29, 2020 23:51
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from 1e76dd6 to 6560d16 Compare February 10, 2020 02:05
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

Minor comments only!

packages/@jsii/integ-test/package.json Outdated Show resolved Hide resolved
packages/@jsii/integ-test/package.json Show resolved Hide resolved
packages/@jsii/integ-test/test/build-cdk.test.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/test/build-cdk.test.ts Outdated Show resolved Hide resolved
packages/@jsii/integ-test/test/build-cdk.test.ts Outdated Show resolved Hide resolved
Comment on lines 60 to 65
await processes.spawn('npx', [
'lerna',
'run',
'--stream',
'--scope',
'@aws-cdk/*',
'--scope',
'aws-cdk',
'build',
'--',
'--jsii',
path.join(JSII_DIR, 'bin', 'jsii'),
], { cwd: srcDir });
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using the --jsii path/to/jsii argument, why not use the CDK_BUILD_JSII environment variable? Is there a difference?

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"composite": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? I reckon this also disables incremental...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tsc throws tsconfig.json(3,5): error TS6304: Composite projects may not disable declaration emit. ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, right. Composite requires declarations... but why bother?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah idk, I wasn't quite sure the ideal solve here. Outputting declarations is fine? Just doesn't feel like we should need to do.

packages/@jsii/integ-test/utils/index.ts Show resolved Hide resolved
@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from 6560d16 to 241c5a7 Compare February 12, 2020 00:06
RomainMuller
RomainMuller previously approved these changes Feb 12, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 12, 2020

This unit test requires a github access token defined in the environment

Wait, why not clone the release branch of the public repo, or download the latest release's source? Neither of those should need a GitHub token, rite?

MrArnoldPalmer and others added 3 commits February 13, 2020 15:33
Adds @jsii/integ-test private module for defining new integration tests.
Adds a new integration test that downloads the latest CDK release source
code and builds it with the local version of jsii and jsii-pacmak.

This unit test requires a github access token defined in the environment
to get the latest release version and download the asset.

Fixes: aws#1209
Co-Authored-By: Romain Marcadier-Muller <[email protected]>
Use the tar node module instead of shelling out to tar. This allows us
to stream the download contents directly to unpacking and removes the
need to manually parse the beginning of the commit id hash to traverse
into the build directory.
@MrArnoldPalmer
Copy link
Contributor Author

Wait, why not clone the release branch of the public repo, or download the latest release's source? Neither of those should need a GitHub token, rite?

We use the token to hit the GH API and get the tag of the latest release. Then using that tag we download the source from the archive. Neither of these actually requires a token but it gets rate limited pretty quickly without one.

Doing a git clone and checkout of the release branch wouldn't require a token, but I'd rather us know the specific tag we are checking out and not check out the latest release branch. In my mind its more robust? 🧐 Asking for "latest published release" vs git checkout release feels more decoupled.

@MrArnoldPalmer MrArnoldPalmer removed the pr/do-not-merge This PR should not be merged at this time. label Feb 14, 2020
@MrArnoldPalmer MrArnoldPalmer force-pushed the feature/cdk-build-integ-test branch from 241c5a7 to e90246f Compare February 14, 2020 01:07
@mergify mergify bot dismissed RomainMuller’s stale review February 14, 2020 01:07

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-Blkkw9bQFn8A
  • Commit ID: e90246f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@MrArnoldPalmer MrArnoldPalmer merged commit e99d722 into aws:master Feb 14, 2020
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 aws-cdk as an integration test for jsii
4 participants