Skip to content

Commit 25436c7

Browse files
Allow incremental build to respect version qualifier (#5327)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 95f1b58 commit 25436c7

File tree

3 files changed

+246
-1
lines changed

3 files changed

+246
-1
lines changed

src/build_workflow/build_incremental.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ def commits_diff(self, input_manifest: InputManifest) -> List[str]:
2828
return [input_manifest.build.name.replace(" ", "-")]
2929
previous_build_manifest = BuildManifest.from_path(build_manifest_path)
3030
stable_input_manifest = input_manifest.stable()
31-
if previous_build_manifest.build.version != stable_input_manifest.build.version:
31+
stable_input_manifest_version = (
32+
stable_input_manifest.build.version
33+
if not stable_input_manifest.build.qualifier
34+
else f"{stable_input_manifest.build.version}-{stable_input_manifest.build.qualifier}"
35+
)
36+
if previous_build_manifest.build.version != stable_input_manifest_version:
3237
logging.info("The version of previous build manifest doesn't match the current input manifest. Rebuilding Core.")
3338
return [input_manifest.build.name.replace(" ", "-")]
3439
components = []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
schema-version: '1.1'
3+
build:
4+
name: OpenSearch
5+
version: 3.0.0
6+
qualifier: alpha1
7+
ci:
8+
image:
9+
name: opensearchstaging/ci-runner:ci-runner-al2-opensearch-build-v1
10+
args: -e JAVA_HOME=/opt/java/openjdk-23
11+
components:
12+
- name: OpenSearch
13+
repository: https://github.com/opensearch-project/OpenSearch.git
14+
ref: main
15+
- name: common-utils
16+
repository: https://github.com/opensearch-project/common-utils.git
17+
ref: main
18+
platforms:
19+
- linux
20+
- windows
21+
- name: opensearch-learning-to-rank-base
22+
repository: https://github.com/opensearch-project/opensearch-learning-to-rank-base.git
23+
ref: main
24+
platforms:
25+
- linux
26+
- windows
27+
- name: opensearch-remote-metadata-sdk
28+
repository: https://github.com/opensearch-project/opensearch-remote-metadata-sdk.git
29+
ref: main
30+
platforms:
31+
- linux
32+
- windows
33+
- name: job-scheduler
34+
repository: https://github.com/opensearch-project/job-scheduler.git
35+
ref: main
36+
platforms:
37+
- linux
38+
- windows
39+
- name: security
40+
repository: https://github.com/opensearch-project/security.git
41+
ref: main
42+
platforms:
43+
- linux
44+
- windows
45+
- name: k-NN
46+
repository: https://github.com/opensearch-project/k-NN.git
47+
ref: main
48+
platforms:
49+
- linux
50+
- windows
51+
- name: geospatial
52+
repository: https://github.com/opensearch-project/geospatial.git
53+
ref: main
54+
platforms:
55+
- linux
56+
- windows
57+
depends_on:
58+
- job-scheduler
59+
- name: cross-cluster-replication
60+
repository: https://github.com/opensearch-project/cross-cluster-replication.git
61+
ref: main
62+
platforms:
63+
- linux
64+
- windows
65+
depends_on:
66+
- common-utils
67+
- name: ml-commons
68+
repository: https://github.com/opensearch-project/ml-commons.git
69+
ref: main
70+
platforms:
71+
- linux
72+
- windows
73+
depends_on:
74+
- common-utils
75+
- name: neural-search
76+
repository: https://github.com/opensearch-project/neural-search.git
77+
ref: main
78+
platforms:
79+
- linux
80+
- windows
81+
depends_on:
82+
- ml-commons
83+
- k-NN
84+
- name: notifications-core
85+
repository: https://github.com/opensearch-project/notifications.git
86+
ref: main
87+
working_directory: notifications
88+
platforms:
89+
- linux
90+
- windows
91+
depends_on:
92+
- common-utils
93+
- name: notifications
94+
repository: https://github.com/opensearch-project/notifications.git
95+
ref: main
96+
working_directory: notifications
97+
platforms:
98+
- linux
99+
- windows
100+
depends_on:
101+
- common-utils
102+
- name: opensearch-observability
103+
repository: https://github.com/opensearch-project/observability.git
104+
ref: main
105+
platforms:
106+
- linux
107+
- windows
108+
depends_on:
109+
- common-utils
110+
- name: opensearch-reports
111+
repository: https://github.com/opensearch-project/reporting.git
112+
ref: main
113+
platforms:
114+
- linux
115+
- windows
116+
depends_on:
117+
- common-utils
118+
- job-scheduler
119+
- name: sql
120+
repository: https://github.com/opensearch-project/sql.git
121+
ref: main
122+
platforms:
123+
- linux
124+
- windows
125+
depends_on:
126+
- ml-commons
127+
- name: asynchronous-search
128+
repository: https://github.com/opensearch-project/asynchronous-search.git
129+
ref: main
130+
platforms:
131+
- linux
132+
- windows
133+
depends_on:
134+
- common-utils
135+
- name: anomaly-detection
136+
repository: https://github.com/opensearch-project/anomaly-detection.git
137+
ref: main
138+
platforms:
139+
- linux
140+
- windows
141+
depends_on:
142+
- common-utils
143+
- job-scheduler
144+
- name: alerting
145+
repository: https://github.com/opensearch-project/alerting.git
146+
ref: main
147+
platforms:
148+
- linux
149+
- windows
150+
depends_on:
151+
- common-utils
152+
- name: security-analytics
153+
repository: https://github.com/opensearch-project/security-analytics.git
154+
ref: main
155+
platforms:
156+
- linux
157+
- windows
158+
depends_on:
159+
- common-utils
160+
- alerting
161+
- job-scheduler
162+
- name: index-management
163+
repository: https://github.com/opensearch-project/index-management.git
164+
ref: main
165+
platforms:
166+
- linux
167+
- windows
168+
depends_on:
169+
- common-utils
170+
- job-scheduler
171+
- name: performance-analyzer
172+
repository: https://github.com/opensearch-project/performance-analyzer.git
173+
ref: main
174+
platforms:
175+
- linux
176+
- name: custom-codecs
177+
repository: https://github.com/opensearch-project/custom-codecs.git
178+
ref: main
179+
platforms:
180+
- linux
181+
- windows
182+
- name: flow-framework
183+
repository: https://github.com/opensearch-project/flow-framework.git
184+
ref: main
185+
platforms:
186+
- linux
187+
- windows
188+
depends_on:
189+
- common-utils
190+
- opensearch-remote-metadata-sdk
191+
- name: skills
192+
repository: https://github.com/opensearch-project/skills.git
193+
ref: main
194+
platforms:
195+
- linux
196+
- windows
197+
depends_on:
198+
- job-scheduler
199+
- anomaly-detection
200+
- sql
201+
- ml-commons
202+
- name: query-insights
203+
repository: https://github.com/opensearch-project/query-insights.git
204+
ref: main
205+
platforms:
206+
- linux
207+
- windows
208+
- name: opensearch-system-templates
209+
repository: https://github.com/opensearch-project/opensearch-system-templates.git
210+
ref: main
211+
platforms:
212+
- linux
213+
- windows

tests/tests_build_workflow/test_build_incremental.py

+27
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
class TestBuildIncremental(unittest.TestCase):
1919
INPUT_MANIFEST = InputManifest.from_path(
2020
os.path.join(os.path.dirname(__file__), "data", "opensearch-input-2.12.0.yml"))
21+
INPUT_MANIFEST_QUALIFIER = InputManifest.from_path(
22+
os.path.join(os.path.dirname(__file__), "data", "opensearch-input-3.0.0-alpha1.yml"))
2123
BUILD_MANIFEST = BuildManifest.from_path(
2224
os.path.join(os.path.dirname(__file__), "data", "opensearch-build-tar-2.12.0.yml"))
2325
BUILD_MANIFEST_WINDOWS = BuildManifest.from_path(
@@ -54,6 +56,31 @@ def test_no_commits_diff(self, stable_mock_input_manifest: MagicMock, mock_build
5456
self.assertFalse(diff_list)
5557
self.assertEqual(len(diff_list), 0)
5658

59+
@patch("os.path.exists")
60+
@patch("manifests.build_manifest.BuildManifest.from_path")
61+
@patch("manifests.input_manifest.InputManifest.stable")
62+
def test_no_commits_diffi_with_qualifier(self, stable_mock_input_manifest: MagicMock, mock_build_manifest: MagicMock, mock_path_exists: MagicMock) -> None:
63+
mock_path_exists.return_value = True
64+
input_manifest_data = {'schema-version': '1.1', 'build': {'name': 'OpenSearch', 'version': '3.0.0', 'qualifier': 'alpha1'},
65+
'components': [{'name': 'OpenSearch',
66+
'repository': 'https://github.com/opensearch-project/OpenSearch.git',
67+
'ref': '91a93dacb84eae4f09decbabe54771585d42b570',
68+
'checks': ['gradle:publish', 'gradle:properties:version']}]}
69+
build_manifest_data = {'schema-version': '1.2',
70+
'build': {'name': 'OpenSearch', 'version': '3.0.0-alpha1', 'platform': 'linux',
71+
'architecture': 'x64', 'id': 'b2b848e29077488ca7e8c37501b36c87'},
72+
'components': [{'name': 'OpenSearch',
73+
'repository': 'https://github.com/opensearch-project/OpenSearch.git',
74+
'ref': 'main', 'commit_id': '91a93dacb84eae4f09decbabe54771585d42b570',
75+
'version': '3.0.0-alpha1'}]}
76+
stable_mock_input_manifest.return_value = InputManifest(input_manifest_data)
77+
mock_build_manifest.return_value = BuildManifest(build_manifest_data)
78+
79+
diff_list = self.buildIncremental.commits_diff(self.INPUT_MANIFEST_QUALIFIER)
80+
81+
self.assertFalse(diff_list)
82+
self.assertEqual(len(diff_list), 0)
83+
5784
@patch("os.path.exists")
5885
@patch("manifests.build_manifest.BuildManifest.from_path")
5986
@patch("manifests.input_manifest.InputManifest.stable")

0 commit comments

Comments
 (0)