Skip to content

test automatically prevent future merges when a backport fails #1909

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

Merged
merged 31 commits into from
Jun 23, 2022

Conversation

Mikaayenson
Copy link
Contributor

@Mikaayenson Mikaayenson commented Apr 1, 2022

Issues

Resolves #1882
Related to elastic/ia-trade-team/issues/26

Summary

BLUF Recommendation / Solution

  • Get a list from a file that can be used in multiple workflows
  • Break out the test to a seperate workflow: Branch Version Status Checks
  • Check the branch versions in parallel against the Unit Test workflow to make sure they're in a passing state.
  • Update other workflows to pull from the target-branches.yml which is generated via get_stack_versions during the CI workflow.

Details

GH Status API

GH Actions API

Testing

  • Getting the status of all supported branches would be nice if we can use the matrix defined in the backport.yml workflow.
  • It doesn't appear that we can share the matrix across workflows via environment variable as-is since it's a list. Also we probably don't want the unit test to rely on environment variables from backport.yml
  • As highlighted by Justin, we do not want to have to maintain multiple lists so we can either store and load a list from a file, or store the list in a workflow and share the list as an artifact between workflows.
  • Loading from a file would require a job that outputs a matrix from the file as a dependency to the rest of the workflow. This way the workflow strategy runs correctly against the version branches.

@Mikaayenson Mikaayenson self-assigned this Apr 1, 2022
@Mikaayenson Mikaayenson marked this pull request as ready for review April 1, 2022 16:17
@Mikaayenson
Copy link
Contributor Author

Currently configured to test manually but will add it to trigger on pull request later.

Copy link
Contributor

@terrancedejesus terrancedejesus left a comment

Choose a reason for hiding this comment

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

LGTM

@brokensound77 brokensound77 marked this pull request as draft April 1, 2022 23:54
@Mikaayenson Mikaayenson changed the title WIP: test automatically prevent future merges when a backport fails test automatically prevent future merges when a backport fails Apr 19, 2022
@Mikaayenson Mikaayenson marked this pull request as ready for review April 19, 2022 16:24
@Mikaayenson
Copy link
Contributor Author

Mikaayenson commented Apr 19, 2022

This is currently was failing the test because cavokz manually skipped the last backport workflow.
The fail is a good thing. We just need to delete the workflow and rerun the unit test.

Screen Shot 2022-04-19 at 12 33 50 PM

Copy link
Contributor

@brokensound77 brokensound77 left a comment

Choose a reason for hiding this comment

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

@Mikaayenson
Copy link
Contributor Author

https://github.com/elastic/detection-rules/pull/1909/files#r855654245

Updated the description with the proposed solution.

@Mikaayenson Mikaayenson added ci/cd enhancement New feature or request v8.3.0 Rules for 8.3.0 labels May 2, 2022
@botelastic botelastic bot added the python Internal python for the repository label Jun 22, 2022
Copy link
Contributor

@brokensound77 brokensound77 left a comment

Choose a reason for hiding this comment

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

Once this has been E2E tested with all of the recent changes, then I think it is good to go. Thanks! 🎉

@Mikaayenson Mikaayenson merged commit 4fdd978 into main Jun 23, 2022
@Mikaayenson Mikaayenson deleted the 1899-automatically-prevent-future-merges branch June 23, 2022 18:59
protectionsmachine pushed a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails

(cherry picked from commit 4fdd978)
protectionsmachine pushed a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails

(cherry picked from commit 4fdd978)
protectionsmachine pushed a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails

(cherry picked from commit 4fdd978)
protectionsmachine pushed a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails

(cherry picked from commit 4fdd978)
protectionsmachine pushed a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails

(cherry picked from commit 4fdd978)
Mikaayenson added a commit that referenced this pull request Jun 23, 2022
automatically prevent future merges when a backport fails
Mikaayenson added a commit that referenced this pull request Jun 27, 2022
automatically prevent future merges when a backport fails
Mikaayenson added a commit that referenced this pull request Jun 27, 2022
automatically prevent future merges when a backport fails
Mikaayenson added a commit that referenced this pull request Jun 27, 2022
automatically prevent future merges when a backport fails
Mikaayenson added a commit that referenced this pull request Jun 27, 2022
automatically prevent future merges when a backport fails
Mikaayenson added a commit that referenced this pull request Jun 27, 2022
automatically prevent future merges when a backport fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto ci/cd enhancement New feature or request python Internal python for the repository v8.3.0 Rules for 8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] Verify backport branches in passing state before allowing backport PRs
3 participants