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

enhancement/Automate Update the manifest refs to tags #4190

Conversation

hitenshKharva
Copy link
Contributor

Description

Describe what this change achieves.

Issues Resolved

Issue

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.

Signed-off-by: Hitensh Kharva <[email protected]>
@hitenshKharva hitenshKharva marked this pull request as draft November 7, 2023 19:12
@hitenshKharva
Copy link
Contributor Author

As discussed during office hours, @peterzhuamazon I have deleted the Github actions yml file. I will raise another PR for the yml file github actions. Thank you.

@hitenshKharva hitenshKharva marked this pull request as ready for review November 7, 2023 19:34
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.29%. Comparing base (aa05541) to head (ba4388e).
Report is 508 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4190      +/-   ##
==========================================
- Coverage   93.31%   93.29%   -0.03%     
==========================================
  Files         187      187              
  Lines        5792     5802      +10     
==========================================
+ Hits         5405     5413       +8     
- Misses        387      389       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterzhuamazon peterzhuamazon marked this pull request as draft November 7, 2023 19:43
@peterzhuamazon
Copy link
Member

As discussed during office hours, @peterzhuamazon I have deleted the Github actions yml file. I will raise another PR for the yml file github actions. Thank you.

Thanks @hitenshKharva .

I have converted this PR back to draft until you have all the test cases ready before review.

Thanks!

Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Hi @hitenshKharva thanks for the initial draft,

Have a few comments and we can talk about the key implementations more either in officehour or in private.

This piece should first exist within src folder, either side in a existing workflow dir or in a new release_workflow dir instead of github workflow dir.

Next, the implementation is simply working as a piece of quick script and needs some structure compares to other workflows, it needs real arguments instead of grabbing user inputs from argv, for example.

Finally it needs a entrypoint to run these functions through classes instead of running as is. I would recommend reading through the build or assemble workflow to get an idea on how it is being shaped.

Happy to discuss more on the next step of improvement.

Thanks!

# 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)
Copy link
Member

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.

Copy link
Contributor Author

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)

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']
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check this out and update the code accordingly.

Comment on lines +16 to +30
# 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)
Copy link
Member

Choose a reason for hiding this comment

The 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.
You could consider only working on the yml user pointed to you instead of the folder approach as there might be outliers or make the scope too complicated.

with open(yaml_file, 'w') as file:
yaml.dump(data, file)

print(f"Ref values updated in the specified YAML files in the folder. New version: {new_version}")
Copy link
Member

Choose a reason for hiding this comment

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

You should consider using the logging instead of using plain printf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay sure

@gaiksaya
Copy link
Member

Closing this PR in favor of #4868

@gaiksaya gaiksaya closed this Aug 21, 2024
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.

3 participants