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

Update BTR release scripts to look at catalog-info.yaml for release info.#439 #467

Merged
merged 6 commits into from
Mar 6, 2024

Conversation

salman2013
Copy link
Contributor

@salman2013 salman2013 commented Dec 14, 2023

Description:

In this PR i updated the BTR release script which was previously checking openedx.yaml file to find the openedx-release tag and performing other release preparation operations, now the updated script first check the catalog_info.yaml file in all repositories and in case that file is not present it checks for openedx.yaml. I also tried to update some test cases related to it.

Ticket: https://github.com/orgs/openedx/projects/55/views/1?pane=issue&itemId=37975469

Copy link
Contributor

@nedbat nedbat left a comment

Choose a reason for hiding this comment

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

I didn't look through the tests yet, because the basic logic is different than I expected.

if data.get('openedx-release'):
repo = repo.refresh()
repos[repo] = data
repos = catalog_info_file(hub, orgs=orgs, branches=branches)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it will find all repos with a catalog-info.yaml file, and if it finds any, it won't look for repos with openedx.yaml. Is that what you want?

I thought the idea was the check each repo for a catalog-info.yaml file, and if the file isn't there, check for an openedx.yaml file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ned, you're right, it should look at each repo individually as you said. @salman2013 can you fix the code so it does that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nedbat @feanil my bad i misunderstood the requirements, let me update it and come back with another review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nedbat @feanil I fixed the code logic as per requirement, could you please take an other look, thanks.

@OmarIthawi
Copy link
Member

@salman2013 I'm jumping here to check about the openedx-translations catalog-info.yaml file.

That repo wasn't included in Olive because it had no openedx.yaml file.

Would this update include it for Redwood branches and tags?

@feanil
Copy link
Contributor

feanil commented Jan 10, 2024

@OmarIthawi after we merged this, we'll still need to add a new annotation to existing catalog-info.yaml files before they are included.

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

@salman2013 I think this is more on the right track but not quite right yet. In the current version, if we have a catalog-info.yaml at all, it will ignore the openedx.yaml file entirely. This is not exactly what we want, we want it to specifically ignore the openedx.yaml file only if there is data related to the release in the catalog-info.yaml

Rather than changing the current code that reads the openedx.yaml file, I suggest you just add new code that reads the catalog-info.yaml file and then pass the data from both up to the tag_release.py script which can then be smarter about what data it looks at.

Comment on lines 32 to 38
def find_file_content(repo, branch):
"""
Yield the data from all openedx.yaml files found in repositories in ``orgs``
Finds the data from all catalog-info.yaml or openedx.yaml files found in repositories in ``repo``
on any of ``branches``.
First, we check for catalog-info.yaml, If catalog-info.yaml is not found, we look for openedx.yaml file.

"""
Copy link
Contributor

Choose a reason for hiding this comment

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

The function signature and code suggest that it is a single repo and branch but the docstring seems to be referring to multiple repos and branches, please update the docstring.

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 removed this method when resolving the review comments and code logic.

contents = repo.file_contents(file_name, ref=branch)
break
except NotFoundError:
contents = None
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You don't need to re-assign this to none, since that's already the value, you can just call pass when catching the exception.

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 removed this method when resolving the review comments and code logic.


if contents is not None:
LOGGER.debug("Found openedx.yaml at %s:%s", repo.full_name, branch)
LOGGER.debug("Found %s at %s:%s", contents, repo.full_name, branch)
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to print the whole of contents here, but the name of the file it found. It maybe worth updating the find_file_contents code to also return the name of the file that it got the info from.

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 fixed it.

try:
data = yaml.safe_load(contents.decoded)
except Exception as exc:
LOGGER.error("Couldn't parse openedx.yaml from %s:%s, skipping repo", repo.full_name, branch, exc_info=True)
LOGGER.error("Couldn't parse %s from %s:%s, skipping repo", contents, repo.full_name, branch, exc_info=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, it should be the name of the file, not the full contents as that will be a lot of yaml to print and make it harder to read and understand the messages.

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 fixed it.

"""
data = {
repo.full_name: openedx_yaml
for repo, openedx_yaml
in iter_openedx_yaml(hub, org, branch)
in iter_openedx_release_yaml(hub, org, branch)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it may not make sense to update this tool at all. This one is specifically for reading the openedx.yaml and shouldn't mix it with catalog-info.yaml.

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 fixed it.

@salman2013
Copy link
Contributor Author

@feanil I have updated the PR and its ready for another round of review.

@@ -8,7 +8,7 @@
import yaml

from edx_repo_tools.auth import pass_github
from edx_repo_tools.data import iter_openedx_yaml
from edx_repo_tools.data import iter_openedx_release_yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

You no longer renamed this function but you did change the function signature, I think you need to update calls to this function.

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 missed that by mistake, now fixed it. thanks.

@arbrandes
Copy link
Contributor

FYI @cmltaWt0 as current release manager. This should be transparent for future releases, but still good to be aware of.

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

Generally looks good to me and I've tested locally. I found one issue which I made a PR against your PR for: salman2013#1

@feanil feanil merged commit e24267e into openedx:master Mar 6, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants