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

Added an automated api update bot for opensearch-py #664

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

saimedhi
Copy link
Collaborator

@saimedhi saimedhi commented Jan 31, 2024

Description

Added an automated api update bot for opensearch-py

Issues Resolved

Closes #619

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: saimedhi saimedhi@amazon.com

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d905bef) 72.14% compared to head (53637ef) 72.14%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #664   +/-   ##
=======================================
  Coverage   72.14%   72.14%           
=======================================
  Files          89       89           
  Lines        7945     7945           
=======================================
  Hits         5732     5732           
  Misses       2213     2213           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@saimedhi
Copy link
Collaborator Author

saimedhi commented Jan 31, 2024

To install the opensearchpy-api-update-bot, the administrator must grant approval for the request.

Failing tests are related to issue #653

@VachaShah please take a look.

Signed-off-by: saimedhi <saimedhi@amazon.com>
@saimedhi
Copy link
Collaborator Author

@VachaShah, shall we merge it? Is there any other way to test?

@VachaShah
Copy link
Collaborator

@VachaShah, shall we merge it? Is there any other way to test?

You can test it on your fork (remove the github app token step since that is related to the org). It should work without it on your fork and you can post here the PR that is created from this workflow.

@saimedhi
Copy link
Collaborator Author

saimedhi commented Feb 1, 2024

@VachaShah, I followed workflow given in the issue #619

Workflow: https://github.com/slack-ruby/slack-ruby-client/blob/master/.github/workflows/update_api.yml

Example outcome PR: saimedhi#24 produced with this workflow.

.github/workflows/update_api.yml Outdated Show resolved Hide resolved
.github/workflows/update_api.yml Outdated Show resolved Hide resolved
@@ -21,6 +22,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fix KeyError when scroll return no hits ([#616](https://github.com/opensearch-project/opensearch-py/pull/616))
- Fix reuse of `OpenSearch` using `Urllib3HttpConnection` and `AsyncOpenSearch` after calling `close` ([#639](https://github.com/opensearch-project/opensearch-py/pull/639))
### Automated API Update
- Your contribution here.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this line Your contribution here needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this line Your contribution here needed?

Yes, to update changelog, find and replace is used. We can change the text if required.

Copy link
Member

@dblock dblock Feb 2, 2024

Choose a reason for hiding this comment

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

You could reuse the title line, then you don't need the misleading "Your contribution here.", "### Automated API Update". Maybe call it "Updated APIs" to match the other sections language?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • Trying to find a way to update only in ## [Unreleased] section.

  • If "### Updated APIs" is used for finding, it will be present in changelog at several places in future after next release.

  • Action jacobtomlinson/gha-find-replace@v3 will not help if ### Updated APIs is present in several places.

- name: Update CHANGELOG
        uses: jacobtomlinson/gha-find-replace@v3
        with:
          find: "### Updated APIs"
          replace: "### Updated APIs\n- Updated opensearch-py to reflect the latest OpenSearch API spec."
          include: "**CHANGELOG.md"

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. I think that action could use a "replace first occurrence" feature, I took a look at the project and started with adding some unit tests - jacobtomlinson/gha-find-replace#61. Will follow up with that feature if it gets merged.

.github/workflows/update_api.yml Outdated Show resolved Hide resolved
@saimedhi
Copy link
Collaborator Author

saimedhi commented Feb 1, 2024

@VachaShah, please take a look. This workflow is working in my main branch but opensearch-py tests are not running on the created PR. PR created: saimedhi#29

Signed-off-by: saimedhi <saimedhi@amazon.com>
@saimedhi
Copy link
Collaborator Author

saimedhi commented Feb 2, 2024

@VachaShah, please take a look. This workflow is working in my main branch but opensearch-py tests are not running on the created PR. PR created: saimedhi#29

On my fork all the tests are passing. (screenshots from workflows)
Failing tests are related to #652

Screenshot 2024-02-01 at 4 05 05 PM Screenshot 2024-02-01 at 4 00 56 PM

@VachaShah
Copy link
Collaborator

@VachaShah, please take a look. This workflow is working in my main branch but opensearch-py tests are not running on the created PR. PR created: saimedhi#29

On my fork all the tests are passing. (screenshots from workflows) Failing tests are related to #652

Screenshot 2024-02-01 at 4 05 05 PM Screenshot 2024-02-01 at 4 00 56 PM

@saimedhi I think these tests are not appearing on your PR because the checks are running on the first commit but not on the second commit. Lets try one thing here: we can move the update changelog commit step to before creating the PR? So the PR would be created with both the commits.

Signed-off-by: saimedhi <saimedhi@amazon.com>
@saimedhi
Copy link
Collaborator Author

saimedhi commented Feb 2, 2024

@VachaShah, please take a look. This workflow is working in my main branch but opensearch-py tests are not running on the created PR. PR created: saimedhi#29

On my fork all the tests are passing. (screenshots from workflows) Failing tests are related to #652
Screenshot 2024-02-01 at 4 05 05 PM Screenshot 2024-02-01 at 4 00 56 PM

@saimedhi I think these tests are not appearing on your PR because the checks are running on the first commit but not on the second commit. Lets try one thing here: we can move the update changelog commit step to before creating the PR? So the PR would be created with both the commits.

Made the changes as suggested.
PR created: saimedhi#33

if: ${{ steps.cpr.outputs.pull-request-number != '' }}
with:
find: "- Your contribution here."
replace: "- Updated opensearch-py to reflect the latest OpenSearch API spec.\n- Your contribution here."
Copy link
Member

Choose a reason for hiding this comment

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

Let's change these messages to be something more specific? e.g. the commit of opensearch-api-specification that was used? This way we don't have a thousand PRs/commit messages that have the same title?

@dblock
Copy link
Member

dblock commented Feb 5, 2024

@VachaShah you good with this?

@saimedhi saimedhi merged commit 54e2fb6 into opensearch-project:main Feb 5, 2024
41 of 55 checks passed
AbitraryYu pushed a commit to AbitraryYu/opensearch-py that referenced this pull request Apr 22, 2024
…ct#664)

* Added an automated api update bot for opensearch-py

Signed-off-by: saimedhi <saimedhi@amazon.com>

* Added an automated api update bot for opensearch-py

Signed-off-by: saimedhi <saimedhi@amazon.com>

* Added an automated api update bot for opensearch-py

Signed-off-by: saimedhi <saimedhi@amazon.com>

---------

Signed-off-by: saimedhi <saimedhi@amazon.com>
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
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.

[FEATURE] run nox -rs generate on a cron
3 participants