-
Notifications
You must be signed in to change notification settings - Fork 40
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
Update BTR release scripts to look at catalog-info.yaml for release info.#439 #467
Conversation
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.
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) |
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 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.
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.
Ned, you're right, it should look at each repo individually as you said. @salman2013 can you fix the code so it does that?
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.
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.
…r openedx release
@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 Would this update include it for Redwood branches and tags? |
@OmarIthawi after we merged this, we'll still need to add a new annotation to existing catalog-info.yaml files before they are included. |
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.
@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.
edx_repo_tools/data.py
Outdated
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. | ||
|
||
""" |
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.
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.
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.
I removed this method when resolving the review comments and code logic.
edx_repo_tools/data.py
Outdated
contents = repo.file_contents(file_name, ref=branch) | ||
break | ||
except NotFoundError: | ||
contents = None |
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.
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.
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.
I removed this method when resolving the review comments and code logic.
edx_repo_tools/data.py
Outdated
|
||
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) |
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.
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.
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.
I fixed it.
edx_repo_tools/data.py
Outdated
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) |
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.
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.
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.
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) |
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.
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.
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.
I fixed it.
@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 |
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.
You no longer renamed this function but you did change the function signature, I think you need to update calls to this function.
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.
I missed that by mistake, now fixed it. thanks.
FYI @cmltaWt0 as current release manager. This should be transparent for future releases, but still good to be aware of. |
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.
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
Description:
In this PR i updated the BTR release script which was previously checking
openedx.yaml
file to find theopenedx-release
tag and performing other release preparation operations, now the updated script first check thecatalog_info.yaml
file in all repositories and in case that file is not present it checks foropenedx.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