aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

feat(pipelines): add static PipelineBase.isPipeline method

Open Rabadash8820 opened this issue 3 years ago • 10 comments
trafficstars

This change adds a new isPipeline method to PipelineBase. This method works the same way as Stack.isStack (checking if a specific Symbol property is defined on the provided object), and serves the same purpose: to check if a provided object extends PipelineBase (e.g., CodePipeline would return true, while Stack or s3.Bucket would return false).


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

Rabadash8820 avatar Jul 09 '22 21:07 Rabadash8820

gitpod-io[bot] avatar Jul 09 '22 21:07 gitpod-io[bot]

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 avatar Aug 03 '22 00:08 aws-cdk-automation

@TheRealAmazonKendra Sorry for the delay on this. I just added a unit test for the new isPipeline method, based on the unit test for Stack.isStack. As you mentioned above, there was no existing file for PipelineBase tests, so I added one at packages/@aws-cdk/pipelines/test/main/pipeline-base.test.ts. This mirrors the folder hierarchy of the PipelineBase.ts file itself. Note that, aside from the automated checks on this PR, I have not actually run this new test myself (setting up builds/tests in VS Code was taking more effort than I cared to invest), so you or whoever is reviewing the code may want run it locally yourself.

Rabadash8820 avatar Aug 09 '22 06:08 Rabadash8820

@mergifyio update

mrgrain avatar Aug 09 '22 10:08 mrgrain

update

✅ Branch has been successfully updated

mergify[bot] avatar Aug 09 '22 10:08 mergify[bot]

Hey @Rabadash8820 change looks good but could you please make sure your code is using the correct styling. You can run the linter locally to fix or the PR build tells you any violations. Thanks.

mrgrain avatar Aug 09 '22 10:08 mrgrain

@mrgrain Which PR check shows the styling violations? I don't have access to the AWS account linked from the AWS CodeBuild us-east-1 check, and the PR Linter check shows everything as passing. 🤔

Rabadash8820 avatar Aug 09 '22 17:08 Rabadash8820

@Rabadash8820 I've been there. The build posts a comment with link to the public build logs. https://github.com/aws/aws-cdk/pull/21075#issuecomment-1209215774

Will be much easier if you run yarn lint in the pipelines project though. 🤷🏻 Which is explained in the CONTRIBUTING guide.

mrgrain avatar Aug 09 '22 17:08 mrgrain

As @mrgrain notes, we have multiple linters. The PR linter only informs you of what is missing from the PR, i.e. unit tests, integration tests, or a README update. We also run eslint, pkglint, and awslint in the build.

If you look at the message posted by aws-cdk-automation, you can see the output of the build (pasted below for your convenience):

AWS CodeBuild CI Report CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv Commit ID: https://github.com/aws/aws-cdk/commit/ab777921eae4184865439bedba3b746549405f9a Result: FAILED Build Logs (available for 30 days) Powered by github-codebuild-logs, available on the AWS Serverless Application Repository:

The build logs link will take our straight to the build output so you can see any failure messages, errors, etc. We cannot accept code changes that do not pass the build.

With ~65 open PRs and ~1700 open issues, we do not have the capacity to fix tests and code on behalf of contributors. We appreciate the work of everyone and we are happy to answer any questions about failures/error/unclear documentation.

TheRealAmazonKendra avatar Aug 09 '22 19:08 TheRealAmazonKendra

Thanks for the pointers, @mrgrain and @TheRealAmazonKendra. I've fixed those styling issues and updated the unit test so that it actually passes (see latest commit message for more info). It took a little while cause the yarn build and yarn test commands were running really slow, which made it hard to iterate on the unit test and its test PipelineBase implementation. I think this might be because I was running the commands in WSL but the actual source files were cloned in my Windows filesystem. I haven't tried cloning inside WSL yet, but I bet that that would improve performance of the yarn commands.

Rabadash8820 avatar Aug 14 '22 06:08 Rabadash8820

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] avatar Aug 15 '22 15:08 mergify[bot]

AWS CodeBuild CI Report

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

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

aws-cdk-automation avatar Aug 15 '22 16:08 aws-cdk-automation

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] avatar Aug 15 '22 16:08 mergify[bot]