-
Notifications
You must be signed in to change notification settings - Fork 284
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
enhancement/Automate Update the manifest refs to tags #4190
Changes from all commits
5814ca3
8278e2b
6787246
cd6bcf2
c282256
ba4388e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
|
||
import yaml | ||
|
||
folder_path = sys.argv[1] | ||
# Define the folder where YAML files are located | ||
# folder_path = f"/manifests/{new_version}" # Replace with the actual folder path | ||
|
||
# Get the folder name and use it as the new version | ||
new_version = os.path.basename(folder_path) | ||
|
||
# Define a list of component names that should have the same version as 'OpenSearch' and 'common-utils' | ||
same_version_components = ['OpenSearch', 'common-utils'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only OpenSearch/OpenSearch-Dashboards/functionaltestrepo has same 3 digit version number, others will have 4 digit numbers with 0 as the 4th digit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will check this out and update the code accordingly. |
||
|
||
# Iterate through YAML files in the folder and update the 'ref' in each file | ||
for filename in os.listdir(folder_path): | ||
if filename.endswith('.yml'): | ||
yaml_file = os.path.join(folder_path, filename) | ||
with open(yaml_file, 'r') as file: | ||
data = yaml.safe_load(file) | ||
for component in data.get('components', []): | ||
if component['name'] in same_version_components: | ||
ref = component.get('ref', 'Not found') | ||
component['ref'] = f'tags/{new_version}' | ||
else: | ||
component['ref'] = f'tags/{new_version}.0' | ||
|
||
with open(yaml_file, 'w') as file: | ||
yaml.dump(data, file) | ||
Comment on lines
+16
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We only care about the input manifest with this and we dont care about the test manifest and others for now. |
||
|
||
print(f"Ref values updated in the specified YAML files in the folder. New version: {new_version}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should consider using the logging instead of using plain printf. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, you should allow users to enter the manifest full path and retrieve the version from the actual yml file like in any other workflow in this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was one of the possible workflow solutions in the issue discussions.
#2546 (comment)