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(pipelines): add static PipelineBase.isPipeline method #21075

Merged
merged 5 commits into from
Aug 15, 2022
Merged

feat(pipelines): add static PipelineBase.isPipeline method #21075

merged 5 commits into from
Aug 15, 2022

Conversation

Rabadash8820
Copy link
Contributor

@Rabadash8820 Rabadash8820 commented Jul 9, 2022

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

@gitpod-io
Copy link

gitpod-io bot commented Jul 9, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team July 9, 2022 21:26
@github-actions github-actions bot added the p2 label Jul 9, 2022
@TheRealAmazonKendra TheRealAmazonKendra added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Jul 12, 2022
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've exempted the requirements for a README update and integ-tests, but this will need unit tests. We really should have had unit tests for pipeline-base, but since we don't, feel free to create a new test file for it.

Everything else looks good.

@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.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 9, 2022 06:29

Pull request has been modified.

@Rabadash8820
Copy link
Contributor Author

@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.

@mrgrain
Copy link
Contributor

mrgrain commented Aug 9, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Aug 9, 2022

update

✅ Branch has been successfully updated

@mrgrain
Copy link
Contributor

mrgrain commented Aug 9, 2022

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.

@Rabadash8820
Copy link
Contributor Author

@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. 🤔

@mrgrain
Copy link
Contributor

mrgrain commented Aug 9, 2022

@Rabadash8820 I've been there. The build posts a comment with link to the public build logs.
#21075 (comment)

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

@TheRealAmazonKendra
Copy link
Contributor

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: ab77792
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.

@aws aws deleted a comment from Rabadash8820 Aug 9, 2022
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Putting this back into changes requested so we can see more clearly when updates have been made.

- Assertions now use correct types
- Test Pipeline object is now less ceremonious and just uses an anonymous type, and passes the  required `synth` prop to PipelineBase constructor
- Also fixed some styling/casing errors and inconsistencies
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 14, 2022 06:46

Pull request has been modified.

@Rabadash8820
Copy link
Contributor Author

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.

@mergify
Copy link
Contributor

mergify bot commented Aug 15, 2022

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit ea11f33 into aws:main Aug 15, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 15, 2022

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).

@Rabadash8820 Rabadash8820 deleted the isPipeline branch August 15, 2022 17:58
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
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:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### ~Adding new Unconventional Dependencies:~

~* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)~

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants