Skip to content

Followup from auto-generation of branches #494

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 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: versions

on:
push:
schedule:
- cron: "0 0 * * *"

Expand Down
2 changes: 1 addition & 1 deletion bundle-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ The following options are available.

### Auto-Generate Manifests

The [manifests workflow](src/manifests) reacts to version increments in OpenSearch and its components by extracting Gradle properties from project branches. When a new version is identified, it creates a new input manifest in [manifests](../manifests) and [opens a pull request](../.github/workflows/manifests.yml).
The [manifests workflow](src/manifests) reacts to version increments in OpenSearch and its components by extracting Gradle properties from project branches. Currently OpenSearch `main`, and `x.y` branches are checked out one-by-one, published to local maven, and their versions extracted using `./gradlew properties`. When a new version is found, a new input manifest is added to [manifests](../manifests), and [a pull request is opened](../.github/workflows/manifests.yml) (e.g. [opensearch-build#491](https://github.com/opensearch-project/opensearch-build/pull/491)).

Show information about existing manifests.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, repo, snapshot=False):
super().__init__("OpenSearch", repo, snapshot)

@classmethod
def get_root_branches(self):
def get_branches(self):
branches = ["main"]
remote_branches = (
subprocess.check_output(
Expand All @@ -27,6 +27,7 @@ def get_root_branches(self):
.decode()
.split("\n")
)
# return "main" and "x.y" branches only
branches.extend(filter(lambda b: re.match(r"[\d]+.[\dx]*", b), remote_branches))
return branches

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def update(self, keep=False):
os.chdir(work_dir)

# check out and build OpenSearch#main, 1.x, etc.
opensearch_branches = ComponentOpenSearchMin.get_root_branches()
opensearch_branches = ComponentOpenSearchMin.get_branches()
logging.info(f"Checking OpenSearch {opensearch_branches} branches")
for branch in opensearch_branches:
opensearch = ComponentOpenSearchMin.checkout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

class TestComponentOpenSearchMin(unittest.TestCase):
@patch("subprocess.check_output")
def test_get_root_branches(self, mock):
def test_get_branches(self, mock):
mock.return_value = "\n".join(
["main", "1.x", "1.21", "20.1", "something", "else"]
).encode()
self.assertEqual(
ComponentOpenSearchMin.get_root_branches(), ["main", "1.x", "1.21", "20.1"]
ComponentOpenSearchMin.get_branches(), ["main", "1.x", "1.21", "20.1"]
)
mock.assert_called_with(
"git ls-remote https://github.com/opensearch-project/OpenSearch.git refs/heads/* | cut -f2 | cut -d/ -f3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_update(
):
mock_tmpdir.__enter__.return_value = "dir"
mock_component_opensearch_min.return_value = MagicMock(name="OpenSearch")
mock_component_opensearch_min.get_root_branches.return_value = ["main", "0.9.0"]
mock_component_opensearch_min.get_branches.return_value = ["main", "0.9.0"]
mock_component_opensearch_min.checkout.return_value = MagicMock(version="0.9.0")
mock_component_opensearch.return_value = MagicMock(name="common-utils")
mock_component_opensearch.checkout.return_value = MagicMock(version="0.10.0")
Expand Down