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

Auto-increment next development iteration. #1816

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

dblock
Copy link
Member

@dblock dblock commented Dec 28, 2021

Signed-off-by: dblock [email protected]

Description

Adds a workflow that increments the version of OpenSearch whenever a new X.Y.Z tag is pushed.

To test this I pushed a 1.2.4 tag to my branch, git tag -d 1.2.4 ; git tag 1.2.4 ; git push origin :1.2.4 ; git push origin --tags. That's what would happen if we were to release 1.2.4 tomorrow.

The new workflow produces 3 PRs similar to #1758 and backport PRs into main, and 1.x. It removes the manual steps that start triggering the whole automation to produce the next patch release.

Screen Shot 2021-12-28 at 2 05 35 PM

It's possible that this implementation could be done differently/better using gradle, and potentially reused by other components "as is", but I think it's a good enough start because it saves a bunch of manual work.

Issues Resolved

Part of opensearch-project/opensearch-build#1375.

Check List

  • Commits are signed per the DCO using --signoff

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.

@dblock dblock requested a review from a team as a code owner December 28, 2021 18:20
@opensearch-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@dblock dblock force-pushed the auto-increment-version branch 3 times, most recently from 2a456cc to 8b2e0af Compare December 28, 2021 18:57
@dblock dblock requested a review from andrross December 28, 2021 19:01
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success fea263e
Log 1697

Reports 1697

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 90bb9d61278e5ceecde7ee26bc6d82ffa89f27cd
Log 1698

Reports 1698

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 2a456cce8d1467042fa81ad0bddca8aabeb3ac2a
Log 1699

Reports 1699

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 8b2e0afeb82868d1c4ddebec40fbf6dcb096bd72
Log 1700

Reports 1700

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 960ef55
Log 1701

Reports 1701

@dblock
Copy link
Member Author

dblock commented Dec 28, 2021

Log 1701

#1817

@dblock
Copy link
Member Author

dblock commented Dec 28, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 960ef55
Log 1703

Reports 1703

@dblock
Copy link
Member Author

dblock commented Dec 28, 2021

@saratvemulapalli @andrross could i get a CR on this please since we’re not done making log4j patch releases any time soon …

uses: peter-evans/create-pull-request@v3
with:
base: ${{ env.BASE }}
branch: 'create-pull-request/patch-${{ env.BASE }}'
Copy link
Member

@saratvemulapalli saratvemulapalli Dec 28, 2021

Choose a reason for hiding this comment

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

The bot will have problems creating a branch on OpenSearch as it doesn't have permissions to create one. Only maintainers on OpenSearch can.
This is the similar problem @VachaShah was trying solve for auto-backport workflow.

To quickly test out:

  1. On the fork you could enable branch protection
  2. Try running the workflow

The bot should have to create its own fork to solve this problem or we have to fiddle with the permissions.

Copy link
Member Author

@dblock dblock Dec 28, 2021

Choose a reason for hiding this comment

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

Would relaxing branch protection rules to only include actual versioned branches main and *.* work? I don't see why we need to have something so strict. Half of these shouldn't exist anyway.
Screen Shot 2021-12-28 at 5 54 50 PM

Copy link
Member

Choose a reason for hiding this comment

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

Yup that should solve it.
AFAIK it was enabled because of a CVE on github. @CEHENKLE might have more details.

Copy link
Member Author

Choose a reason for hiding this comment

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

On opensearch-build branch protection is only on "root" branches, "*". Can I just change it in this repo?

Copy link
Member

Choose a reason for hiding this comment

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

I believe it was because of https://medium.com/cider-sec/bypassing-required-reviews-using-github-actions-6e1b29135cc7.

I am in line with you to relax branch protection rules only to main and release branches.

Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Can we use https://github.com/marketplace/actions/version-increment to handle the version calculation?

@dblock
Copy link
Member Author

dblock commented Jan 3, 2022

https://github.com/marketplace/actions/version-increment

I've seen it and I am not sold. It's possible, but we have a lot of different version types to modify to do an actual version increment.

@dblock
Copy link
Member Author

dblock commented Jan 3, 2022

@saratvemulapalli I relaxed branch protection to only *.

@peternied
Copy link
Member

https://github.com/marketplace/actions/version-increment

I've seen it and I am not sold. It's possible, but we have a lot of different version types to modify to do an actual version increment.

Seems like we are going to be doing a lot of copypasta from this POC. Shame we couldn't leverage a library to centralize and validate this effort more easily.

@dblock
Copy link
Member Author

dblock commented Jan 4, 2022

https://github.com/marketplace/actions/version-increment

I've seen it and I am not sold. It's possible, but we have a lot of different version types to modify to do an actual version increment.

Seems like we are going to be doing a lot of copypasta from this POC. Shame we couldn't leverage a library to centralize and validate this effort more easily.

I agree, but this one is particularly long because OpenSearch has so many places where it needs code changes on a version increment along with 3 branches. Theoretically we can author a common GHA that extracts and increments the version (or use a thirdparty one as suggested), then find a more data-driven mechanism to apply changes like a patch. Open to suggestions towards that, but I also think automated > manual so even if this is pretty messy it's well self-contained in 1 GHA.

base: main
branch: 'create-pull-request/patch-main'
commit-message: Added bwc version ${{ env.NEXT_VERSION }}
delete-branch: true
Copy link
Member

Choose a reason for hiding this comment

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

@VachaShah you could use this for auto-backport workflow.
This should solve the problem of stale branches after the PR is merged.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @saratvemulapalli ! I just created a PR to fix the auto-backport workflow.

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

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

This is a great start, thanks @dblock !

I wish there was a better than a lot of bash magic, may be gradle.
We can always make it better.

@VachaShah VachaShah mentioned this pull request Jan 4, 2022
1 task
@dblock dblock merged commit 7a38109 into opensearch-project:main Jan 5, 2022
@dblock dblock deleted the auto-increment-version branch January 5, 2022 13:15
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 18, 2022
* Auto-increment next development iteration.

Signed-off-by: dblock <[email protected]>

* Make bwc increments on X.Y and main branches.

Signed-off-by: dblock <[email protected]>
(cherry picked from commit 7a38109)
VachaShah pushed a commit to VachaShah/OpenSearch that referenced this pull request Mar 2, 2022
* Auto-increment next development iteration.

Signed-off-by: dblock <[email protected]>

* Make bwc increments on X.Y and main branches.

Signed-off-by: dblock <[email protected]>
dblock added a commit that referenced this pull request Mar 2, 2022
* Auto-increment next development iteration.

Signed-off-by: dblock <[email protected]>

* Make bwc increments on X.Y and main branches.

Signed-off-by: dblock <[email protected]>
Signed-off-by: dblock <[email protected]>
VachaShah pushed a commit that referenced this pull request Mar 2, 2022
* Auto-increment next development iteration.

Signed-off-by: dblock <[email protected]>

* Make bwc increments on X.Y and main branches.

Signed-off-by: dblock <[email protected]>
Signed-off-by: dblock <[email protected]>

Co-authored-by: Daniel Doubrovkine (dB.) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants